Carbon estimation a cross kenya and african
# Carbon Stock & AGB Estimation — Streamlit App
A Streamlit port of the Google Earth Engine notebook for estimating
above-ground biomass (AGB) carbon stock across selected Kenyan counties,
using Sentinel-1/2, SRTM, WorldClim, PALSAR, soil, and canopy-height data
as predictors, with Random Forest, Gradient Tree Boosting, and SVM
regression models.
## What it does
- Lets you pick which Kenyan counties (ADM1) to include in the study area
- Supports ESA CCI AGB reference years 2010 and 2015–2022, with satellite
predictor inputs composited through 2023
- Builds the full predictor stack on Earth Engine (spectral indices, radar,
terrain, climate, soil, canopy height, land-surface temperature)
- Samples training/testing points and trains RF, GTB, and SVM regressors
- Shows an interactive map where you can switch between model outputs
(carbon stock or AGB) — this replaces the notebook's `ipywidgets` dropdown
- Compares RF vs. GTB with a difference map
- Computes RMSE / MAE / R² and actual-vs-predicted scatter plots on the
held-out test set
- Computes per-county zonal statistics (mean/min/max/sum), downloadable as CSV
- Shows variable importance for RF and GTB
- Includes a beginner-friendly Environmental Guide chat powered by Gemini, with
an optional local Ollama fallback for explaining maps, climate change,
emissions, carbon credits, markets, and uncertainty
## 1. Prerequisites
- Python 3.10+
- A Google account with **Earth Engine access** enabled
(sign up free at
earthengine.google.com)
- A **Google Cloud project** registered for Earth Engine use
(any project ID works, e.g. one created at
console.cloud.google.com)
- Optional: a Gemini API key for the Learning Guide, or a locally running
Ollama instance for offline chat fallback
### Learning Guide key setup
Copy `.streamlit/secrets.example.toml` to `.streamlit/secrets.toml`, then add
your Gemini key. The real secrets file is ignored by Git. You can also paste a
key into the guide settings for the curre …