earthkit.meteo.thermo.specific_humidity_from_mixing_ratio¶
- earthkit.meteo.thermo.specific_humidity_from_mixing_ratio(w: ArrayLike) ArrayLike¶
- earthkit.meteo.thermo.specific_humidity_from_mixing_ratio(w: xarray.DataArray) xarray.DataArray
- earthkit.meteo.thermo.specific_humidity_from_mixing_ratio(w: earthkit.data.FieldList) earthkit.data.FieldList
Compute the specific humidity from mixing ratio.
- Parameters:
w (
array-like | xarray.DataArray) – Mixing ratio (kg/kg)- Returns:
Specific humidity (kg/kg)
- Return type:
array-like | xarray.DataArray
The result is the specific humidity in kg/kg units. The computation is based on the following definition [Wallace2006]:
\[q = \frac {w}{1+w}\]Implementations¶
specific_humidity_from_mixing_ratio()calls one of the following implementations depending on the type of the input arguments:earthkit.meteo.thermo.array.specific_humidity_from_mixing_ratio()for array-likeearthkit.meteo.thermo.xarray.specific_humidity_from_mixing_ratio()for xarray.DataArrayearthkit.meteo.thermo.fieldlist.specific_humidity_from_mixing_ratio()for FieldList
The function returns an object of the same type as the input arguments.