weather.derived.cooling_degree_hours

weather.derived.cooling_degree_hours(temperature, base=DEFAULT_CDH_BASE_C)

Cooling degree-hours :math:\max(T - base, 0).

Parameters

Name Type Description Default
temperature pd.Series Hourly air temperature in °C. required
base float Cooling base temperature in °C. Defaults to 22.0. DEFAULT_CDH_BASE_C

Returns

Name Type Description
pd.Series pd.Series: cdh per timestamp, float64, same index as
pd.Series temperature. Zero whenever it is cooler than base.

Raises

Name Type Description
ValueError If temperature is not a NaN-free numeric Series.

Examples

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

t = pd.Series([5.0, 22.0, 30.0])
print(cooling_degree_hours(t, base=22.0).tolist())
[0.0, 0.0, 8.0]