Skip to content

About

Aggregate impact region results to GADM administrative units, with published weight files

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

CIL-regionalization

Python GADM 2.0 weights GADM 4.1 weights SMME weights

Climate Impact Lab projections come at the level of impact regions. Most questions are asked about countries, states or districts. cil_regionalization applies weights that turn one into the other. It then takes statistics over the Monte Carlo draws, and records what made each number.

Install

Python 3.10 or newer.

pip install "cil_regionalization[netcdf] @ git+https://github.com/ClimateImpactLab/cil_regionalization.git"

Leave out [netcdf] if you will not read NetCDF trees. [examples] adds what the example notebooks need. [bigquery] adds a backend for making weights, and [dev] adds the tests. In a clone, uv sync --extra examples installs the versions in uv.lock.

A first run

A clone holds a small Monte Carlo tree of mortality damages for Colombia, and weights for its departments. Save this config as colombia.toml at the root of the clone.

[weights]
dir = "examples/aggregation/data/weights/adm1_per_source"
weight = "pop"

[tree]
root = "examples/aggregation/data/montecarlo"
levels = ["batch", "rcp", "gcm", "iam", "ssp"]
filename = "mortality_damages_IR_batch.nc4"

[tree.expect]
batch = ["batch0"]
rcp = ["rcp85"]
gcm = ["CCSM4", "MIROC5", "NorESM1-M"]
iam = ["low"]
ssp = ["SSP3"]

[data]
format = "netcdf"
region_dim = "region"
value_col = "total_damages"
kind = "extensive"                # dollars add up across regions
version = "world-combo-201710"

[stats]
sample_dims = ["gcm"]             # take statistics across the models
time_col = "year"
windows = [[2040, 2059], [2080, 2099]]
quantiles = [0.05, 0.5, 0.95]
quantile_method = "inverted_cdf"
summation = "exact"
time_reduction = "window_mean"

[output]
dir = "colombia_out"

Then run it.

cilreg pipeline colombia.toml

Damages in each department are summed from its impact regions, model by model. Each model's years are averaged in each window. Mean and quantiles across the three models follow. colombia_out/statistics.parquet holds them, and a manifest beside it records what made them. Add --dry-run to see the plan without running it.

From Python, fetch_weights, apply_weights and summarize_samples take the same steps on frames you hold.

Learn more

  • Read the guide to learn what each step does to a quantity, and why the steps run in their order.
  • Every function and config key is in the reference.
  • Examples run on real projections, with their outputs committed. Each covers one piece of the work.
  • Every change is in the changelog.
  • cilreg --help lists the commands. cilreg fetch --list shows the weights files on Zenodo, and cilreg fetch <name> downloads one.

Data on Zenodo

About

Aggregate impact region results to GADM administrative units, with published weight files

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages