Physics-based fire spread simulation for the Uttarakhand region using satellite fire detections, terrain analysis, and a Rothermel-inspired Cellular Automaton model.
- Overview
- Demo Outputs
- Pipeline Architecture
- Data Sources
- Physics Model
- Installation
- Usage
- Results
- Project Structure
- Acknowledgements
Forest fires in Uttarakhand (Himalayan foothills, India) are a recurring ecological and humanitarian crisis. This project builds an end-to-end pipeline that:
- Downloads multi-year satellite fire detections (NASA VIIRS 375 m), terrain data (Copernicus DEM 30 m), and land-cover maps (ESA WorldCover 2021).
- Builds a fire risk probability map from 5 years of historical VIIRS fire frequency (2019–2023) using spatial Gaussian smoothing — no ML training required.
- Simulates fire spread using a physics-based Cellular Automaton (CA) model driven by Rothermel fire-behavior equations, incorporating wind, slope, aspect, fuel load, and humidity.
- Generates GeoTIFF outputs at 1 / 2 / 3 / 6 / 12-hour timesteps and animated visualizations ready for submission.
Derived from 5 years of VIIRS active fire detections (2019–2023), smoothed with a 360 m Gaussian kernel.
| 1 Hour | 2 Hours |
|---|---|
![]() |
![]() |
| 3 Hours | 6 Hours |
|---|---|
![]() |
![]() |
┌─────────────────────────────────────────────────────────────┐
│ DATA ACQUISITION │
│ │
│ NASA FIRMS VIIRS ──► viirs_YYYY_filtered.csv │
│ Copernicus DEM 30m ──► cop30_*.tif → dem_30m.tif │
│ ESA WorldCover 2021 ─► worldcover_*.tif → lulc_30m.tif │
│ ERA-5 (optional) ──► weather variables │
└────────────────────────────┬────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ PREPROCESSING │
│ │
│ Reproject all layers → EPSG:32644 (UTM Zone 44N) │
│ Resample to 30 m uniform grid │
│ Derive: slope, aspect, fuel load from LULC │
│ Align VIIRS burn masks to terrain grid │
└────────────────────────────┬────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ FIRE RISK PROBABILITY MAP │
│ │
│ VIIRS 2019–2023 → Per-pixel fire frequency │
│ Gaussian smoothing (σ = 360 m) │
│ Normalise → P ∈ [0, 1] │
│ Classify: High ≥ 0.70 │ Moderate ≥ 0.40 │ Low ≥ 0.20 │
│ │
│ Output: fire_probability_YYYY-MM-DD.tif │
│ fire_class_YYYY-MM-DD.tif │
└────────────────────────────┬────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ CELLULAR AUTOMATON FIRE SPREAD │
│ │
│ Ignition seeds ← class ≥ 2 (moderate risk) pixels │
│ Step size = 5 minutes │
│ Spread rule = Rothermel-based probability per cell: │
│ │
│ P = P_base × wind_factor × slope_factor │
│ × fuel_factor × moisture_factor │
│ │
│ Output GeoTIFFs at 1h / 2h / 3h / 6h / 12h │
└────────────────────────────┬────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ VISUALIZATION │
│ │
│ Spread snapshots (PNG) │ Animated GIF │ Statistics │
└─────────────────────────────────────────────────────────────┘
| Dataset | Source | Resolution | Coverage |
|---|---|---|---|
| Active Fire Detections | NASA FIRMS VIIRS SNPP NRT | 375 m | 2019–2023 |
| Digital Elevation Model | Copernicus DEM GLO-30 | 30 m | Uttarakhand bbox |
| Land Use / Land Cover | ESA WorldCover 2021 | 10 m → 30 m | Uttarakhand bbox |
| Weather (optional) | ERA-5 Reanalysis via CDS | 0.25° | Fire season (Feb–Jun) |
Study Area: Uttarakhand, India
Bounding Box: [77.5°E, 28.7°N, 81.1°E, 31.5°N]
Projection: UTM Zone 44N (EPSG:32644)
The Cellular Automaton uses a simplified Rothermel fire-spread model. At each 5-minute timestep, every burning cell attempts to ignite its 8 Moore neighbours:
P_spread = P_base × wind_factor × slope_factor × fuel_factor × moisture_factor
| Factor | Formula | Description |
|---|---|---|
wind_factor |
1 + 0.50 × U × cos(θ_spread − θ_wind) |
Increases spread downwind |
slope_factor |
exp(3.533 × tan(α) × cos(θ_spread − θ_uphill)) |
Amplifies uphill spread |
fuel_factor |
LULC fuel load ∈ [0, 1] | Tree cover=0.85, shrub=0.80, grass=0.70 |
moisture_factor |
max(0.1, 1 − 0.005 × max(0, RH − 30)) |
Suppresses spread in humid conditions |
| Land Cover | ESA Class | Fuel Factor |
|---|---|---|
| Tree cover (dense forest) | 10 | 0.85 |
| Shrubland | 20 | 0.80 |
| Grassland | 30 | 0.70 |
| Cropland | 40 | 0.30 |
| Built-up | 50 | 0.00 |
| Bare / sparse vegetation | 60 | 0.10 |
| Water / Snow / Ice | 70, 80 | 0.00 |
-1 Non-burnable (water, urban, snow)
0 Unburned
1 Burning (active — dark orange in maps)
2 Burned out (exhausted — dark grey in maps)
- Python 3.10+
- Windows / Linux / macOS
# Clone the repository
git clone https://github.com/Jaideep193/forest-fire.git
cd forest-fire
# Install dependencies
pip install -r requirements.txtCreate a .env file (see .env.example):
FIRMS_MAP_KEY=your_nasa_firms_api_key
OPENTOPO_API_KEY=your_opentopography_keyFor ERA-5, configure ~/.cdsapirc with your Copernicus CDS credentials.
# Step 1 — Build fire probability map from VIIRS history
python make_prediction.py
# Step 2 — Pre-resample terrain rasters (run once)
python resample_rasters.py # only needed if rasters_300m/ doesn't exist
# Step 3 — Run CA fire spread simulation
python main.py --step simulate --ignition-threshold 2
# Step 4 — Generate all visualizations
python main.py --step visualizepython main.py --step allpython main.py --step download # Download raw data
python main.py --step preprocess # Build terrain + LULC layers
python main.py --step simulate # CA fire spread
python main.py --step visualize # Generate plots & animation| Flag | Default | Description |
|---|---|---|
--ignition-threshold |
3 |
Min fire class to seed (1=low, 2=moderate, 3=high) |
--date |
latest |
Date (YYYY-MM-DD) for prediction step |
--config |
config/config.yaml |
Path to config file |
| Timestep | Affected Area |
|---|---|
| 1 hour | ~5,927 ha |
| 2 hours | ~12,446 ha |
| 3 hours | ~18,290 ha |
| 6 hours | ~33,334 ha |
| 12 hours | ~49,846 ha |
Note: These figures represent a worst-case scenario simulation where all historically fire-prone moderate-risk areas ignite simultaneously under typical May weather conditions (westerly wind 5 m/s, humidity 25%). Real incidents involve a single ignition point.
| File | Format | Description |
|---|---|---|
outputs/predictions/fire_probability_*.tif |
GeoTIFF float32 | Per-pixel fire probability [0, 1] |
outputs/predictions/fire_class_*.tif |
GeoTIFF uint8 | 4-class risk map (0=nil, 1=low, 2=mod, 3=high) |
outputs/simulations/fire_spread_01.0h.tif |
GeoTIFF int8 | CA state at 1 h |
outputs/simulations/fire_spread_02.0h.tif |
GeoTIFF int8 | CA state at 2 h |
outputs/simulations/fire_spread_03.0h.tif |
GeoTIFF int8 | CA state at 3 h |
outputs/simulations/fire_spread_06.0h.tif |
GeoTIFF int8 | CA state at 6 h |
outputs/simulations/fire_spread_12.0h.tif |
GeoTIFF int8 | CA state at 12 h |
outputs/animations/fire_spread_animation.gif |
GIF | Animated spread 1 h → 12 h |
outputs/animations/fire_probability_map.png |
PNG | Fire risk heatmap |
outputs/animations/spread_statistics.png |
PNG | Burned area vs time chart |
Forest_fire/
│
├── config/
│ └── config.yaml # All parameters (bbox, resolution, CA coefficients)
│
├── data/
│ ├── raw/
│ │ ├── dem/ # Copernicus DEM 30 m tiles
│ │ ├── lulc/ # ESA WorldCover tiles
│ │ ├── viirs/ # VIIRS active fire CSVs (2019–2023)
│ │ └── weather/ # ERA-5 NetCDF files
│ └── processed/
│ ├── dem_30m.tif # Merged & reprojected DEM
│ ├── slope_30m.tif # Terrain slope (degrees)
│ ├── aspect_30m.tif # Terrain aspect (degrees)
│ ├── fuel_30m.tif # Fuel load [0,1] from LULC
│ ├── lulc_30m.tif # Land cover classes
│ ├── viirs_labels_aligned.tif # Historical fire mask
│ └── rasters_300m/ # Pre-resampled 300 m layers for CA
│
├── src/
│ ├── data_pipeline/
│ │ ├── download_dem.py # Copernicus DEM downloader
│ │ ├── download_lulc.py # ESA WorldCover downloader
│ │ ├── download_viirs.py # NASA FIRMS VIIRS downloader
│ │ ├── download_era5.py # ERA-5 CDS downloader
│ │ └── preprocess.py # Alignment, reprojection, patch building
│ ├── models/
│ │ ├── unet.py # U-Net with attention gates + Dice-BCE loss
│ │ ├── train.py # Training loop (mixed precision, early stopping)
│ │ ├── predict.py # Inference → probability + class rasters
│ │ └── dataset.py # PyTorch dataset (patches, augmentation)
│ ├── simulation/
│ │ ├── cellular_automata.py # Rothermel CA fire spread engine
│ │ └── visualize.py # Plots, snapshots, GIF animation
│ └── utils/
│ ├── logger.py # Structured logging
│ ├── raster_utils.py # GeoTIFF read/write helpers
│ └── http_utils.py # Retry-safe HTTP downloads
│
├── outputs/
│ ├── predictions/ # Fire probability & class GeoTIFFs
│ ├── simulations/ # CA state GeoTIFFs (1/2/3/6/12 h)
│ └── animations/ # PNGs, GIF, statistics chart
│
├── main.py # Pipeline entry point (--step all/download/…)
├── make_prediction.py # VIIRS-frequency probability map (no ML needed)
└── requirements.txt
Key dependencies (see requirements.txt for full list):
torch>=2.0
rasterio>=1.3
numpy
pandas
scipy
matplotlib
pyproj
tqdm
pyyaml
python-dotenv
| Resource | Credit |
|---|---|
| Active fire data | NASA FIRMS / VIIRS SNPP |
| Elevation data | Copernicus DEM GLO-30 |
| Land cover data | ESA WorldCover 2021 |
| Fire physics | Rothermel, R.C. (1972) — A Mathematical Model for Fire Spread |
| Competition | ISRO Bharatiya Antariksh Hackathon (BAH) 2025 |
Built for ISRO BAH 2025 · Problem Statement — Forest Fire Spread Simulation
Uttarakhand, India · EPSG:32644 · 300 m resolution · 1 / 2 / 3 / 6 / 12-hour timesteps







