mirror of
https://github.com/meteoinfo/MeteoInfo.git
synced 2025-12-08 20:36:05 +00:00
19 lines
493 B
Python
19 lines
493 B
Python
__all__ = ['get_pressure']
|
|
|
|
def get_pressure(wrfin, timeidx=0):
|
|
"""
|
|
Return the pressure in the specified units.
|
|
|
|
This function extracts the necessary variables from the NetCDF file
|
|
object in order to perform the calculation.
|
|
|
|
:param wrfin: (*DimDataFile*) Data file.
|
|
:param timeidx: (*int*) Time index. Default is `0`.
|
|
|
|
:returns: (*array*) Pressure (hPa).
|
|
"""
|
|
p = wrfin['P'][timeidx]
|
|
pb = wrfin['PB'][timeidx]
|
|
pres = (p + pb) * 0.01
|
|
|
|
return pres |