Start here

An open framework for physical climate risk.

This is the technical reference: how to install, what the numbers mean, and how the workflows run. Climate Risk Commons turns hazard curves, asset locations and damage functions into comparable, auditable risk numbers, on a laptop, over open data. For why the project exists, start on the project site. If you would rather not write Python, use the without-code guide.

Build with code

Python users: install the SDK and run a portfolio analysis offline.

Quickstart

Use it without code

A notebook in your browser, or one plain-English sentence to an AI agent.

Without-code guide

Contribute

Data providers, modellers and implementers building against the contracts.

Contributing
uv add crc-sdk                         # or: python -m pip install crc-sdk
git clone https://github.com/RiskThinking/crc-docs   # worked examples

Installing crc-sdk pulls in crc-framework, the Rust computation core.

What you can install today

The standard is no longer only a specification. Four pieces are published, versioned and runnable.

PieceWhat it isWhere
crc-frameworkRust computation core with typed Python bindings. Distributions, explicit curve fitting, impact transforms, microscores, VaR and CVaR, H3 geography lookups.PyPI · GitHub
crc-sdkThe higher-level Python interface: DuckDB and Arrow query engine, storage providers, hazard ingest, geometry and H3 tooling, portfolio workflows.PyPI · GitHub
@climateriskcommons/crc-frameworkThe same computation core compiled to WebAssembly, with TypeScript types. Evaluates canonical hazard curves in a browser or in Node.npm · Guide
crc-docsWorked notebooks, headless pipeline twins, AI agent skills and the Cologne fixtures. The narrative entry point.GitHub

The shape of an analysis

Every analysis in the framework is the same three inputs meeting in one place. Learning where each one lives is most of the learning curve.

InputWhat it looks like in codeWhere it comes from
Climate hazard dataA canonical Parquet file of fitted curves, one row per hazard, horizon, pathway and H3 cellIngested from open rasters, or supplied by any conforming provider
Physical assetsAn Arrow table or Parquet file with an id and either coordinates or an H3 cell_indexYour portfolio, loan book or asset register
Impact functionsA callable or a registry-backed transform mapping exposure to damageThe open starter library, the registry, or one you write

The output is one row per asset, hazard, horizon and pathway, with a value column for each return period you asked for, and metadata recording exactly how each number was produced.

This page is the map, the packages hold the reference

Each section below gives the idea and one working example, then links to the package documentation that owns the details: the crc-sdk docs for data, workflows and runtime, and the crc-framework docs for distributions, fitting, impacts and risk metrics. API details also live in docstrings, for example help(HazardDataset.efas).

Read these two pages before you trust a number

Probability and distributions explains what a return period means here and why the 100-year event is queried at q=0.99. Impact functions explains the difference between evaluating an event and transforming a distribution, the easiest thing in the framework to get subtly wrong.

Names you will meet

Climate Risk Commons
The whole of it: the specification, the reference implementation, the community that maintains them, and RiskThinkingFoundation, the neutral non-profit that stewards them. Shortened to CRC, which is where every package name comes from.
The CRC specification
The standard itself. Input contracts for climate hazard data, physical assets and impact functions, plus the canonical hazard schema, the output model and the conformance rules.
Reference pipeline
An end-to-end implementation of the spec. The runnable scripts live in crc-docs/pipelines/ and are built on crc-sdk.
crc_framework
The import name of the computation core. Distributions and metrics live here.
crc_sdk
The import name of the SDK. Data access, ingest and workflows live here, and it re-exports the stable framework API through crc_sdk.core, .fitting and .impacts.
Climate Digital Twin (VELO/CDT)
RiskThinking.AI's commercial high-fidelity data and enterprise platform. Separate from these packages, and reached through a commercial agreement.
Getting started

Installation

Baseline install is one command. Extras add heavy format adapters that most callers do not need.

Pick an entry point

Run the worked examples

Best if you want to see a complete analysis before writing any code. Clone crc-docs and let uv resolve everything, including the notebook stack.

git clone https://github.com/RiskThinking/crc-docs
cd crc-docs
uv sync --locked

uv run jupyter lab notebooks/                       # notebooks
uv run python pipelines/asset_portfolio_pipeline.py  # pipelines run from the repo root

Add it to your own project

uv add crc-sdk
uv add "crc-sdk[raster,geometry]"    # for example: JRC flood rasters and H3 tooling

python -m pip install crc-framework  # framework only: no data access layer

Extras

