Agreed with @murf - the electronics enclosure isn’t intended to be run extensively out of the water, because it can overheat. If it needs to be run for a while in air then keeping it vented is a good idea. To avoid thermal throttling it would likely require either an aluminium enclosure, or taking the enclosure off the e-tray so it’s able to get consistent air-flow.
The Pixhawk has a barometer as part of its inbuilt sensor suite. I believe that’s mostly there for detecting altitude while flying (since the Pixhawk specification was designed for primarily aerial vehicles).