Read-only mirror of https://github.com/swisstopo/topo-satromo-v2 — Bundesamt für Landestopografie. Issues & pull requests at the source.
  • Jupyter Notebook 94.1%
  • Python 5.9%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
github-actions[bot] b6ba73fd1d Tools files done
2026-12-04 14:22:03 +00:00
.github/workflows Dev 20261006 (#57) 2026-11-17 10:12:09 +01:00
assets Dev 20260506 (#42) 2026-06-29 16:20:21 +02:00
codegallery Dev 20260901 (#53) 2026-10-06 16:24:40 +02:00
configuration Dev 20261006 (#57) 2026-11-17 10:12:09 +01:00
main_functions Dev 20261006 (#57) 2026-11-17 10:12:09 +01:00
step0_processors Dev 20261006 (#57) 2026-11-17 10:12:09 +01:00
step1_processors Dev 20261006 (#57) 2026-11-17 10:12:09 +01:00
tools Tools files done 2026-12-04 14:22:03 +00:00
util Dev 20261006 (#57) 2026-11-17 10:12:09 +01:00
.gitattributes Dev 20260629 into main (#50) 2026-09-01 11:20:15 +02:00
.gitignore Dev 20261006 (#57) 2026-11-17 10:12:09 +01:00
check_s2_sr.py Dev 20261006 (#57) 2026-11-17 10:12:09 +01:00
check_vhi.py Dev 20261006 (#57) 2026-11-17 10:12:09 +01:00
CLAUDE.md Dev 20261006 (#57) 2026-11-17 10:12:09 +01:00
horayzon-1.2-cp311-cp311-win_amd64.whl Dev 20260407 to main (#37) 2026-05-06 11:59:35 +02:00
horayzon-1.2-cp312-cp312-win_amd64.whl Dev 20261006 (#57) 2026-11-17 10:12:09 +01:00
hourly_runner.sh Dev 20261006 (#57) 2026-11-17 10:12:09 +01:00
LICENSE.txt Dev 20260407 to main (#37) 2026-05-06 11:59:35 +02:00
README.md Dev 20261006 (#57) 2026-11-17 10:12:09 +01:00
reprocess_s2sr.sh Dev 20260901 (#53) 2026-10-06 16:24:40 +02:00
reprocess_s2sr_202509.sh
requirements.txt Dev 20261006 (#57) 2026-11-17 10:12:09 +01:00
rerun.py Dev 20261006 (#57) 2026-11-17 10:12:09 +01:00
satromo_processor.py Implement date check for empty asset list HOTFIX 2026-11-17 17:25:07 +01:00
step0_functions.py Dev 20261006 (#57) 2026-11-17 10:12:09 +01:00

GitHub commitPython 3.12Python 3.11Ask DeepWiki

topo-satromo-v2

Erdbeobachtungs-SAtellitendaten fürs TRockenheitsMOnitoring (SATROMO) — Version 2

An operational Python ETL pipeline for generating and publishing Analysis-Ready Data (ARD) and vegetation/drought indices from Sentinel-2 satellite imagery, using CSDE, AWS S3, STAC catalogs, and GitHub Actions.

swissEO S2-SR swissEO VHI
Data description Product site Product site
Access to data STAC STAC

Both products are operational and are produced in production with configuration/prod_config.py.

Overview

SATROMO v2 is a serverless satellite data processing chain for Switzerland that:

  1. step0 — Checks availability of input data in STAC CSDE and STAC swisstopo catalogs (Sentinel-2 L2A)
  2. step1 — Generates the products and publishes them to STAC and S3:
    • S2-SR: ARD (co-registered, cloud/shadow masked, topographic corrected Sentinel-2 mosaics)
    • VHI: Vegetation Health Index from the S2-SR NDVI and the MeteoSwiss land surface temperature (LST)

Two deployment environments are supported:

  • DEV — local machine with Python
  • PROD — GitHub Actions, triggered hourly by an external scheduler, with GPU processing on a temporary AWS EC2 runner (see Production Runtime)
  • PROD (local alternative) — the same job as a cron job on a local Linux machine with GPU (see Local Runtime)

Architecture

satromo_processor.py              # Daily orchestration (step0 → step1)
    │
    ├── step0_functions.py        # Check STAC / S3, decide what is ready
    │       └── step0_processors/ # Shared step0 helpers (step0_utils.py)
    │
    ├── step1_processors/         # Product generation: step1_processor_s2_sr.py, step1_processor_vhi.py
    │
    ├── main_functions/           #  STAC utils, S3 helpers
    │
    └── configuration/            # dev_config.py, prod_config.py, ...

check_s2_sr.py                    # Lightweight availability check (CI stage 1)
check_vhi.py                      # Lightweight VHI 'LST missing' check (CI stage 1)
rerun.py                          # Batch reprocessing driver (CI stage 2, GPU EC2)
hourly_runner.sh                  # Local cron alternative to run_rerun.yml
tools/step0_empty_assets.csv      # Live per-date/tile status, committed by CI

util/                             # Manually run tools, not part of the daily pipeline (see util/README.md)
    ├── util_*.py                 # STAC / S3 maintenance and reprocessing scripts
    ├── ref_lst/                  # LST reference data
    ├── ref_ndvi_landsat/         # NDVI reference from Landsat
    ├── ref_ndvi_s2_forest/       # NDVI reference from Sentinel-2 for gap-filled forest VHI (planned)
    ├── vhi_gapfill_forest/       # Gap-filled forest VHI (planned)
    └── vhi_historic_landsat_monthly/  # Historic monthly VHI from Landsat (1991-2015)

The step0_function registered per collection in the config is the callable that produces the data for a date. For S2-SR this is the step1 processor itself (step1_processor_s2_sr.process_product_s2_sr); step0_processors/ holds only shared helper code, not per-collection generators.

PRODUCT_S2_LEVEL_2A and PRODUCT_VHI share the same step0_collection (the swisstopo S2-SR STAC collection). get_step0_dict() groups them under this collection and uses the longest temporal_coverage (7 days, from VHI). When the collection is ready for a date, satromo_processor.py runs S2-SR first and then VHI. Each product is skipped if a STAC item for the date already exists, unless --force / --force-vhi is set.

Full architecture documentation: deepwiki.com/swisstopo/topo-satromo-v2


Installation

Prerequisites

  • Ubuntu Linux 24.04 — the reference and production platform (GitHub runners and the EC2 GPU instance both run 24.04). Windows and macOS are experimental.
  • GDAL 3.11 (command-line tools; the pipeline calls GDAL via subprocess)
  • Python 3.11 or 3.12 (64-bit)
  • pip
  • Virtual environment (strongly recommended)
  • A secrets/ folder with credentials (see Secrets Setup)

1. AROSICS

LINUX — AROSICS Setup

1. Install requirements
pip install -r requirements.txt
2. Install AROSICS
pip install arosics
3. Verify AROSICS
python -c "import arosics; print('AROSICS OK')"
python -c "from osgeo import gdal; print('GDAL OK:', gdal.__version__)"

Windows — AROSICS Setup (EXPERIMENTAL)

AROSICS requires a pre-compiled GDAL wheel on Windows due to C++ build dependencies. Follow the steps in order.

1. Create and activate a virtual environment
python -m venv venv
venv\Scripts\activate
2. Check your Python version
python --version
3. Download and install the GDAL wheel

GDAL must be installed before arosics and before requirements.txt.

  1. Go to: https://github.com/cgohlke/geospatial-wheels/releases
  2. Download the wheel matching your Python version:
    • Python 3.11 → GDAL-X.X.X-cp311-cp311-win_amd64.whl
    • Python 3.12 → GDAL-X.X.X-cp312-cp312-win_amd64.whl
  3. Install it:
pip install path\to\GDAL-X.X.X-cpXXX-cpXXX-win_amd64.whl

The requirements.txt also references a local GDAL wheel at secrets/gdal-*.whl for reproducibility. Place your downloaded wheel there if preferred.

4. Install requirements
pip install -r requirements.txt
5. Install AROSICS
pip install arosics
6. Verify AROSICS
python -c "import arosics; print('AROSICS OK')"
python -c "from osgeo import gdal; print('GDAL OK:', gdal.__version__)"

2. Install HORAYZON

LINUX — HORAYZON Setup with CONDA

Follow the official instructions on the HORAYZON repo

Troubleshooting:

Error Cause Fix
Microsoft Visual C++ 14.0 required GDAL wheel not installed Complete step 3 first
Wrong wheel error Python version mismatch Recheck python --version and download the matching wheel
Import errors after pip install arosics GDAL installed after arosics Reinstall: uninstall both, reinstall GDAL wheel first

LINUX — HORAYZON Setup with PIP

1. Installing HORAYZON Native on Linux
bashsudo apt update

# Intel Embree
sudo apt install -y libembree-dev

# Threading Building Blocks (TBB)
sudo apt install -y libtbb-dev

export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH

the follow Installation without Conda

# Activate your venv
source /path/to/your/venv/bin/activate

# Find Embree headers
find /usr -name "embree4" -type d 2>/dev/null
find /usr -name "rtcore.h" 2>/dev/null

# Find Embree library
find /usr -name "libembree*" 2>/dev/null

# Find TBB
find /usr -name "libtbb*" 2>/dev/null
find /usr -name "tbb" -type d 2>/dev/null

# Paths for Intel Embree and Threading Building Blocks (TBB) are for example
path_include = ["/usr/include/"]
path_lib = ["/usr/lib/x86_64-linux-gnu/libembree4"]  # without file ending

#We need clang++ . if it is missing. Install it:
sudo apt install -y clang

# Clone and enter HORAYZON
git clone https://github.com/ChristianSteger/HORAYZON.git
cd HORAYZON

# Edit setup_manual.py to set the paths above
# path_include = ["/usr/include/"]
# path_lib = ["/usr/lib/x86_64-linux-gnu/libembree4"]
nano setup_manual.py

# Rename and install into the active venv
mv setup_manual.py setup.py
python -m pip install .

After successful isntallation: remove the HORAYZON directory

2. EGM96 Geoid Data Setup

HORAYZON requires EGM96 geoid data for ellipsoidal height correction. By default, HORAYZON attempts to download this data automatically from an external server. To avoid network blocking (e.g. since we donaloda it quite often), copy the data manually into your local assets folder before running the pipeline.

Required file structure:

local_assets/
└── EGM/
    └── EGM96/
        └── WW15MGH.GRD

Copy the EGM96 data into the local_assets/EGM/EGM96/ folder, then register the path with HORAYZON by writing it to its configuration file. Run once in a command prompt (adapt the path to your installation):

Copy the EGM96 data into local_assets/EGM/EGM96/, then register the path:

echo "local_assets/EGM/" > \
  "$(python -c 'import horayzon, os; print(os.path.join(os.path.split(os.path.dirname(horayzon.__file__))[0], "horayzon"))')/path_aux_data.txt"

Example:

echo "local_assets/EGM/" > \
  "/home/user/topo-satromo-v2/.venv/lib/python3.11/site-packages/horayzon/path_aux_data.txt"

Verify the content:

cat "$(python -c 'import horayzon, os; print(os.path.join(os.path.split(os.path.dirname(horayzon.__file__))[0], "horayzon"))')/path_aux_data.txt"

Note: This step is required only once per virtual environment. The path is stored permanently in path_aux_data.txt inside the HORAYZON package directory. If you recreate the virtual environment or move the project, repeat this step.

Windows — HORAYZON Setup (EXPERIMENTAL)

1. Compiling and Installing HORAYZON Native on Windows

Create a wheel file and install it, follow this installation guide Mind the Step Windows DLL

2. EGM96 Geoid Data Setup

HORAYZON requires EGM96 geoid data for ellipsoidal height correction. By default, HORAYZON attempts to download this data automatically from an external server. To avoid network blocking (e.g. since we donaloda it quite often), copy the data manually into your local assets folder before running the pipeline.

Required file structure:

local_assets/
└── EGM/
    └── EGM96/
        └── WW15MGH.GRD

Copy the EGM96 data into the local_assets/EGM/EGM96/ folder, then register the path with HORAYZON by writing it to its configuration file. Run once in a command prompt (adapt the path to your installation):

echo local_assets\EGM\ > "%VIRTUAL_ENV%\Lib\site-packages\horayzon\path_aux_data.txt"

Example:

echo local_assets\EGM\ > "D:\temp\github\topo-satromo-v2\.venv\Lib\site-packages\horayzon\path_aux_data.txt"

Verify the content:

type "%VIRTUAL_ENV%\Lib\site-packages\horayzon\path_aux_data.txt"

Note: This step is required only once per virtual environment. The path is stored permanently in path_aux_data.txt inside the HORAYZON package directory. If you recreate the virtual environment or move the project, repeat this step.

3. WIN / Linux / macOS

LINUX macOS

python -m venv venv
source venv/bin/activate 
pip install -r requirements.txt

WIN

python -m venv venv
venv\Scripts\activate
pip install -r requirements.txt

4. Secrets Setup

secrets (for int):

Create a secrets/ folder in the project root containing (make sure you add this folder to .gitignore):

The exact filenames are defined in the config you run — see FSDI_SECRETS, S3_SECRETS and COPERNICUS_SECRETS at the top of configuration/dev_config.py and configuration/prod_config.py:

Purpose dev_config.py prod_config.py
FSDI STAC API credentials stac_fsdi-int.json stac_fsdi-prod.json
AWS S3 credentials s3_int.json s3_prod.json
Copernicus Open EO credentials copernicus_oed.json copernicus_reprocess.json
(Windows only) Pre-compiled GDAL wheel gdal-X.X.X-cpXXX-win_amd64.whl —

GitHub Actions secrets (for PROD):

Secret name Content
FSDI_STAC_USER FSDI STAC API user
FSDI_STAC_PASSWORD FSDI STAC API password
S3_SECRETS Contents of the AWS S3 credentials JSON
COPERNICUS_S3_SECRETS Contents of the Copernicus S3 credentials JSON
AWS_ACCESS_KEY_ID AWS credentials used to start/stop the EC2 runner
AWS_SECRET_ACCESS_KEY AWS credentials used to start/stop the EC2 runner
GH_PAT Personal access token for the machulav/ec2-github-runner action
EC2_SUBNET_ID_1A / _1B / _1C VPC subnet for the runner in eu-central-1a / 1b / 1c (tried in this order)
EC2_SECURITY_GROUP_ID_1A / _1B / _1C Security group of each subnet, allowing GitHub Actions traffic (same value if same VPC)

GitHub Actions variables (for PROD, repository Variables, not secrets):

Variable name Content
AWS_REGION e.g. eu-central-1
EC2_AMI_ID Pre-configured AMI with GDAL, the venv and local_assets/ (valid in all zones of the region)
EC2_INSTANCE_TYPE GPU instance type, e.g. g4dn.xlarge

Configuration

All configuration files live in the configuration/ folder. The default is dev_config.py.

To use a different config:

python satromo_processor.py my_config.py
# or with a date:
python satromo_processor.py my_config.py 2024-06-12
# or with a date and enforce overwrite:
python satromo_processor.py my_config.py 2024-06-12 --force

Adding a new product

  1. Add a new entry under # A) PRODUCTS, INDICES in your config:
PRODUCT_MY_NEW = {
    "temporal_coverage": 1,
    "product_name": "ch.swisstopo.swisseo_my_product",
    "step0_collection": "https://...",  # STAC URL or s3://...
}
  1. Register it in step0. The step0_function is the callable that generates the data for a single date; for S2-SR this is the step1 processor itself:
step0 = {
    "https://.../my_collection": {
        "step0_function": "step1_processor_my_new.process_product_my_new"
    }
}
  1. In satromo_processor.py, import and call your step1 function:
from step1_processors import step1_processor_my_new

elif product_to_be_processed == 'PRODUCT_MY_NEW':
    result = step1_processor_my_new.process(current_date_str, collection_ready)

Usage

Normal Run

Runs for today's date using dev_config.py:

python satromo_processor.py

Processing a Specific Date

python satromo_processor.py dev_config.py 2024-06-12

Force Reprocessing

Use --force (or -force) to reprocess a date that already has STAC items:

python satromo_processor.py dev_config.py 2024-06-12 --force

--force reprocesses all products of the date, including S2-SR (download, co-registration on the GPU). To reprocess only VHI, use --force-vhi: S2-SR is then only processed if it does not exist yet for the date.

python satromo_processor.py dev_config.py 2024-06-12 --force-vhi

Debug Mode

When no date argument is supplied, the script enters debug mode and uses a hardcoded date. Edit satromo_processor.py to change it:

if debug_mode:
    current_date_str = "2024-05-01"
    force_reprocess = True   # <-- toggle manually (S2-SR and VHI)
    force_vhi = True         # <-- toggle manually (VHI only)

For VHI tests on a small area, set roi in the PRODUCT_VHI branch of satromo_processor.py (examples are in the comments there); roi = None is the operational setting (all of Switzerland).

Manual Reprocessing Workflow (local → PROD)

For dates that failed in production:

REM 1. Activate venv
venv\Scripts\activate

REM 2. Run processor for the target date
python satromo_processor.py prod_config.py 2024-06-12

REM    or reprocess an existing date (S2-SR and VHI), or only VHI
python satromo_processor.py prod_config.py 2024-06-12 --force
python satromo_processor.py prod_config.py 2024-06-12 --force-vhi

Before reprocessing, also:

  • Delete the affected STAC items if needed (util/util_stac_delete.py)
  • Remove the date entry from tools/step0_empty_assets.csv if present

Production Runtime (GitHub Actions + EC2)

Production runs from a single workflow, .github/workflows/run_rerun.yml ("Run S2-SR and VHI Processor"). It is deliberately split into a cheap availability check on a GitHub-hosted runner and an expensive GPU stage on a temporary AWS EC2 runner that is started only when there is something to process and always stopped afterwards.

Trigger: external hourly scheduler (cron-job.org)

The workflow exposes only workflow_dispatch; the schedule: block in the YAML is intentionally commented out. GitHub Actions cron does not fire reliably on the hour, so the hourly trigger comes from an external scheduler at https://cron-job.org/, which calls the GitHub API to dispatch the workflow once per hour.

Background: Sentinel-2 often delivers two passes/orbits per day and both are usually incomplete on first arrival, so the pipeline polls hourly rather than once per day. The relevant processing window is roughly 23 UTC through 11 UTC.

A concurrency group (repo-actions) ensures runs do not overlap — a new trigger queues behind the running one instead of cancelling it, because every stage commits tools/ back to main.

Stages

Stage Job Runner What it does
1 check-and-update ubuntu-24.04 (hosted) util/util_get_acquisition_plans.py, then python check_s2_sr.py $(date +%Y-%m-%d) 30 prod_config.py and python check_vhi.py $(date +%Y-%m-%d) 30 prod_config.py; publishes acquisitionplan.csv / step0_empty_assets.csv as collection assets (util/util_upload_collection_asset.py) and pushes tools/ back to main. Sets the outputs needs-processing, vhi-needs-processing and vhi-reprocess-dates.
2a start-ec2 ubuntu-24.04 (hosted) Only if needs-processing == 'true' or vhi-needs-processing == 'true': starts a GPU EC2 self-hosted runner via machulav/ec2-github-runner. Tries the availability zones 1a, 1b and 1c in this order (if a zone has no capacity for the instance type).
2b run-processing EC2 GPU runner Symlinks /home/ubuntu/local_assets, activates /home/ubuntu/.venv, installs requirements.txt, checks the DuckDB spatial extension (needed by gpio for the GeoParquet warn regions), runs python rerun.py prod_config.py with VHI_REPROCESS_DATES, republishes the CSVs and pushes tools/. If rerun.py reports failed dates, the last step marks the run as failed (GitHub sends an email). Hard timeout 420 minutes for cost protection.
2c stop-ec2 ubuntu-24.04 (hosted) if: always() — terminates the EC2 runner even when stage 2b failed or timed out.

The production scripts

  • check_s2_sr.py — lightweight Copernicus STAC availability check. It queries the Copernicus STAC API for Switzerland and updates tools/step0_empty_assets.csv, marking dates as Tiles ready awaiting GPU system run. Besides the target date it re-checks historical CSV entries within the lookback window whose remark is No candidate scene, Tile upload incomplete: [...] or Tile download incomplete. Usage: python check_s2_sr.py [YYYY-MM-DD] [days_back] [config.py] (defaults: today, 30 days, dev_config.py).

  • check_vhi.py — lightweight VHI check, runs after check_s2_sr.py.

    • VHI rows LST missing and No S2-SR scene in time window in the lookback window: removed when VHI is already published; VHI is processed when the LST is available and the VHI time window has S2-SR data (no incomplete S2-SR date).
    • Published VHI that misses S2-SR data published later (delayed S2-SR): VHI of a date is reprocessed when an S2-SR item of its time window is not in NDVI_INDEX_LIST of the VHI metadata json and was published (STAC created) after the VHI item (STAC updated). A count comparison does not work: the VHI processor stops early once all pixels are filled, so NDVI_INDEX_LIST often lists fewer items than the window has.

    Outputs: vhi-needs-processing (start the GPU stage) and vhi-reprocess-dates (comma separated, passed to rerun.py as environment variable VHI_REPROCESS_DATES). Usage: python check_vhi.py [YYYY-MM-DD] [days_back] [config.py] (defaults: today, 30 days, dev_config.py).

  • rerun.py — batch reprocessing driver for the GPU stage. It picks up all queued entries from tools/step0_empty_assets.csv (30 days back) and runs the full pipeline per date. Usage: python rerun.py [config.py] (default dev_config.py). It backs the CSV up to .bak and restores it on a fatal error. Then it retries the VHI rows LST missing / No S2-SR scene in time window, and reprocesses VHI (--force-vhi) for the dates in VHI_REPROCESS_DATES. It always exits 0; failed dates are reported in the outputs rerun-failed / rerun-failures and stay queued for the next run.

tools/step0_empty_assets.csv is the live state file that couples the two stages; CI commits it to main after every run, so avoid editing it by hand.


Local Runtime (cron job, hourly_runner.sh)

hourly_runner.sh is the local alternative to .github/workflows/run_rerun.yml. It does the same steps, but rerun.py runs on the local machine instead of on an EC2 runner:

  1. Update the code — fetches, checks out and pulls the branch. Changes in tools/ left over from a run that stopped early are committed and pushed first. pip install -r requirements.txt runs only when requirements.txt changed.
  2. Light check (Stage 1) — util_get_acquisition_plans.py, check_s2_sr.py and check_vhi.py (today in UTC, 30 days back), then uploads the collection assets and pushes tools/.
  3. Processing (Stage 2) — only if needs-processing or vhi-needs-processing is true: rerun.py (maximum 14 hours, RERUN_TIMEOUT), then uploads the collection assets and pushes tools/ again.

A lock (flock) makes sure only one run happens at a time: if rerun.py from an earlier run is still going, the new run stops right away.

Usage

./hourly_runner.sh <config> <branch>
./hourly_runner.sh prod_config.py main     # defaults

The paths are set at the top of the script (REPO_DIR, PYTHON_CMD, LOCK_FILE). REPO_DIR is a separate checkout of this repository, only for the cron job, with its own .venv, secrets/ and local_assets/ (see Installation).

Setup

1. Clean checkout. The script stops with an error if any file outside tools/ has local changes, so nothing is lost by the checkout:

cd /path/to/REPO_DIR
git status

2. Git credentials for the push. cron cannot ask for a password, so the push needs saved credentials. The key or token belongs to your own GitHub account; it works for swisstopo/topo-satromo-v2 because your account has write access to that repository.

Option A — SSH key (recommended): no token in a text file, no expiry, no approval by the organisation needed.

  1. Create a key without passphrase (cron cannot type one), as the same user that runs the cron job:

    ssh-keygen -t ed25519 -C "satromo cron" -N "" -f ~/.ssh/id_ed25519
    cat ~/.ssh/id_ed25519.pub     # copy this line
    
  2. Add the copied line at https://github.com/settings/keys → New SSH key (key type Authentication Key). If swisstopo uses single sign-on, click Configure SSO → Authorize for swisstopo next to the key.

  3. Switch the checkout of the cron job to SSH and test:

    cd /path/to/REPO_DIR
    git remote set-url origin git@github.com:swisstopo/topo-satromo-v2.git
    ssh -T git@github.com              # "Hi <your login>! You've successfully authenticated"
    git push --dry-run origin main     # must not ask for anything
    

    The first ssh -T asks once to confirm the GitHub host key: answer yes.

Option B — token (HTTPS):

  • Create a GitHub token at https://github.com/settings/personal-access-tokens (fine-grained, Resource owner: swisstopo — not your own account —, repository topo-satromo-v2, permission Contents: Read and write). The token belongs to your account; it works because your account has write access to the swisstopo repository. The organisation may have to approve the token.

  • Save it with the store credential helper, as the same user that runs the cron job:

    git config --global credential.helper store
    cd /path/to/REPO_DIR
    git push --dry-run origin main   # username: your GitHub login, password: the token
    chmod 600 ~/.git-credentials
    

    The token is now in ~/.git-credentials (plain text, readable only by you). Run git push --dry-run origin main again: it must not ask for anything.

Option C — GitHub CLI: install the GitHub CLI and run gh auth login, then gh auth setup-git.

3. Test run by hand (pushes to the branch and uploads to STAC):

./hourly_runner.sh prod_config.py main

4. Cron job (crontab -e). cron uses the local time of the machine. With Europe/Zurich, hours 0–13 cover 23–11 UTC in winter and summer, the same window as the GitHub workflow:

17 0-13 * * * /path/to/REPO_DIR/hourly_runner.sh prod_config.py main >> /path/to/hourly_runner.log 2>&1

Note: Do not run the cron job and the GitHub workflow on the same branch at the same time — both push tools/step0_empty_assets.csv.


Products

Config key Product name Description
PRODUCT_S2_LEVEL_2A ch.swisstopo.swisseo_s2-sr_v200 Sentinel-2 L2A ARD — co-registered, cloud masked, all bands
PRODUCT_VHI ch.swisstopo.swisseo_vhi_v200 Vegetation Health Index (drought stress), 10 m, forest and all vegetation

PRODUCT_MSG_CLIMA in the config is only used for reprocessing (it has no step0_collection, so the daily run does not use it).

VHI

step1_processors/step1_processor_vhi.py calculates the VHI for a date from a 7-day window (temporal_coverage):

Input Source (PRODUCT_VHI in the config)
Current NDVI swissEO S2-SR items of the time window (step0_collection)
Current LST MeteoSwiss land surface temperature (LST_current_data)
NDVI reference 1991–2020 S3 (NDVI_reference_data)
LST reference 2004–2020 S3 (LST_reference_data)
Forest and vegetation masks local_assets/, else S3 (vegetation_masks)

Steps: NDVI → VCI (with the NDVI reference) and LST → TCI (with the LST reference), VCI and TCI → VHI, then masked for forest and for all vegetation.

Outputs per date (published to the VHI STAC collection and S3):

  • swisseo_vhi_v200_mosaic_<date>_forest-10m.tif and ..._vegetation-10m.tif (values 0–100, missing_data = 110, no_data = 255)
  • Warn regions for forest and vegetation (assets/warnregionen_vhi_2056.shp) as .csv, .geojson and .parquet
  • Thumbnail and metadata JSON (includes NDVI_INDEX_LIST, the S2-SR items used)

If an input is not there yet, VHI writes a row to tools/step0_empty_assets.csv with the remark LST missing or No S2-SR scene in time window. check_vhi.py and rerun.py retry these dates in the hourly runs.

The historic monthly VHI from Landsat (1991–2015) is not part of the daily run: see util/vhi_historic_landsat_monthly/ (uses PRODUCT_VHI_HIST in dev_config.py).

Sentinel-2 band groups:

Resolution Bands
10 m B02 (Blue), B03 (Green), B04 (Red), B08 (NIR), CLOUDMASK
20 m B05–B07, B8A, B11, B12, SCL
60 m B01, B09, AOT

Roadmap

  • Sentinel-2 L2A ARD (co-registered, cloud/shadow masked)
  • STAC catalog integration (step0 + publish)
  • Co-registration via AROSICS
  • --force CLI flag for reprocessing
  • S3 + FSDI STAC publishing
  • Vegetation Health Index (VHI) — operational
  • Gap-filled VHI for forest (util/vhi_gapfill_forest/)
  • NDVI anomalies (N1, N2)
  • NDMI anomalies (M1)
  • NBR natural disturbance index (B2)

Contributing

Contributions are welcome! Please:

  1. Fork the project
  2. Create a feature branch: git checkout -b feature/my-feature
  3. Commit your changes: git commit -m 'Add my feature'
  4. Push: git push origin feature/my-feature
  5. Open a Pull Request

License

Distributed under the BSD-3-Clause License. See LICENSE.txt for details.


Credits

Special thanks to the developers and maintainers of the open-source projects that made this work possible:

  • AROSICS: An Automated and Robust Open-Source Image Co-Registration Software developed by the GFZ German Research Centre for Geosciences. We utilize AROSICS specifically for aligning our raw satellite datasets.
  • OmniCloudMask: An open-source tool developed by DPIRD-DMA. We utilize OmniCloudMask for generating robust cloud and shadow masks for our raw satellite imagery.
  • HORAYZON: An open-source terrain analysis and horizon computation tool developed by Christian Steger. We utilize HORAYZON for calculating terrain incindence angles and topographic induced shadows to support accurate modelling of terrain-related effects in our geospatial analyses.

Contact

David Oesch — david.oesch[at]swisstopo.ch
Joan Sturm — joan.sturm[at]swisstopo.ch

Project: github.com/swisstopo/topo-satromo-v2