DuckDB, Arrow, psutil and the remote-storage transports (fsspec, s3fs, gcsfs) are always installed. Format and geometry libraries are extras, and each extra-gated function raises an ImportError naming the extra it needs, so you can install the baseline and add what it asks for.

ExtraYou need it for
rasterGeoTIFF and COG: JRC flood, CHIRPS, from_raster
zarrZarr: OS-Climate, ERA5, CMIP6, from_zarr
netcdfNetCDF: EDO drought, NEX-GDDP-CMIP6
geometryH3 and shapely helpers: polyfill, raster-to-H3 sampling, station indexing
agriculture, icechunkUSDA CDL through Icechunk and Zarr v3. Python 3.12 or later

PMTiles generation also needs tippecanoe and tile-join on PATH; pip cannot install them. require_tippecanoe() and require_tile_join() in crc_sdk.geometry.pmtiles check for them before a long job.

Platforms and Python versions

We recommend Python 3.12 or later for new environments; the packages support 3.11 and later. Prebuilt wheels need no Rust toolchain. Wheel availability depends on your Python version, operating system and architecture: check crc-sdk and crc-framework on PyPI.

Lock your versions

This is a preview. Specs, APIs and data schemas may change, sometimes with little notice, and package releases can change independently.

Resolve compatible releases together and commit uv.lock alongside pyproject.toml. Use the lockfile to reproduce the environment:

uv add crc-sdk crc-framework
uv lock
uv sync --locked

Verify the install

from crc_sdk.workflows import HazardDataset
from crc_sdk.core import TabulatedDistribution   # re-exported from crc_framework

curve = TabulatedDistribution.from_return_periods(
    [10, 50, 100], [0.4, 1.1, 1.6], tail="upper",
)
print(curve.ppf(0.99))   # the 100-year value

Full reference: SDK runtime and dependencies · framework installation

Getting started

Quickstart

Flood depths for a small portfolio, offline, in about ten minutes. No cloud credentials, no account, no hazard data to download.

Why this path first

The asset-portfolio track reads checked-in Parquet fixtures for Cologne under fixtures/os_climate/. It is fully offline and it is ordered, so each notebook builds on the one before.

1. Get the repository and the environment

git clone https://github.com/RiskThinking/crc-docs
cd crc-docs
uv sync --locked

The lockfile gives you the exact dependency set the notebooks were executed against.

2. Run a whole analysis before reading any of it

uv run python pipelines/asset_portfolio_pipeline.py

Outputs land in pipeline_output/. Notebooks 2 to 5 in the ordered track each have a headless twin like this one, which makes the examples usable as regression checks and as a starting point for your own scripts.

3. Open the notebook that matches it

uv run jupyter lab notebooks/

Start with asset_portfolio_evaluation.ipynb.

4. Point the same workflow at your own assets

An Arrow table in, a Parquet file out, one value column per return period.

import pyarrow as pa
from crc_sdk.workflows import HazardDataset

assets = pa.table({
    "asset_id":  ["warehouse-a", "warehouse-b"],
    "longitude": [6.9603, 7.5010],
    "latitude":  [50.9375, 51.0030],
    "sector":    ["logistics", "manufacturing"],
})

result = (
    HazardDataset.local("flood.parquet")
    .for_assets(assets)
    .select(horizons=[2050], pathways=["ssp585"])
    .return_periods([25, 50, 100, 250, 500, 1000])
    .write_parquet("portfolio-flood.parquet")
)

You get value_rp25 through value_rp1000. The column names asset_id, longitude, latitude and cell_index are inferred, so a conventional schema needs no configuration.

5. Turn depth into damage

from crc_sdk.impacts import PiecewiseLinearImpact

damage_curve = PiecewiseLinearImpact(
    exposure=[0.0, 0.2, 1.0, 2.0],
    impact=[0.0, 0.0, 0.25, 1.0],
)

impacted = (
    HazardDataset.local("flood.parquet")
    .for_assets(assets)
    .return_periods([25, 100, 250])
    .impact(
        damage_curve,
        name="flood_damage_ratio",
        value_unit="fraction",
        value_semantics="damage ratio",
    )
    .write_parquet("portfolio-impact.parquet")
)

Now value_rp100 is the damage ratio at the 100-year flood, not the depth. The return period still identifies the source hazard event.

6. Or start from open data

No local file? HazardDataset.crc_open() reads the public CRC Open release: 63 pre-fitted hazards under SSP5-8.5, with no credentials and no refitting. See the CRC Open guide.

Getting started

