special
download_era5_uncertainty
ERA5 Uncertainty Download (CLIMATE-22 gap-fill)
Downloads whole-year ERA5 reanalysis and ensemble_spread 2m temperature
files from the Copernicus CDS, matching the layout Katrin Burkart produced by
hand in /ihme/erf/ERA5/katrin_download_20240208/ for 2022/2023:
era5_{product_type}_{variable}_{year}.nc (one file per whole year)
This fills the 2024/2025 gap that GBD temperature PAF work depends on. It is a
standalone gap-fill: the ensemble_spread product is not (yet) consumed by
the rest of this repo's pipeline, which only uses reanalysis mean temperature.
Notes / gotchas baked in below:
* The ensemble products only exist on reanalysis-era5-single-levels (0.25°
HRES / ~0.5° EDA), never on reanalysis-era5-land.
* Both products are pulled 3-hourly to match the canonical GBD download and
Katrin's 2022/2023 files. ensemble_spread (the EDA) is only 3-hourly;
reanalysis (HRES) is subsampled from hourly to the same 3-hourly axis.
* Credentials come from the caller's ~/.cdsapirc (cdsapi.Client() with
no args), so no dependency on the shared per-user copernicus.yaml keyring
(which does not carry every user).
download_era5_uncertainty(era5_variable: str, output_dir: str, queue: str, dry_run: bool) -> None
Download 2024/2025 ERA5 reanalysis + ensemble_spread (CLIMATE-22 gap-fill).
Source code in src/climate_data/special/download_era5_uncertainty.py
download_era5_uncertainty_task(year: str, product_type: str, era5_variable: str, output_dir: str) -> None
Download one whole-year ERA5 file (single year, single product type).
Source code in src/climate_data/special/download_era5_uncertainty.py
temperature_person_days
temperature_person_days_main(block_key: str, gcm_member: str, scenario: str, hierarchy: str, population_model_root: str, climate_data_root: str, output_dir: str, *, progress_bar: bool = False) -> None
Bin population into (temperature x temperature-zone) person-days per year.
The year span is derived from the temperature_zone actually on disk (not a
hardcoded range): for the historical scenario this is the ERA5-only product
spanning EXPOSURE_START_YEAR through the last year present (1990-2025 as
delivered); for a forecast scenario, daily temperature is ERA5 before
FORECAST_START_YEAR and the GCM scenario from then on, binned against that
scenario's own zone. A year whose daily or population input is missing fails loudly
rather than being skipped, so a gap in a product that must be square cannot slip
through silently.
Source code in src/climate_data/special/temperature_person_days.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | |
temperature_zone
generate_temperature_zone_main(gcm_member: str, scenario: 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.
scenario
The scenario to generate the temperature zone for. Pass historical
(with gcm_member="era5") to build a pure-ERA5 zone from the raw
historical annual mean temperature rather than the compiled
historical+forecast series; the output then spans EXPOSURE_START_YEAR
through the last historical year present on disk.
output_dir
The directory to save the temperature zone to (root for this run mode).
Source code in src/climate_data/special/temperature_zone.py
utils
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.