All 6 levels at once

March 14, 2026 · View on GitHub

INFERNIS

Open-source wildfire risk prediction for British Columbia

Live APISwagger DocsTry DemoWhite PaperContribute

Python 3.11+ License API Status


What is INFERNIS?

INFERNIS is an open-source wildfire risk prediction engine for British Columbia. It runs an automated daily pipeline that ingests weather data, satellite imagery, soil moisture, vegetation indices, topography, and fuel classifications, then outputs calibrated fire risk scores through a REST API.

There are two ways to use INFERNIS:

1. Use the hosted API (easiest)

A free, live instance runs at api.infernis.ca at 5 km resolution (~84,535 grid cells covering all of BC). It updates daily at 2 PM Pacific. Sign up at infernis.ca for a free API key (50 requests/day).

What you getDetails
Resolution5 km (~84,535 cells)
ModelXGBoost, 24 features, AUC-ROC 0.942 (CV) / 0.946 (test)
Update frequencyDaily at 2 PM Pacific
ForecastUp to 10 days (ECCC GEM model via Open-Meteo)
Free tier50 requests/day, all endpoints
Base URLhttps://api.infernis.ca/v1/
AuthX-API-Key header

2. Run your own instance (this repo)

Clone this repo and deploy your own API at 1 km resolution (~2.1M cells). Pre-trained models are included — you can be up and running without downloading training data or training anything. If you want to retrain or customize, the full pipeline (21 download scripts + training code) is included too.

What you getDetails
Resolution1 km (~2,113,524 cells) — configurable
Pre-trained modelsXGBoost 5 km + 1 km, CNN FireUNet 5 km + 1 km, BEC calibration — all included
Model performanceXGBoost 1 km: AUC-ROC 0.974, CNN: AUC 0.815
Optional: retrain21 download scripts, 10 fire seasons (2015–2024), ~546 GB raw data
RequirementsPython 3.11+, PostgreSQL 16 + PostGIS 3.4, Redis 7

Try the Hosted API

Demo endpoints (no API key needed)

Build your integration against the demo endpoints first — they mirror the real API with mock data at 6 test locations across BC (one per danger level). Just remove /demo from the URL when you switch to a real API key.

Test LocationDanger LevelCoordinates
SquamishVERY_LOW49.70, -123.16
VernonLOW50.27, -119.27
KamloopsMODERATE50.67, -120.33
LyttonHIGH50.23, -121.58
Williams LakeVERY_HIGH52.13, -122.14
VanderhoofEXTREME54.02, -124.00
# Point risk — pass any BC coordinates, snaps to nearest test location
curl https://api.infernis.ca/v1/demo/risk/50.67/-120.33 | python -m json.tool

# 10-day forecast
curl https://api.infernis.ca/v1/demo/forecast/54.02/-124.00 | python -m json.tool

# FWI components
curl https://api.infernis.ca/v1/demo/fwi/50.23/-121.58 | python -m json.tool

# Weather conditions
curl https://api.infernis.ca/v1/demo/conditions/49.70/-123.16 | python -m json.tool

# BEC zone summary
curl https://api.infernis.ca/v1/demo/risk/zones | python -m json.tool

# All 6 levels at once
curl https://api.infernis.ca/v1/demo/risk | python -m json.tool

Live endpoints (free API key)

Sign up at infernis.ca for a free API key (50 requests/day). Same URL structure as demo — just drop /demo and add your key:

# Real-time fire risk for Kamloops
curl -H "X-API-Key: YOUR_KEY" https://api.infernis.ca/v1/risk/50.67/-120.33

# 10-day forecast for Williams Lake
curl -H "X-API-Key: YOUR_KEY" https://api.infernis.ca/v1/forecast/52.13/-122.14

# GeoJSON grid for the Okanagan
curl -H "X-API-Key: YOUR_KEY" "https://api.infernis.ca/v1/risk/grid?bbox=49.0,-120.5,50.5,-119.0"

# PNG heatmap
curl -H "X-API-Key: YOUR_KEY" "https://api.infernis.ca/v1/risk/heatmap?bbox=49.0,-120.5,50.5,-119.0" -o heatmap.png

All Endpoints

Core (API Key required):

EndpointDescription
GET /v1/risk/{lat}/{lon}Point fire risk with score, FWI, weather, context, and change_24h
GET /v1/forecast/{lat}/{lon}Multi-day forecast with weather data (up to 10 days)
POST /v1/risk/batchBatch risk query — up to 50 locations in one call
GET /v1/risk/history/{lat}/{lon}Historical risk data (up to 90 days)
GET /v1/risk/grid?bbox=s,w,n,eArea risk as GeoJSON with color hex in properties
GET /v1/risk/heatmap?bbox=s,w,n,eFire risk as PNG image
GET /v1/risk/zonesRisk summary per BEC zone
GET /v1/fwi/{lat}/{lon}Raw FWI components (FFMC, DMC, DC, ISI, BUI, FWI)
GET /v1/conditions/{lat}/{lon}Current weather and environment conditions
GET /v1/fires/near/{lat}/{lon}Active fires from BC Wildfire Service (sorted by distance)
POST /v1/alertsRegister webhook for risk threshold alerts
GET /v1/alertsList your active alerts
DELETE /v1/alerts/{id}Deactivate an alert