Learning path

Worked notebooks share the same packages, and most have a headless pipeline twin that does the same work without Jupyter. Most also open in Colab with no install; the crc-docs problem table marks the few that run from a local checkout.

Asset portfolios

Ordered, offline, and the right place to start. It reads the checked-in Cologne fixtures, so it runs without credentials.

#NotebookPipeline twinWhat it shows
1hurdle_fit_primernoneReconstruct a canonical hurdle curve and read its sample diagnostics
2asset_portfolio_evaluationasset_portfolio_pipeline.pyFluent HazardDataset portfolio evaluation at return periods
3portfolio_impactportfolio_impact_pipeline.pyEvent-aligned PiecewiseLinearImpact through to currency damage
4portfolio_risk_metricsportfolio_risk_pipeline.pyMicroscores through to portfolio VaR and CVaR, with attribution
5multi_scenario_portfoliomulti_scenario_pipeline.pyHistorical against transparent local tail stresses in one evaluation

The multi-scenario cases are stresses, not projections. Notebook 5 runs deliberately transparent sensitivity stresses on local tails. Do not present them as scenario forecasts.

Data sources and thematic workflows

Unordered, and most fetch public inputs over the network: CRC Open rainfall screening, JRC flood and drought, ERA5 and CMIP6 baselines and projections, NOAA, ECCC, USGS, HYDAT, CHIRPS and IBTrACS observations, regional flood exposure with PMTiles, and agricultural exposure. The crc-docs problem table lists every notebook with its pipeline twin and the question it answers.

Running them

Notebooks run with notebooks/ as the working directory, so their data/ cache lands beside them; pipelines run from the repo root and write to pipeline_output/. Both directories are gitignored.

Full reference: crc-docs setup and running examples

Core concepts

Probability and distributions

Everything the framework computes passes through a distribution interface. Two conventions do most of the work, and getting them straight prevents an entire class of quiet error.

Non-exceedance probability is the currency

Every metric API takes a non-exceedance probability q in [0, 1]. For an upper-tail hazard such as flood depth, a return period T converts as q = 1 − 1/T: the 100-year value is queried at q=0.99 and lands in value_rp100. Lower-tail hazards such as drought use q = 1/T; canonical metadata records which tail applies, so evaluation picks it automatically.

Metadata also records what the probability axis means. Return-period evaluation of a dataset whose probabilities are within-period percentiles, projection uncertainty or estimate confidence warns with ProbabilitySemanticsWarning, or raises with strict=True, because those are not annual exceedance probabilities.

One interface, five shapes

All distributions expose pdf, cdf, ppf, quantiles and sample, on scalars or NumPy arrays: EmpiricalDistribution for raw observations, TabulatedDistribution for probability and value knots, FittedDistribution for a parametric family, HurdleDistribution for a point mass plus a parametric tail (the usual zero-heavy flood shape), and PointMassDistribution for a constant.

Tabulated curves refuse to guess

from crc_framework import TabulatedDistribution

curve = TabulatedDistribution.from_return_periods(
    [5, 10, 25, 50, 100],
    [0.2, 0.6, 1.1, 1.5, 1.9],
    tail="upper",
)

curve.ppf(0.99)    # fine: the 100-year knot is the edge of support
curve.ppf(0.999)   # raises: beyond the declared range, unless extrapolate=True

A silent extrapolation from a 100-year source map to a 1000-year answer is exactly the kind of number nobody can defend later.

Interpolation, extrapolation, and what your source supports

Portfolio evaluation warns with ReturnPeriodExtrapolationWarning when a requested return period falls outside the source support recorded in the dataset metadata. With EFAS source rasters covering RP10 to RP500, asking for RP250 is interpolation, and asking for RP1000 is extrapolation. Both return numbers. Only one of them is defensible without a footnote.

Full reference: SDK probabilities and return periods · framework distributions

Core concepts

Fitting curves

Fitting is always explicit. Metrics sample the distribution you hand them and never quietly substitute a fitted curve, which is what makes the modelling choice auditable.

Choose the entry point by the data you hold

FunctionInputUse it when
fit_distributionRaw observationsYou hold samples. Family chosen by KS p-value, or named; method="lmoments" is also available
fit_quantilesProbability and value knotsYou are canonicalising a published return-period map
fit_censored_quantilesKnots with zeros at the low endA sparse flood curve whose zeros mean “at or below the physical bound”. The recommended path for zero-heavy hazards
fit_hurdle_quantilesKnots plus a known point massThe source itself defines the point-mass probability
Knots are not observations

