# Eswatini Drought Map Hub - CDI Automation
This repository contains the automation scripts for generating and updating drought-related data for the **Eswatini Drought Map Hub**. The script is designed to run periodically (ideally on a monthly basis) to ensure the data remains up-to-date.
## Table of Contents
1. Overview
2. Prerequisites
3. Setup Instructions
4. Running the Script
5. Adjusting CDI Weights
6. Environment Variables
7. Automation
8. Contributing
9. License
---
## Overview
The Eswatini CDI Automation script (`job.sh`) downloads satellite/climate data, runs the Combined Drought Indicator (CDI) algorithm over Eswatini, and uploads the resulting GeoTiff rasters to a GeoNode instance. It is designed to run monthly via cron on a Linux server.
The CDI integrates four drought indices into a single percentile-ranked map. All inputs come from the NDMC Regional Percentiles endpoint as pre-ranked GeoTIFFs — **no authentication required**:
| Index | Source | Replaces |
|-------|--------|----------|
| ESI — Evaporative Stress Index | `era5_esi_1mn` | MODIS LST |
| EVI2 — Enhanced Vegetation Index | `evi2_1mn` | MODIS NDVI |
| SPI 3-month | `chirps_spi_3mn` | Locally computed SPI |
| NOAH Soil Moisture | `noah_soilm_1mn` | FLDAS SM |
For more information about the CDI methodology, visit the NDMC website.
---
## Prerequisites
Before running the script, ensure the following prerequisites are met:
1. **Operating System**: Linux-based system.
2. **System tools**: `wget`, `pup`, `curl`
```bash
sudo apt-get install wget curl
# pup (HTML parser):
github.com
```
3. **Python virtual environment** with packages from `src/data-processing/cdi-scripts/requirements.txt`. The default location is `~/.myenv`, but you can point at any path via the `PYTHON_VENV` env var (see Environment Variables). If no venv is found, the system `python3` is used as a fallback.
```bash
sudo apt-get install -y python3-venv python3-full # Debian/Ubuntu: required for …