Calculation of the absolute humidity from the dewpoint is not working
Summary
absolute_humidity_from_dewpoint works not as described in the doc. water_vapour_pressure_over_water_magnus is used instead of saturation_water_vapour_pressure_over_water_magnus.
Steps to reproduce
parmesan.gas.humidity.absolute_humidity_from_dewpoint(dewpoint_temperature=units.Quantity(10, units.celsius))
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Input In [13], in <cell line: 2>()
1 # Absolute Freuchte des CMH berechnen
----> 2 df_cmh_filtered['abs_hum'] = 1000 * parmesan.gas.humidity.absolute_humidity_from_dewpoint(dewpoint_temperature=units.Quantity(df_cmh_filtered['tempdew_k'].values, units.celsius))
File h:\daniel\git\parmesan\parmesan\units.py:194, in ensure.<locals>.decorator.<locals>.wrapper(*args, **kwargs)
189 except BaseException as e:
190 raise ValueError(
191 f"{arg}={repr(value)} could not be converted to "
192 f"{units.Unit(should_be_unit).format_babel()}: {e}"
193 )
--> 194 return_value = decorated_fun(**arguments)
195 if mode.state is not None:
196 if hasattr(return_value, "to"):
File h:\daniel\git\parmesan\parmesan\bounds.py:299, in ensure.<locals>.decorator.<locals>.wrapper(*args, **kwargs)
296 elif mode.state == "strict":
297 raise OutOfBoundsError(msg)
--> 299 return_value = decorated_fun(*args, **kwargs)
300 with out_warnings(
301 pint.UnitStrippedWarning, RuntimeWarning, DeprecationWarning
302 ):
303 outliers = np.invert(
304 return_value_checker(return_value, *args, **kwargs)
305 )
File h:\daniel\git\parmesan\parmesan\gas\humidity.py:103, in absolute_humidity_from_dewpoint(dewpoint_temperature)
80 @absolute_humidity.register
81 @units.ensure(
82 "kg / m^3",
(...)
88 )
89 def absolute_humidity_from_dewpoint(dewpoint_temperature):
90 r"""
91 Calculate the absolute humidity :math:`\rho_\mathrm{w}` from the dewpoint
92 temperature :math:`T_\mathrm{d}` like
(...)
100 {R_\mathrm{H_2O} \cdot T_\mathrm{d}}
101 """
102 return absolute_humidity_from_water_vapour_pressure(
--> 103 water_vapour_pressure=water_vapour_pressure_over_water_magnus(#saturation_water_vapour_pressure_over_water_magnus(
104 temperature=dewpoint_temperature
105 ),
106 temperature=dewpoint_temperature,
107 )
File h:\daniel\git\parmesan\parmesan\units.py:150, in ensure.<locals>.decorator.<locals>.wrapper(*args, **kwargs)
148 if mode.state is None:
149 return decorated_fun(*args, **kwargs)
--> 150 bound_args = signature.bind(*args, **kwargs)
151 bound_args.apply_defaults()
152 arguments = bound_args.arguments
File ~\anaconda3\envs\CMH\lib\inspect.py:3179, in Signature.bind(self, *args, **kwargs)
3174 def bind(self, /, *args, **kwargs):
3175 """Get a BoundArguments object, that maps the passed `args`
3176 and `kwargs` to the function's signature. Raises `TypeError`
3177 if the passed arguments can not be bound.
3178 """
-> 3179 return self._bind(args, kwargs)
File ~\anaconda3\envs\CMH\lib\inspect.py:3094, in Signature._bind(self, args, kwargs, partial)
3092 msg = 'missing a required argument: {arg!r}'
3093 msg = msg.format(arg=param.name)
-> 3094 raise TypeError(msg) from None
3095 else:
3096 # We have a positional argument to process
3097 try:
TypeError: missing a required argument: 'relative_humidity'
Expected behavior
The absolute humidity shoul be calculated only by the given dewpoint.
Possible fixes
replace water_vapour_pressure_over_water_magnus with saturation_water_vapour_pressure_over_water_magnus