fwi-chain
The Canadian Forest Fire Weather Index chain (Van Wagner 1987) as pure, typed Python functions with no dependencies — verified against the published reference day to 1e-9.
Four noon readings a day (temperature, relative humidity, 10 m wind, rain over the previous 24 h) give six numbers:
| Code | What it tracks | Memory |
|---|---|---|
| FFMC | fine fuel moisture | ~2/3 day |
| DMC | duff moisture | ~12 days |
| DC | deep drought | ~52 days |
| ISI | rate of spread (FFMC × wind) | — |
| BUI | available fuel (DMC + DC) | — |
| FWI | fire intensity, the index EFFIS publishes for Europe | — |
The three moisture codes are recursive: today's value depends on
yesterday's. A chain started from the standard values needs weeks of
spin-up, so the library gives you the state as a value (FwiState) and
leaves persisting it to you — a table, a file, a cache.
Install
pip install fwi-chain
Use
from fwi_chain import STANDARD_PARAMS, advance
state = STANDARD_PARAMS.initial_state # FFMC/DMC/DC = 85 / 6 / 15
out = advance(
state,
month=4,
temperature_c=17.0,
relative_humidity_pct=42.0,
wind_speed_kmh=25.0,
rain_24h_mm=0.0,
params=STANDARD_PARAMS,
)
print(round(out.fwi, 2)) # 10.1
state = out.state # store it: tomorrow starts from here
The individual equations (fine_fuel_moisture_code, duff_moisture_code,
drought_code, initial_spread_index, buildup_index,
fire_weather_index) are exported too.
STANDARD_PARAMS carries Van Wagner's day-length tables for 46°N. Far from
that latitude, or south of the equator, build your own FwiParams:
from fwi_chain import FwiParams
params = FwiParams(
ffmc_start=85.0,
dmc_start=6.0,
dc_start=15.0,
day_length_dmc=(...), # 12 monthly factors, January first
day_length_dc=(...),
)
Why another FWI implementation
- Zero dependencies, scalar, pure. No NumPy, no xarray, no I/O, no clock. It fits a database job, a stream processor or a small service. For gridded climate data, xclim's vectorised FWI is the better tool.
- The state is explicit. One call is one day; persisting and resuming the chain is the caller's choice, not hidden in an array dimension.
- Verified, not just tested. The suite checks the six outputs of the
reference day of the
cffdrstest series to an absolute 1e-9, plus every rain branch, physical bounds under extreme weather, and the memory asymmetry between FFMC and DC.
Extracted from Limen, where it runs the wildfire danger chain for every ~9 km weather node in Italy.
Reference
Van Wagner, C.E. (1987). Development and structure of the Canadian Forest Fire Weather Index System. Canadian Forestry Service, Forestry Technical Report 35. Equation numbers in the source comments are that report's.
Development
uv sync
make check
License
Metadata
Release files for fwi-chain 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fwi_chain-1.0.0.tar.gz | 11.5 kB | With provenance | Details for fwi_chain-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fwi_chain-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for fwi_chain-1.0.0-py3-none-any.whl |
Total release size: 23.5 kB
Release files / fwi_chain-1.0.0.tar.gz
| Download URL | fwi_chain-1.0.0.tar.gz |
|---|---|
| Size | 11.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ac2cfed36a8610dcf2db8a2bd1a507d7a4394f6454f3b4d4f1469473026610ab
|
|
BLAKE2b-256 checksum How to use checksums |
1824d994e084411493ed02fdfeb387df0e99dd7589ce54060d03f8f810a06aa2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.
Transparency logRelease files / fwi_chain-1.0.0-py3-none-any.whl
| Download URL | fwi_chain-1.0.0-py3-none-any.whl |
|---|---|
| Size | 12.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f1c50647e2f9d6341c9323c0a5087f962983303f3533d1dd1e7e2271a1e3ed77
|
|
BLAKE2b-256 checksum How to use checksums |
4c6aae8f7185b011ab492eeccaa67ead4356133a1f3749de8126ea7e9426099d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.
Transparency logSecurity for fwi-chain 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for fwi_chain-1.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.