Passing a tabulated or fitted distribution to fit_distribution is an error. Return-period knots are not independent samples, so a KS statistic computed against them would be meaningless. And the framework never infers a point mass from sparse zero-valued knots: censor them, or state the atom probability yourself.

from crc_framework import fit_censored_quantiles

fit = fit_censored_quantiles(
    [0.5, 0.8, 0.9, 0.96, 0.98, 0.99, 0.996, 0.998, 0.999],
    [0, 0, 0, 0, 0, 0, 0.03, 0.06, 0.10],
    family="genextreme",
    censor_location=0.0,
)

In SDK ingest the same choice is a policy: CDFCurveFitPolicy(..., fit_method="censored_quantile", censor_location=0.0). Supported families are genextreme, weibull_min, weibull_max, skewnorm, gumbel_r, gumbel_l and genpareto.

TabulatedDistribution is the lossless interpolation of the knots you supplied; parametric and hurdle fits are lossy. Canonical files can store a tabulated curve directly when you need the lossless form.

Full reference: SDK fitting · framework fitting

Core concepts

Impact functions

An impact function maps exposure to damage. It has two deliberately distinct operations, and choosing the wrong one is the most common subtle error in the whole framework.

Two operations, two meanings

CallWhat it doesUse it when
impact.evaluate(values)Evaluates event-aligned exposure values, preserving input orderReturn periods continue to identify the source hazard event
impact(distribution)Transforms an exposure distribution into an impact distribution, reordering quantiles for decreasing functionsYou are doing risk analysis on the impact distribution itself

The portfolio workflow uses the first: value_rp100 = impact(hazard_rp100), so the return period still names the hazard event. Built-in transforms are LinearImpact, SigmoidImpact and PiecewiseLinearImpact; impacts.for_factor(...) selects a registry-backed climate transform, and ImpactContextColumns feeds it per-asset context such as country and building type. The SDK records units, semantics, the function and its context mapping in the output metadata.

Lambdas cannot be parallelised

Framework impact objects and module-level functions run in the process pool. Lambdas and closures are not picklable, so they run with one worker, and asking for more raises rather than silently degrading.

import numpy as np
from crc_sdk.workflows import ExecutionOptions

(
    HazardDataset.local("flood.parquet")
    .for_assets(assets)
    .return_periods([25, 100])
    .impact(
        lambda depth: np.clip(depth / 2.0, 0.0, 1.0),
        name="ratio", value_unit="fraction", value_semantics="damage ratio",
    )
    .write_parquet("out.parquet", execution=ExecutionOptions(max_workers=1))
)

Promote the lambda to a module-level function to use more workers.

Full reference: SDK impacts in portfolios · framework impacts and registry

Core concepts

Impact definitions

An impact definition is a portable description of one damage function: the equation, the units, an optional final clamp, and where the coefficients came from. It holds no exposure data, and its identity is the SHA-256 of its canonical JSON, so two teams can prove they used the same function.

Definitions follow crc-impact-contracts 1.0.0, published in crc-framework-rs. The SDK loads, hashes and evaluates them through crc_sdk.impacts.ImpactExpression, and the portfolio .impact(...) step accepts them directly.

What a definition holds

A calibration (exposure variable and unit, impact metric and unit), a model of one of seven kinds (linear, sigmoid, tabulated, binned, spei, cooling, crop), an optional clamp, and provenance. Semantics version crc-impact/1 fixes the equations; a missing or newer value is rejected. Canonical JSON writes each number in round-trip form, so 2, 2.0 and 20e-1 are the same slope. The contracts cover the definition, the registry reference, the evaluation record, the spatial evaluation record and the spatial combination policy, each with accepted and rejected examples and numerical reference cases.

Example

Flood depth in metres, damage as a fraction of value, clamped into [0, 1]. At 0.15 m the response is 0.04. At 1.50 m it is 0.725. A depth outside the knots uses the nearest end.

{
  "schema_version": "1.0",
  "semantics_version": "crc-impact/1",
  "calibration": {
    "exposure_variable": "flood_depth",
    "exposure_unit": "m",
    "impact_metric": "damage_ratio",
    "impact_unit": "1"
  },
  "model": {
    "kind": "tabulated",
    "points": [
      {"x": 0.0, "y": 0.0},
      {"x": 0.3, "y": 0.08},
      {"x": 1.0, "y": 0.45},
      {"x": 2.0, "y": 1.0}
    ]
  },
  "clamp": {"minimum": 0.0, "maximum": 1.0},
  "provenance": {"origin": {"kind": "user_defined"}}
}
from crc_sdk.impacts import ImpactExpression
from crc_sdk.workflows import HazardDataset

