Skip to main content

Classical climate classification (Koppen-Geiger, Holdridge, Thornthwaite) from monthly climatologies - pure Python, no Earth Engine required.

Project description

climaclass

Classical climate classification from monthly climatologies — pure Python, no Earth Engine required.

climaclass turns a 12-month climatology of temperature and precipitation into a climate class under three classical schemes:

Scheme Reference Output
Köppen–Geiger Peel et al. (2007); legend of Beck et al. (2018) code (Csb) + zone 1–30
Holdridge life zones Holdridge (1967) life-zone name + belt/province
Thornthwaite Thornthwaite (1948) moisture + thermal province

It grew out of the Climate_Classifications Earth-Engine notebooks, but reimplements the algorithms as dependency-free Python so they run anywhere — a laptop, a CI job, or inside a hydrological model pipeline — without a Google Earth Engine account.

Install

pip install climaclass                 # core: zero dependencies
pip install "climaclass[symfluence]"   # + SYMFLUENCE attribute-processor plugin

Use

from climaclass import MonthlyClimate, classify

reykjavik = MonthlyClimate(
    temp=[0.1, 0.4, 0.9, 3.3, 6.8, 9.4, 10.9, 10.5, 7.7, 4.5, 1.7, 0.4],   # °C, Jan..Dec
    precip=[76, 72, 82, 58, 44, 50, 52, 62, 67, 86, 73, 79],               # mm,  Jan..Dec
    latitude=64.1,
)

results = classify(reykjavik)
print(results["koppen"].code)        # 'Cfc'  (subpolar oceanic)
print(results["holdridge"].name)     # e.g. 'Boreal moist forest'
print(results["thornthwaite"].code)  # moisture/thermal province code
print(results["koppen"].details)     # MAT, MAP, Pthreshold, ... for QA

Run a single scheme directly:

from climaclass import koppen
koppen.classify(reykjavik).zone      # 16  (Beck et al. legend)

Input

Everything keys off one small record, MonthlyClimate:

  • temp — 12 monthly mean temperatures (°C), January → December (required)
  • precip — 12 monthly total precipitation (mm), January → December (required)
  • latitude — optional; refines Thornthwaite PET day-length and fixes hemisphere
  • tmin / tmax — optional, reserved for future scheme variants

SYMFLUENCE plugin

The optional symfluence extra ships an attribute processor that emits climate classes as catchment attributes (climate.koppen_code, climate.holdridge_zone, climate.thornthwaite_code, …), computed from the WorldClim monthly rasters SYMFLUENCE already acquires — so there is no new data dependency and no Earth Engine in the loop. It is registered via the symfluence.attribute_processors entry point and can be used as a regionalization / PUB grouping variable.

The integration is fully decoupled: importing climaclass never imports SYMFLUENCE, and the pure mapping helper record_to_attributes(temp, precip) is testable on its own.

Develop

pip install -e ".[dev]"
pytest -q
ruff check src/

License

Apache License 2.0 — see LICENSE and NOTICE. The classification algorithms were prototyped in the author's Climate_Classifications Earth-Engine notebooks and relicensed by the copyright holder.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

climaclass-0.2.0.tar.gz (21.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

climaclass-0.2.0-py3-none-any.whl (21.8 kB view details)

Uploaded Python 3

File details

Details for the file climaclass-0.2.0.tar.gz.

File metadata

  • Download URL: climaclass-0.2.0.tar.gz
  • Upload date:
  • Size: 21.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for climaclass-0.2.0.tar.gz
Algorithm Hash digest
SHA256 e94c26abb31622b774667b855e885ac9d74532d212cd43516ad4bbbd2a9f38e5
MD5 6db603cd211d9a63de944ab483e8857a
BLAKE2b-256 4b7158048607fe7c481b364d746f583e10df57193c0547ed8e182c12a4422d21

See more details on using hashes here.

Provenance

The following attestation bundles were made for climaclass-0.2.0.tar.gz:

Publisher: publish.yml on DarriEy/climaclass

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file climaclass-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: climaclass-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 21.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for climaclass-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e2632b83c11a2d826dc5482dfd0b7e0b668fe6e2a81ef54225e9fd2eb6cf079f
MD5 1a96d5704b32067a7b892c31027b0a57
BLAKE2b-256 5652160bd8c5b354b8a7834cff02c183b2fd865441ecdf6e44a62036d8b9123e

See more details on using hashes here.

Provenance

The following attestation bundles were made for climaclass-0.2.0-py3-none-any.whl:

Publisher: publish.yml on DarriEy/climaclass

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page