Map Tiles (no API key):

EndpointDescription
GET /v1/tiles/{z}/{x}/{y}.png256x256 PNG risk overlay for Google Maps / Leaflet / Mapbox

Demo (no API key — same response format, mock data):

EndpointDescription
GET /v1/demo/risk/{lat}/{lon}Point risk, snaps to nearest test location
GET /v1/demo/forecast/{lat}/{lon}10-day forecast for nearest test location
GET /v1/demo/fwi/{lat}/{lon}FWI components for nearest test location
GET /v1/demo/conditions/{lat}/{lon}Weather conditions for nearest test location
GET /v1/demo/risk/zonesBEC zone summary
GET /v1/demo/riskAll 6 danger levels at once
GET /v1/demo/risk/{level}Single level by name

Public (no auth):

EndpointDescription
GET /v1/statusPipeline health and last run time
GET /v1/coverageGrid metadata and BC boundaries

Full documentation: API Reference | Swagger UI

Run Your Own Instance

Setup

git clone https://github.com/argonBIsystems/infernis.git
cd infernis
./scripts/dev_setup.sh    # creates venv, installs deps, copies .env

# Start PostgreSQL + Redis
make db-up
make migrate

# Generate the 1km BC grid (~2.1M cells)
python scripts/generate_grid.py --resolution 1

# Start the API (pipeline runs automatically at 2 PM Pacific)
make dev

Download training data

The repo includes 21 download scripts for all open data sources. Each script targets a specific source — run them individually or all at once:

# Download everything (~546 GB when complete)
python scripts/download/download_all.py

# Or download specific sources
python scripts/download/01_era5.py          # ERA5 weather reanalysis (ECMWF)
python scripts/download/02_gee_satellite.py # MODIS NDVI, snow, LAI (Google Earth Engine)
python scripts/download/03_cnfdb.py         # Historical fire records (NRCan)
python scripts/download/17_dem.py           # Canadian Digital Elevation Model
python scripts/download/18_cldn.py          # Lightning detection (ECCC)
python scripts/download/21_bc_bec.py        # Biogeoclimatic zones (BC Gov)

Some scripts require API keys (CDS, GEE, NASA Earthdata, FIRMS). See .env.example for what's needed.

Pre-trained models (included)

All pre-trained model weights are included in this repo. CNN models (.pt files) use Git LFS.

ModelFileSize
XGBoost 5 km (24 features)models/fire_core_v1.json19 MB
XGBoost 1 km (28 features)models/fire_core_1km_v1.json18 MB
CNN FireUNet 5 kmmodels/heatmap_v1.pt30 MB (LFS)
CNN FireUNet 1 kmmodels/heatmap_1km_v1.pt119 MB (LFS)
BEC calibration 5 kmmodels/bec_calibration.json1.4 KB
BEC calibration 1 kmmodels/bec_calibration_1km.json1.4 KB

To pull LFS files after cloning: git lfs pull

Train your own models

# Process raw data into feature matrices
python scripts/train.py process --data-dir data/raw --output data/processed/features

# Build training dataset
python scripts/train.py build --features data/processed/features --output data/processed/training_data.parquet

# Train XGBoost model
python scripts/train.py train --data data/processed/training_data.parquet --output models/

# Evaluate
python scripts/train.py evaluate --model models/fire_core_1km_v1.json --data data/processed/training_data.parquet

# Train CNN heatmap model (requires GPU or Apple Silicon MPS)
python scripts/train_heatmap.py --data-dir data/processed/heatmap --epochs 30

# Per-BEC-zone calibration
python scripts/calibrate_bec.py --data data/processed/training_data.parquet --output models/bec_calibration.json

# Walk-forward backtesting (train on years N, test on year N+1)
python scripts/backtest.py backtest --data data/processed/training_data.parquet --output reports/backtest.json

Grid resolution

Set INFERNIS_GRID_RESOLUTION_KM in .env:

ResolutionCellsPipeline timeNotes
1 km~2.1M~5–12 minDefault for self-hosted. Full precision.
5 km~84K~30sUsed by hosted API. Good for demos.
# Switch to 5km (lighter, matches hosted API)
INFERNIS_GRID_RESOLUTION_KM=5.0
python scripts/generate_grid.py --resolution 5

The 5 km model (fire_core_v1.json, 24 features) and 1 km model (fire_core_1km_v1.json, 28 features) are resolution-specific. The pipeline auto-selects the right model based on grid resolution.