impact = ImpactExpression.from_json(document)   # the JSON above, as a string
impact.evaluate([0.15, 1.50])                    # 0.04, 0.725
impact.definition_hash                           # "sha256:..."

(
    HazardDataset.local("flood.parquet")
    .for_assets(assets)
    .return_periods([25, 100])
    .impact(impact, name="damage_ratio", value_unit="fraction",
            value_semantics="damage ratio")
    .write_parquet("out.parquet")   # metadata records impact.definition_hash
)

Full reference: framework impact contracts · SDK reproducible impact definitions

Core concepts

Microscores, VaR and CVaR

The path from a hazard distribution to a portfolio risk number runs through binary outcomes. It is a small API with one sharp edge: branch count grows as two to the power of the number of factors.

From outcomes to VaR and CVaR

generate_microscores samples exposure and impact at the probabilities you name and reduces them to binary outcomes. Each becomes a BinaryOutcome; combining them produces every independent downside and upside branch, and risk is computed at one or more confidence levels.

from crc_framework import BinaryOutcome, compute_risk, compute_spanning_set

outcomes = [
    BinaryOutcome("flood", downside_probability=0.05, downside_impact=0.4),
    BinaryOutcome("fire",  downside_probability=0.10, downside_impact=0.2),
]

branches = compute_spanning_set(outcomes)
risk = compute_risk(outcomes, levels=[0.80, 0.95])
level_95 = risk.at(0.95)

print(len(branches))                  # 4: two outcomes per factor
print(level_95.var, level_95.cvar)

RiskLevel.attribution reports each factor's contribution to VaR and CVaR, which is usually the number a committee actually wants to see.

Cap the branches before they cap you

Branch generation grows as 2**n for n factors: ten factors is a thousand branches, twenty is a million. Set max_branches on compute_spanning_set or compute_risk to impose a limit your application can defend; the core refuses more than 2**26 branches regardless, raising instead of exhausting memory.

Spatial lookups

lookup_continent, lookup_ipcc_region and lookup_geography take an H3 cell as an integer or a string and return None when no reference mapping exists. The first two normalise the cell to H3 resolution 4; lookup_geography uses resolution 5 and returns the continent and intersecting ISO3 country codes. That None is meaningful: handle it rather than asserting.

Full reference: framework microscores · risk aggregation · spatial helpers

Data

Canonical hazard datasets

One versioned Arrow and Parquet contract holds every fitted hazard. Understanding this file is understanding the standard: it is the thing two teams can compare.

external raster/table→source curves and geometry→selected family fit→conservative intersecting H3 cells→canonical Arrow→Parquet

Rows

The logical row key is (hazard_name, horizon, pathway, cell_index, source_id), and files are sorted by it by default. cell_index is a spatial join key, not a unique identifier: several source curves can land in one cell, and when that happens for one asset, evaluation raises rather than silently picking one. curve_kind says which shape a row holds: fitted, hurdle, point_mass, tabulated (probability and value lists), or no_data with an explicit reason code. A no_data row is missing evidence, not zero risk.

Metadata carries the meaning

Dataset-wide facts are stored once as JSON under the Parquet key crc.hazard.metadata. Read it before you trust a file someone hands you.

RecordedWhy you need it
Schema version (1.3 current)Which curve kinds and metadata fields can appear. All 1.x files share the same columns and row key
H3 resolutionOne resolution per dataset. Asset points are converted to it
Probability convention and semanticsWhich tail is damaging, and whether the axis is an annual exceedance probability at all
Source probability supportWhere interpolation ends and extrapolation begins
Value unit and semanticsMetres of depth, an index value, a ratio
Temporal window and ensembleThe period a value describes, and how models were pooled
ProvenanceProducer and creation version, source licence and attribution, retrieval time, checksums, and the fit policy

Evaluation writes its own record under crc.hazard.evaluation: value unit, value semantics, and the mapping from return period to probability to column name.

Cells are a conservative superset

Candidate cells come from H3 overlap coverage, not centre polyfill, so the integer join returns a conservative superset. Where source geometry is stored, the match is refined with ST_Covers(source_geometry, asset_point); otherwise it keeps cell precision. The output's spatial_match column says which happened.

Writing a canonical stream

