Estimating CH4 emissions over Africa using ML/DL based methods
# CH4 Emission Model — Africa
End-to-end machine-learning pipeline that estimates anthropogenic CH₄ emissions
over Africa from satellite observations and reanalysis data, trained against
EDGAR v2025 inventory and validated on an unseen year.
- **Domain** : Africa, lon ∈ [−20°, 55°], lat ∈ [−40°, 40°]
- **Grid** : 0.1° × 0.1° (NY = 800, NX = 750), aligned to EDGAR
- **Train** : 2019–2023 (stratified-by-year 80/20 train/test split)
- **Predict** : 2024 (full-grid, also used as unseen-year evaluation)
- **Targets** : `emissions` (tonnes/cell/year) **or** `flux` (kg m⁻² s⁻¹)
- **Models** : XGBoost, Random Forest, CNN, CNN-LSTM
---
## 1. Repository layout
```
ch4_emission_model/
├── config.py # paths, grid, features, target, skip-zero & noise-floor flags
├── common.py # data loaders, splitter, metrics, CSV/NetCDF writers
├── prepare_data.py # build per-year NetCDF stacks (TROPOMI + ERA5 + LandScan + EDGAR)
├── xgboost_model.py # XGBoost + 9-stage sequential GridSearchCV tuning
├── random_forest_model.py # Random Forest + 5-stage sequential tuning
├── cnn_model.py # per-pixel CNN (9×9 patches) + 5-stage tuning
├── cnn_lstm_model.py # CNN-LSTM (T=3 yr window, 9×9 patches) + 5-stage tuning
├── slurm_xgboost_emissions.sh
├── slurm_random_forest_emissions.sh
├── slurm_cnn_emissions.sh
├── slurm_cnn_lstm_emissions.sh
├── data/ # training_data_ .nc (built by prepare_data.py)
├── models/ # saved models (xgboost_ .pkl, ..._ .pt)
└── outputs/
├── xgboost/ / # tuning_*.csv, best_params_*.json, train/test_pred_*.csv, metrics_*.csv
├── random_forest/ /
├── cnn/ /
├── cnn_lstm/ /
└── predictions_2024_ _ .nc
```
` ` is either `emissions` or `flux`.
---
## 2. Input datasets
| Dataset | Variable used | Native resolution | Source path |
|---|---|---|---|
| TROPOMI WFMD (daily L2) | column-averaged dry-air XCH₄ (`xch4`, QA == 0) | ~0.1°, swath | `shared/farha …