Model Performance

5 km model (hosted API)

MetricCV (5-fold)Test
AUC-ROC0.9420.946
Avg Precision0.6290.645
Brier Score0.0920.048
Features24
Training samples1,139,112

1 km model (self-hosted)

MetricTest
AUC-ROC0.974
Avg Precision0.794
Brier Score0.036
Features28
Training samples298,606

CNN FireUNet (1 km only)

MetricTest
AUC-ROC0.815
Epochs trained24 (early stopped)
Training time~3 hours on MPS

Walk-forward backtest (6 seasons, 2019–2024)

AUC-ROC: 0.90–0.93 | Avg Precision: 0.43–0.59 | Brier: 0.04–0.08

Danger Levels

LevelScoreColorDescription
VERY_LOW0.00–0.05#22C55EMinimal risk
LOW0.05–0.15#3B82F6Low risk
MODERATE0.15–0.35#EAB308Elevated — monitor conditions
HIGH0.35–0.60#F97316Significant risk
VERY_HIGH0.60–0.80#EF4444Severe danger
EXTREME0.80–1.00#1A0000Immediate danger

How It Works

  1. Data Pipeline — Daily fetch of ERA5 weather reanalysis, MODIS/VIIRS satellite imagery via Google Earth Engine, Open-Meteo NWP forecasts, and CLDN lightning density grids.

  2. FWI Computation — Vectorized Canadian Fire Weather Index system (CFFDRS standard equations) computing all 6 components (FFMC, DMC, DC, ISI, BUI, FWI) for every grid cell.

  3. XGBoost Classifier — Gradient-boosted model trained on 10 fire seasons (2015–2024). The 5 km model uses 24 features; the 1 km model uses 28 features (adds 4 soil moisture depth layers).

  4. CNN Spatial Model — U-Net architecture (FireUNet) processes daily raster snapshots to capture spatial fire spread patterns. Available for 1 km resolution only.

  5. Risk Calibration — Per-BEC-zone logistic calibration across BC's 14 biogeoclimatic zones, outputting a 6-level danger classification.

  6. Forecast Engine — Up to 10-day risk forecasts using ECCC's GEM model (HRDPS 2.5 km for days 1–2, GDPS for days 3–10) with FWI roll-forward and 0.95/day confidence decay.

Built with INFERNIS

Projects built by the community using the INFERNIS API:

ProjectDescriptionLink
Fire Forecast BCInteractive wildfire risk map for British Columbia. Search any BC address, see today's risk score and 10-day forecast, view active fire incidents — all powered by the INFERNIS API.fireforecastbc.ca/live

Built something with INFERNIS? Open a PR to add it here.

Project Structure

src/infernis/
  api/              REST API routes, auth middleware
  db/               SQLAlchemy ORM, PostGIS engine
  grid/             BC grid generator (1 km / 5 km, EPSG:3005)
  models/           Pydantic schemas, danger level enums
  pipelines/        Daily pipeline, ERA5, GEE, Open-Meteo, HRDPS/GDPS, lightning, forecasting
  services/         Vectorized FWI (CFFDRS), Redis cache
  training/         XGBoost trainer, FireUNet CNN, risk fuser, backtester
  main.py           FastAPI app entry point
  admin.py          CLI tools (key management, grid init, pipeline runner)

scripts/
  download/         21 data download scripts (ERA5, MODIS, CLDN, DEM, etc.)
  train.py          Model training pipeline
  backtest.py       Historical backtesting
  dev_setup.sh      One-command development setup

tests/              Test suite (mirrors src/ structure)
docs/               White paper, architecture, API reference
brand/              Logo, brand guidelines

Documentation

DocumentDescription
White PaperWildfire science, methodology, data fusion approach
Technical ArchitectureSystem design, database schema, pipeline flows
API ReferenceEndpoint docs with request/response examples
Brand GuidelinesLogo, colors, typography
RoadmapPlanned features, research, how to contribute

Tech Stack

  • Runtime: Python 3.11+, FastAPI, Uvicorn
  • ML: XGBoost 2.1, PyTorch 2.x (MPS/CUDA), scikit-learn
  • FWI: Custom vectorized CFFDRS (numpy)
  • Geospatial: GeoPandas, Rasterio, Shapely, pyproj
  • Weather: Open-Meteo (GEM seamless), ERA5 (CDS API)
  • Satellite: Google Earth Engine (MODIS, VIIRS), NASA FIRMS
  • Database: PostgreSQL 16 + PostGIS 3.4, Redis 7
  • Deploy: Docker, Railway, GitHub Actions CI

Contributing

Contributions welcome. See CONTRIBUTING.md for setup and guidelines.

make test      # Run tests
make fmt       # Format with ruff

License

Apache License 2.0


Built in British Columbia, Canada • Argon BI Systems Inc.