hibou.utils.metpy_calc#
- hibou.utils.metpy_calc(function: Callable, *variables, result_units: Unit = None)#
Apply a MetPy function on an array.
Parameters#
- function
Callable The function to apply.
- variables
Instances of Variable, the entries of the MetPy’s function called.
- result_units
pint.Unit, optionnal, keyword-only By default:
None. The units of the result in case we want to force it.
Returns#
tupleA tuple that contains the NumPy array of the result and its unit.
Examples#
Assuming that we have the temperature and the pressure in two arrays:
from metpy.calc import potential_temperature from metpy.units import units from hibou.utils import Variable, metpy_calc potential_temperature_array = metpy_calc( potential_temperature, Variable(temperature, units("°C"), Variable(pressure, units("hPa") )
- function