write_hazard_stream has two modes with identical schema, metadata and downstream behaviour. ordered=True, the default, rejects duplicate keys and sorts globally in DuckDB, spilling to the work directory at its memory limit; files are smaller and scans can prune better. ordered=False appends validated batches in input order and checks uniqueness on the key columns only: it uses less memory and writes larger files, roughly 25 to 40% in tests. Either way, leave process headroom beyond the engine limit for Arrow, Python and the Parquet writer.

Full reference: SDK canonical hazard datasets · spatial support

Data

Ingesting public hazards

Acquisition is an immutable, lazy workflow. Builder calls do no network work, so you can print a plan and read it before anything is fetched or fitted.

Plan first, then materialise

from crc_sdk.workflows import HazardDataset, JRCFloodPolicy

plan = (
    HazardDataset.efas(version="latest")
    .for_area((7.75, 49.75, 8.45, 50.25))
    .cache("cache/efas", mode="reuse")
    .source_periods("all")
    .canonicalize(policy=JRCFloodPolicy.curated(h3_resolution=10))
)

print(plan.explain())          # no network access yet
hazard = plan.materialize("hazards/efas-rhine.parquet")

materialize() resolves latest once, pins the version in the cache manifest and in canonical provenance, caches the area crops, fits the curves and returns an ordinary HazardDataset. Cache modes are reuse, offline, refresh and stream: run prefetch(), then switch the same plan to mode="offline", and the run is reproducible without network access. Calling plan.for_assets(...) materialises into the cache and evaluates in one chain.

Source periods are not evaluation periods

Source periods choose which rasters are used for fitting. Evaluation periods are what you ask the fitted curve for afterwards; requests beyond the source support warn, see interpolation and extrapolation.

Other sources and your own data

The same plan shape covers CRC Open, JRC EDO drought, ERA5, CMIP6 and NEX-GDDP-CMIP6, station records and agricultural layers. For your own data, HazardDataset.from_table, from_zarr and from_raster canonicalise tables of quantiles, Zarr arrays and per-return-period GeoTIFFs through the same lazy plan. OS-Climate return-period rasters go through canonicalize_os_climate and OSClimateIngestPolicy, imported from crc_sdk.connectors, with the zarr extra.

Authenticated buckets use DuckDB's own secret DDL, passed as setup_sql to DuckDBConnection.for_analytics; the SDK deliberately adds no secret-builder type.

Full reference: SDK lazy plans and cache modes · JRC flood and drought · bring your own data · private buckets

Data

Connectors and sources

Connectors are source-format readers and query engines. Ingest adapters do the conversion into the canonical contract; connectors themselves stay simple on purpose.

Where things live

Most day-to-day calls are in crc_sdk.workflows. Canonical reads and writes are in crc_sdk.connectors, and format readers (GeoTiffRaster, ZarrRaster, NetCDFRaster) and DuckDB helpers in crc_sdk.connectors.duckdb; H3, coverage and PMTiles are in crc_sdk.geometry; crc_sdk.core, .fitting and .impacts re-export the stable framework API. Use crc_framework's public API rather than crc_framework._core, which may change between releases.

Public data sources

SourceProvides
CRC Open63 pre-fitted hazards under SSP5-8.5, global, CC BY-NC 4.0
JRC EFAS, GloFAS, EDORiver flood depth, and Soil Moisture Index drought
ERA5Reanalysis annual extremes, for historical baselines
CMIP6, NEX-GDDP-CMIP6Native and downscaled climate projections
NOAA ISD and GHCNh, ECCC IDFStation temperature extremes and design rainfall
USGS, CHIRPS, IBTrACS, ECCC daily, HYDAT, NOAA water levels and sea levelObservations for inspection and audit
USDA CDL, Fields of The WorldCrop land cover and predicted field units
OS-Climate, geoBoundaries, OvertureReturn-period rasters, administrative boundaries, and places used by the spatial examples

Agricultural layers

AgriculturalLayer.usda_cdl() and .ftw_fields() are bounded before they can scan, and stream Arrow batches into the same DuckDB pipeline.

Do not overclaim these layers. FTW fields are remote-sensing units, not cadastral parcels or evidence of ownership. CDL crop pixels are land-cover observations, not acreage, yield or financial exposure.

Full reference: SDK data sources · agricultural layers · data licences · package layout

Workflows

Asset portfolios

Evaluate canonical curves for a whole portfolio without returning to the source format and without refitting. One row per asset, hazard, horizon and pathway; one value column per return period. The minimal example is in the quickstart.

