special
temperature_zone
generate_temperature_zone_main(gcm_member: str, cmip6_experiment: str, output_dir: str | Path) -> None
Generate the temperature zone for a given scenario and gcm member.
Parameters
gcm_member The gcm member to generate the temperature zone for. cmip6_experiment The cmip6 experiment to generate the temperature zone for. output_dir The directory to save the temperature zone to.
Source code in src/climate_data/special/temperature_zone.py
utils
_to_idx(arr, bins)
Convert an array of values to an array of indices into a set of bins.T
Parameters
arr
A N-dimensional array of values to convert.
bins
A 1-dimensional array of bins. Bins must be sorted, increasing,
and not contain duplicates. Every value in arr will be converted
to an index into bins, with values outside of bins being clipped
to the nearest bin edge. Bins are 0-indexed and left-inclusive,
so idx 0 contains values from -infinity to bins[1], idx 1 contains
values from bins[1] to bins[2], etc.
Returns:
| Type | Description |
|---|---|
|
The array of indices into the bins. |
Source code in src/climate_data/special/utils.py
aggregate_to_hierarchy(data: pd.DataFrame, hierarchy: pd.DataFrame) -> pd.DataFrame
Create all aggregate climate values for a given hierarchy from most-detailed data.
Parameters
data The most-detailed climate data to aggregate. hierarchy The hierarchy to aggregate the data to.
Returns
pd.DataFrame The climate data with values for all levels of the hierarchy.