Sentinel-2 change detection pipeline for an open-pit mining site in Zambia. Detects land-surface change between two acquisitions (Aug–Sep 2023) using Change Vector Analysis with a robust median/MAD threshold. Outputs change polygons stored in a SQLite/GeoPackage database with interactive map visualisation.
# Sentinel-2 Change Analysis — Open-Pit Mine, Zambia
A geospatial pipeline that detects land-surface change between two Sentinel-2
acquisitions (**2023-08-12** → **2023-09-02**) over an open-pit mining site in
Zambia. It stores results in a spatial database and produces static and
interactive figures.
| Part | Stage | Module | Output |
|------|-------|--------|--------|
| 1 | Data preparation | `src/data_preparation.py` | `data/processed/sentinel2_*_stack.tif` |
| 2 | Change detection | `src/change_detection.py` | `change_map.tif`, `change_binary.tif` |
| 3 | Feature extraction + storage | `src/feature_extraction.py` | `changes.gpkg` (SQLite/GeoPackage) |
| 4 | Visualisation | `src/visualize.py` | `outputs/change_overview.png`, `change_map.html` |
| 5 | Analysis & interpretation | `report.md` | — |
Three extra scripts show **why CVA was chosen** over other threshold methods:
| Script | What it shows | Output |
|--------|--------------|--------|
| `src/otsu_threshold.py` | Otsu flags 45.75% — fails on unimodal histogram | `outputs/otsu_threshold.png` |
| `src/mean_std_threshold.py` | Mean/std shifts when outliers change | `outputs/mean_std_threshold.png` |
| `src/threshold_comparison.py` | All three methods on one figure | `outputs/threshold_comparison.png` |
Full engineering reference: DOCUMENTATION.md
---
## How to run
```bash
# 1. Create environment and install dependencies
python3 -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txt
# 2. Run the full pipeline (Parts 1–4)
python src/pipeline.py
# 3. Run the threshold comparison scripts (optional)
python src/otsu_threshold.py
python src/mean_std_threshold.py
python src/threshold_comparison.py
```
Note: the threshold scripts need the stacks from Part 1. If you skip the full
pipeline, run `python src/data_preparation.py` first.
Each stage can also be run on its own. All paths and parameters are in
`src/config.py`.
### Inputs expected
```
inpu …