Handing over assets

Pass an Arrow table, a Path to a Parquet file, or a string of DuckDB SQL. The columns asset_id, longitude, latitude and cell_index are inferred. Assets that already carry H3 cells in a cell_index column skip point conversion and exact geometry refinement; for other column names, wrap the data, for example AssetPortfolio(data, location=CellColumn("h3")) or AssetPortfolio(data, id_column="site", location=PointColumns("lon", "lat")).

Ambiguity raises, it does not resolve itself

Several source curves for one asset, hazard, horizon and pathway raise an error rather than being silently selected or aggregated. Missing asset or scenario matches raise rather than being dropped. A short portfolio is a bug, so the framework refuses to produce one quietly.

Impacts and execution

Sampling happens first, then the impact function runs on each row's values; see Impact functions. value_unit and value_semantics are required: they are written into the evaluation metadata, and they are the difference between a column of numbers and a column somebody else can interpret. Worker, batch and connection controls live in ExecutionOptions on write_parquet, and output streams in bounded Arrow batches, so a large portfolio does not have to fit in memory.

Full reference: SDK portfolio evaluation

Workflows

Spatial

The other track. Instead of asking what a portfolio is exposed to, it asks what a place is exposed to, and renders the answer as tiles you can put on a map.

raster→H3 sampling→admin join→place enrichment→PMTiles

The flood_risk_by_province and jrc_global_flood_hazard notebooks walk this flow over the network. H3Indexer does DuckDB-native polyfill; polyfill_wkb does vectorised batch polyfill over Arrow and needs the geometry extra (h3, shapely). Coverage and lookup writers, raster-to-H3 sampling and PMTilesBuild live in crc_sdk.geometry.

Because candidate cells come from overlap coverage (see Canonical hazard datasets), a spatial result can show more cells than you expected before refinement drops the extras.

Full reference: SDK geometry helpers · PMTiles

Running it well

Resources and tuning

The SDK sizes DuckDB from the machine, and the defaults are deliberately conservative about threads.

How the thread count is derived

threads = min(cpus, usable_RAM / GiB_per_thread)

usable_RAM     ~= 60% of detected memory
GiB_per_thread  = 2.5 by default

Spatial work through GEOS often gets slower when over-threaded, which is why the ceiling is memory-derived rather than the core count. memory_limit and max_temp_directory_size remain hard caps on DuckDB, not on Arrow buffers, Python objects or the Parquet writer.

The overrides you are most likely to need

VariableOverrides
CRC_DUCKDB_THREADSThe derived thread count
CRC_DUCKDB_MEMORYThe DuckDB memory limit
CRC_DUCKDB_WORK_DIRThe spill directory. The system temp default is often wrong in a container

PMTiles builds use every core by default and check scratch disk before they start, raising a clear error rather than degrading. The remaining DuckDB and tippecanoe variables are in the runtime reference.

Before a long run

  • Call explain() on the plan and read it. Builder calls do no I/O, so this costs nothing.
  • prefetch() the source cache, then switch to mode="offline" so a network wobble cannot kill hour three.
  • Point work_dir at a disk with room to spill, not at a small container overlay.
  • Check that requested return periods sit inside the source support, or accept the extrapolation warning knowingly.
  • Use a module-level impact function, not a lambda, before asking for workers.

Full reference: SDK DuckDB resources

Running it well

Troubleshooting

Common setup and analysis issues, each with a pointer to the page that explains it.

Setting up

ImportError naming an extra
Not a broken install. Extras are imported lazily and the error names exactly what to add. See Installation.
tippecanoe is not pip-installable
PMTiles needs tippecanoe and tile-join on PATH. Check with require_tippecanoe() before a long job, not after.
Notebook working directory
Launch as uv run jupyter lab notebooks/. Pipelines run from the repo root. Getting this backwards scatters cache directories.
Python version or missing wheel
Use Python 3.12 or later and check platform guidance.

Getting numbers

A return period is not a probability
Metrics take non-exceedance q. Upper tail: q = 1 − 1/T. See Probability and distributions.
Tabulated curves raise outside their range
By design. Pass extrapolate=True only when you mean it.
Requested period outside source support
You get a warning, not an error, and you get a number. Read the warning. A ProbabilitySemanticsWarning means the probabilities are not annual exceedance at all.
Knots are not observations
Passing a tabulated or fitted distribution to fit_distribution is an error. Use fit_quantiles.
No point mass is inferred for you
Zero-heavy flood curves are best fitted as censored quantiles. Use an explicit HurdleFitPolicy or atom_probability only when the source defines the point-mass probability. See Fitting curves.
Fitted values are not source pixels
If you need bit-for-bit reproduction, persist the knots yourself or use a tabulated curve.
Gumbel has no shape
curve_shape is legitimately null for Gumbel families. It is not a missing value to impute.

