weather.derived.dew_point

weather.derived.dew_point(temperature, relative_humidity)

Dew-point temperature via the Magnus-Tetens approximation.

Uses :math:\gamma = \ln(rh/100) + aT/(b+T) and :math:T_d = b\gamma/(a-\gamma) with a = 17.625, b = 243.04 °C, valid for -40 °C ≤ T ≤ 60 °C. The humidity ratio is floored at a tiny epsilon purely to keep the logarithm finite at rh = 0 (a numerical domain guard, not measurement imputation).

Parameters

Name Type Description Default
temperature pd.Series Hourly air temperature in °C. required
relative_humidity pd.Series Relative humidity in percent, 0 ≤ rh ≤ 100. required

Returns

Name Type Description
pd.Series pd.Series: dew_point in °C, float64, same index as the inputs.

Raises

Name Type Description
ValueError If either input is not a NaN-free numeric Series, their indices differ, or any humidity value lies outside [0, 100].

Examples

import pandas as pd
from spotforecast2_safe.weather.derived import dew_point

t = pd.Series([20.0, 20.0])
rh = pd.Series([100.0, 50.0])
print([round(v, 2) for v in dew_point(t, rh).tolist()])
[20.0, 9.26]