Wildfire Risk Prediction β Rif Mountains, Morocco using Sentinel-2 + Random Forest ML
# WildfireRisk-Rif
readme_content = """# π₯ WildfireRisk-Rif β Forest Fire Risk Prediction
A geospatial machine learning project that predicts **wildfire risk zones** in the **Rif Mountains, Morocco** using real Sentinel-2 satellite imagery and a Random Forest classifier.
---
## π Project Overview
| Item | Details |
|---|---|
| **Satellite** | Sentinel-2 L2A (ESA / Copernicus) |
| **Bands used** | B04 (Red), B8A (NIR), B11 (SWIR-1), B12 (SWIR-2) |
| **Study area** | Rif Mountains β TΓ©touan / Chefchaouen, Morocco |
| **Date** | September 23, 2023 (peak fire season) |
| **Resolution** | 20 metres per pixel |
| **ML Model** | Random Forest Classifier (scikit-learn) |
---
## πΊοΈ Outputs
| File | Description |
|---|---|
| `rif_indices.png` | NDVI, NBR, NDWI spectral indices maps |
| `rif_fires_ndvi.png` | NDVI map with documented fire locations |
| `rif_fire_risk_map.png` | Static fire risk map (4 classes) |
| `wildfire_risk_interactive.html` | Interactive Folium web map |
| `morocco-wildfire-prediction.ipynb` | Full analysis notebook |
---
## π₯ Fire Risk Classes
| Class | Color | Description |
|---|---|---|
| Low | π’ Green | Water bodies, wet zones, dense forest |
| Moderate | π‘ Yellow | Sparse vegetation, some moisture |
| High | π Orange | Dry vegetation, low moisture |
| Extreme | π΄ Red | Very dry, stressed vegetation β highest risk |
---
## π Key Results
- **Study area:** ~1,000 kmΒ² β Rif Mountains, Morocco
- **Total pixels analyzed:** ~30 million (20m resolution)
- **Fire risk distribution:**
- π’ Low: 65.3%
- π‘ Moderate: 10.2%
- π High: 8.4%
- π΄ Extreme: 16.1%
---
## π§ Spectral Indices Used
| Index | Formula | Fire Risk Relevance |
|---|---|---|
| NDVI | (NIR - Red) / (NIR + Red) | Low NDVI = dry vegetation = high risk |
| NBR | (NIR - SWIR2) / (NIR + SWIR2) | Detects burned/dry areas |
| NDWI | (NIR - SWIR1) / (NIR + SWIR1) | Low moisture = high risk |
---
## π§ Installation
```bash
conda create -n geoenv python=3.11
conda activate geoenv
conda ins β¦