climate_toolbox.transformations package

Submodules

climate_toolbox.transformations.transformations module

climate_toolbox.transformations.transformations.ordinal(n)[source]

Converts numbers into ordinal strings

climate_toolbox.transformations.transformations.snyder_edd(tasmin, tasmax, threshold)[source]

Snyder exceedance degree days/cooling degree days

Similarly to Snyder HDDs, Snyder exceedance degree days for any given day are given by the integral between the sinosiod-interpolated temperature and the threshold.

The closed form solution is given by:

\[EDD_{P} = \sum_{d \in P} EDD_d\]

where

\[\begin{split}EED_d = \begin{cases} ( (M - e)(\pi /2 - \theta) + w \cos(\theta) ) / \pi, & \text{if } tmin_d < e < tmax_d \\ 0 , & \text{if } tmax_d < e \\ M - e, & \text{otherwise} \end{cases}\end{split}\]

and

\[\begin{split}\begin{array}{rll} M & = & (tmax_d + tmin_d)/2 \\ w & = & (tmax_d-tmin_d)/2 \\ \theta & = & \arcsin( (e-M)/w ) \\ \end{array}\end{split}\]
Parameters
  • tasmin (xarray.DataArray) – Daily minimum temperature (degrees C)

  • tasmax (xarray.DataArray) – Daily maximum temperature (degrees C)

  • threshold (int, float, xarray.DataArray) – Threshold (degrees C)

Returns

edd – Snyder exceedance degree days (degreedays)

Return type

xarray.DataArray

climate_toolbox.transformations.transformations.snyder_gdd(tasmin, tasmax, threshold_low, threshold_high)[source]

Snyder growing degree days

Growing degree days are the difference between EDD measures at two thresholds.

\[{GDD}_{T_{low}, T_{high}, y, i} = {EDD}_{T_{low}, y, i} - {EDD}_{T_{high}, y, i}\]

Note that where \(tas_{d,i}>{T_{high}}\), GDD will be a constant value \(T_{high}-T_{low}\). Thus, this measure is only useful when another measure, e.g. \({EDD}_{T_{high}}\), sometimes referred to as killing degree days, is used as an additional predictor.

Parameters
  • tasmin (xarray.DataArray) – Daily minimum temperature (degrees C)

  • tasmax (xarray.DataArray) – Daily maximum temperature (degrees C)

  • threshold_low (int, float, xarray.DataArray) – Lower threshold (degrees C)

  • threshold_high (int, float, xarray.DataArray) – Upper threshold (degrees C)

Returns

gdd – Snyder growing degree days (degreedays)

Return type

xarray.DataArray

climate_toolbox.transformations.transformations.tas_poly(ds, power, varname)[source]

Daily average temperature (degrees C), raised to a power

Leap years are removed before counting days (uses a 365 day calendar).

climate_toolbox.transformations.transformations.validate_edd_snyder_agriculture(ds, thresholds)[source]

Module contents