Impacts and portfolios

Two operations, one object
impact.evaluate(values) is event-aligned; impact(distribution) transforms a distribution. See Impact functions.
Lambdas are not picklable
They run serially, and asking for more than one worker raises. Promote them to module-level functions.
Ambiguous or missing matches raise
Multiple curves for one asset, hazard, horizon and pathway is an error, not something to average.
Units are yours to declare
value_unit and value_semantics land in metadata and are how the next person reads your column.

At scale

Branches are exponential
compute_spanning_set grows as 2**n. Set max_branches; the core refuses more than 2**26.
Ordered writes cost memory
A global sort needs more memory than streaming. Use ordered=False when containers are tight; see write modes.
Engine limits are not process limits
memory_limit caps DuckDB, not Arrow buffers, Python objects or the Parquet writer. Leave headroom.
Thread count below your core count
That is the memory-derived ceiling. Override with CRC_DUCKDB_THREADS if you know better.
Spill directory in a container
The system temp default is often wrong in a container. Set CRC_DUCKDB_WORK_DIR.

Claims about the outputs

Multi-scenario notebooks are stresses
Sensitivity stresses on local tails, not calibrated projections.
FTW fields and CDL pixels are not exposure
Remote-sensing units and land-cover observations, not parcels, ownership, acreage or yield.
Open data changes precision, not credibility
The engine and schema match the commercial stack; precision depends on input resolution, so report it.
Community

Contributing and getting help

The Commons is built in the open. Ask questions, report what breaks, and build components against the open contracts. For hosted access and institutional participation, see the project site.

Ways to contribute

Fixes, tooling, docs and open impact functions go through the published contribution process. The most useful early contribution is unglamorous: run the reference pipeline on the sample data and report what you found. Spec gaps you hit feed into the roadmap directly.

If you are aThe surface to build on
Data providerPublish hazard, asset or exposure data against the CRC input contracts
ModellerContribute sector, peril or region-specific damage functions to the open library, or offer them commercially against the spec
Tool builderConsume outputs through the APIs; build integrations into risk platforms, GIS, portfolio and disclosure workflows
ImplementerAlternative pipelines, validation and conformance tooling, benchmarking suites
ResearcherTest, extend and improve the methods encoded in the spec, published so others can reproduce it

If your component works with the reference pipeline on reference data, it works with the ecosystem. Conformance is what makes it plug-compatible, and it is the claim you can put in front of your own users.

Where to raise things

Discord
Questions, ideas and what you are building: join the Commons on Discord.
GitHub issues
Bugs and spec gaps in crc-sdk, crc-framework or crc-docs.
opensource@riskthinking.ai
Contributions, conformance questions, the early access preview, and building on the standard.
academic@riskthinking.ai
Research access, institutional enrolment, and any conversation about high-fidelity data.
Licence

Licence and terms

The packages are on PyPI under AGPL-3.0-or-later. Software, datasets and hosted services have separate terms. For hosted access and participation in the Commons, see the project site.

The code licence

crc-sdk and crc-framework are licensed under the GNU Affero General Public License, version 3 or any later version (AGPL-3.0-or-later). Commercial and non-commercial use are permitted subject to its terms. The repositories contain the authoritative licence notices for crc-sdk and crc-framework. Install them from PyPI today; no application, no account. Parts of the numerical distribution implementation derive from or are informed by SciPy and Cephes, whose notices are preserved in the package's third-party notices.

AGPL is a copyleft licence. When conveying covered software, comply with the applicable licence and Corresponding Source requirements. If you modify the program and users interact with that version remotely over a network, section 13 requires an offer of its Corresponding Source to those users. Read the full licence for its conditions.

Data and hosted access

The software licence does not license the datasets you load. CRC Open data is licensed CC BY-NC 4.0: give appropriate attribution, link to the licence, indicate changes and use it only for non-commercial purposes under those terms. See the CRC Open guide and the SDK's data licence summary. Third-party datasets retain their own licences and attribution requirements; check each source before use.

Commons membership is not required to install or use the published software. Hosted access, enterprise data and services are governed by their own agreements; see software, data and service terms.