# swisstopo/topo-satromo-v2 architecture

> Architecture diagram of the GitHub repository swisstopo/topo-satromo-v2, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/swisstopo/topo-satromo-v2
- Repository: https://github.com/swisstopo/topo-satromo-v2

## Overview

SATROMO v2 is a satellite-imagery ETL pipeline that checks input availability, processes Sentinel-2 into analysis-ready products and vegetation indices, then publishes outputs to STAC. The main documented workflow is daily orchestration through step0 readiness checks and step1 product generation; S2-SR processing includes coregistration, mosaicing, cloud masking, terrain correction, and publication, while VHI is a separate index product. Groups also preserve the pipeline’s configuration, processing components, and catalog/publishing capabilities. Some internal calls are not visible in the excerpts, so those relationships are omitted or marked unverified.

Main entry points: [`step1_processors/step1_processor_s2_sr.py`](https://github.com/swisstopo/topo-satromo-v2/blob/main/step1_processors/step1_processor_s2_sr.py) (S2-SR generator), [`satromo_processor.py`](https://github.com/swisstopo/topo-satromo-v2/blob/main/satromo_processor.py) (Daily runner), [`step0_functions.py`](https://github.com/swisstopo/topo-satromo-v2/blob/main/step0_functions.py) (Availability checks), [`main_functions/main_utils.py`](https://github.com/swisstopo/topo-satromo-v2/blob/main/main_functions/main_utils.py) (Processing utilities)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_orchestration["Pipeline orchestration"]
  node_daily["Daily runner"]
  node_availability["Availability checks<br/>[step0_functions.py]"]
  node_step0helpers["Step0 helpers<br/>[step0_utils.py]"]
  node_config["Environment and products<br/>[dev_config.py]"]
end

subgraph group_products["Product generation"]
  node_s2["S2-SR generator"]
  node_vhi["VHI generator"]
end

subgraph group_processing["Imagery processing"]
  node_coreg["Coregistration"]
  node_reprojection["Reprojection"]
  node_mosaicing["Mosaicing<br/>[main_mosaicing.py]"]
  node_cloudmask["Cloud masking"]
  node_cloudstats["Cloud percentage"]
  node_terrain["Terrain correction"]
  node_terrainparallel["Parallel terrain"]
  node_terrainworker["Terrain worker<br/>[_terrain_worker.py]"]
  node_rgb["RGB rendering<br/>[main_create_rgb.py]"]
  node_thumbnails["Thumbnail generation<br/>[main_thumbnails.py]"]
  node_warnings["Warning regions"]
  node_utilities["Processing utilities<br/>[main_utils.py]"]
end

subgraph group_publishing["Catalog and publishing"]
  node_publisher["STAC publisher"]
  node_multipart["Asset upload"]
  node_csplus["CS+ publishing<br/>[csplus_publish.py]"]
end

node_scheduler(("Scheduler"))
node_stac[("STAC catalog")]
node_s3[("S3 storage")]

node_scheduler -->|"triggers"| node_daily
node_daily -->|"runs checks"| node_availability
node_daily -->|"runs products"| node_s2
node_daily -->|"runs products"| node_vhi
node_availability -.->|"uses helper"| node_step0helpers
node_availability -->|"uses"| node_utilities
node_availability -->|"dispatches generation"| node_s2
node_s2 -.->|"reads settings"| node_config
node_s2 -.->|"uses"| node_coreg
node_s2 -.->|"uses"| node_reprojection
node_s2 -.->|"uses"| node_mosaicing
node_s2 -.->|"uses"| node_cloudmask
node_s2 -.->|"uses"| node_cloudstats
node_s2 -.->|"uses"| node_terrain
node_s2 -.->|"uses"| node_terrainparallel
node_s2 -.->|"uses"| node_rgb
node_s2 -.->|"uses"| node_thumbnails
node_s2 -.->|"uses"| node_publisher
node_vhi -->|"publishes with"| node_publisher
node_publisher -.->|"uploads assets"| node_multipart
node_publisher -->|"writes items"| node_stac
node_terrainworker -->|"invokes"| node_terrainparallel
node_terrainparallel -.->|"uses"| node_terrain
node_csplus -.->|"uses"| node_utilities
node_utilities -.->|"reads or writes"| node_s3
node_utilities -.->|"queries"| node_stac

click node_daily "https://github.com/swisstopo/topo-satromo-v2/blob/main/satromo_processor.py"
click node_availability "https://github.com/swisstopo/topo-satromo-v2/blob/main/step0_functions.py"
click node_step0helpers "https://github.com/swisstopo/topo-satromo-v2/blob/main/step0_processors/step0_utils.py"
click node_config "https://github.com/swisstopo/topo-satromo-v2/blob/main/configuration/dev_config.py"
click node_s2 "https://github.com/swisstopo/topo-satromo-v2/blob/main/step1_processors/step1_processor_s2_sr.py"
click node_vhi "https://github.com/swisstopo/topo-satromo-v2/blob/main/step1_processors/step1_processor_vhi.py"
click node_coreg "https://github.com/swisstopo/topo-satromo-v2/blob/main/main_functions/main_coregistration.py"
click node_reprojection "https://github.com/swisstopo/topo-satromo-v2/blob/main/main_functions/main_reprojection.py"
click node_mosaicing "https://github.com/swisstopo/topo-satromo-v2/blob/main/main_functions/main_mosaicing.py"
click node_cloudmask "https://github.com/swisstopo/topo-satromo-v2/blob/main/main_functions/main_omnicloudmask.py"
click node_cloudstats "https://github.com/swisstopo/topo-satromo-v2/blob/main/main_functions/main_cloudpercentage.py"
click node_terrain "https://github.com/swisstopo/topo-satromo-v2/blob/main/main_functions/main_terrain_module.py"
click node_terrainparallel "https://github.com/swisstopo/topo-satromo-v2/blob/main/main_functions/main_terrain_parallel.py"
click node_terrainworker "https://github.com/swisstopo/topo-satromo-v2/blob/main/main_functions/_terrain_worker.py"
click node_rgb "https://github.com/swisstopo/topo-satromo-v2/blob/main/main_functions/main_create_rgb.py"
click node_thumbnails "https://github.com/swisstopo/topo-satromo-v2/blob/main/main_functions/main_thumbnails.py"
click node_warnings "https://github.com/swisstopo/topo-satromo-v2/blob/main/main_functions/main_extract_warnregions.py"
click node_utilities "https://github.com/swisstopo/topo-satromo-v2/blob/main/main_functions/main_utils.py"
click node_publisher "https://github.com/swisstopo/topo-satromo-v2/blob/main/main_functions/main_publish_stac_fsdi.py"
click node_multipart "https://github.com/swisstopo/topo-satromo-v2/blob/main/main_functions/main_multipart_upload_via_api.py"
click node_csplus "https://github.com/swisstopo/topo-satromo-v2/blob/main/main_functions/csplus_publish.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_daily,node_availability,node_step0helpers,node_config toneBlue
class node_s2,node_vhi,node_stac,node_s3 toneAmber
class node_coreg,node_reprojection,node_mosaicing,node_cloudmask,node_cloudstats,node_terrain,node_terrainparallel,node_terrainworker,node_rgb,node_thumbnails,node_warnings,node_utilities toneMint
class node_publisher,node_multipart,node_csplus,node_scheduler toneRose
```

## Components

### Pipeline orchestration

- [Daily runner](https://github.com/swisstopo/topo-satromo-v2/blob/main/satromo_processor.py): `satromo_processor.py`
- [Availability checks](https://github.com/swisstopo/topo-satromo-v2/blob/main/step0_functions.py): `step0_functions.py`
- [Step0 helpers](https://github.com/swisstopo/topo-satromo-v2/blob/main/step0_processors/step0_utils.py): `step0_processors/step0_utils.py`
- [Environment and products](https://github.com/swisstopo/topo-satromo-v2/blob/main/configuration/dev_config.py): `configuration/dev_config.py`

### Product generation

- [S2-SR generator](https://github.com/swisstopo/topo-satromo-v2/blob/main/step1_processors/step1_processor_s2_sr.py): `step1_processors/step1_processor_s2_sr.py`
- [VHI generator](https://github.com/swisstopo/topo-satromo-v2/blob/main/step1_processors/step1_processor_vhi.py): `step1_processors/step1_processor_vhi.py`

### Imagery processing

- [Coregistration](https://github.com/swisstopo/topo-satromo-v2/blob/main/main_functions/main_coregistration.py): `main_functions/main_coregistration.py`
- [Reprojection](https://github.com/swisstopo/topo-satromo-v2/blob/main/main_functions/main_reprojection.py): `main_functions/main_reprojection.py`
- [Mosaicing](https://github.com/swisstopo/topo-satromo-v2/blob/main/main_functions/main_mosaicing.py): `main_functions/main_mosaicing.py`
- [Cloud masking](https://github.com/swisstopo/topo-satromo-v2/blob/main/main_functions/main_omnicloudmask.py): `main_functions/main_omnicloudmask.py`
- [Cloud percentage](https://github.com/swisstopo/topo-satromo-v2/blob/main/main_functions/main_cloudpercentage.py): `main_functions/main_cloudpercentage.py`
- [Terrain correction](https://github.com/swisstopo/topo-satromo-v2/blob/main/main_functions/main_terrain_module.py): `main_functions/main_terrain_module.py`
- [Parallel terrain](https://github.com/swisstopo/topo-satromo-v2/blob/main/main_functions/main_terrain_parallel.py): `main_functions/main_terrain_parallel.py`
- [Terrain worker](https://github.com/swisstopo/topo-satromo-v2/blob/main/main_functions/_terrain_worker.py): `main_functions/_terrain_worker.py`
- [RGB rendering](https://github.com/swisstopo/topo-satromo-v2/blob/main/main_functions/main_create_rgb.py): `main_functions/main_create_rgb.py`
- [Thumbnail generation](https://github.com/swisstopo/topo-satromo-v2/blob/main/main_functions/main_thumbnails.py): `main_functions/main_thumbnails.py`
- [Warning regions](https://github.com/swisstopo/topo-satromo-v2/blob/main/main_functions/main_extract_warnregions.py): `main_functions/main_extract_warnregions.py`
- [Processing utilities](https://github.com/swisstopo/topo-satromo-v2/blob/main/main_functions/main_utils.py): `main_functions/main_utils.py`

### Catalog and publishing

- [STAC publisher](https://github.com/swisstopo/topo-satromo-v2/blob/main/main_functions/main_publish_stac_fsdi.py): `main_functions/main_publish_stac_fsdi.py`
- [Asset upload](https://github.com/swisstopo/topo-satromo-v2/blob/main/main_functions/main_multipart_upload_via_api.py): `main_functions/main_multipart_upload_via_api.py`
- [CS+ publishing](https://github.com/swisstopo/topo-satromo-v2/blob/main/main_functions/csplus_publish.py): `main_functions/csplus_publish.py`

### Other components

- **Scheduler**
- **STAC catalog**
- **S3 storage**

## Connections

- Scheduler → Daily runner: triggers
- Daily runner → Availability checks: runs checks (evidence: `satromo_processor.py`)
- Daily runner → S2-SR generator: runs products (evidence: `satromo_processor.py`)
- Daily runner → VHI generator: runs products (evidence: `satromo_processor.py`)
- Availability checks → Step0 helpers: uses helper
- Availability checks → Processing utilities: uses (evidence: `step0_functions.py`)
- Availability checks → S2-SR generator: dispatches generation
- S2-SR generator → Environment and products: reads settings
- S2-SR generator → Coregistration: uses (evidence: `step1_processors/step1_processor_s2_sr.py`)
- S2-SR generator → Reprojection: uses (evidence: `step1_processors/step1_processor_s2_sr.py`)
- S2-SR generator → Mosaicing: uses (evidence: `step1_processors/step1_processor_s2_sr.py`)
- S2-SR generator → Cloud masking: uses (evidence: `step1_processors/step1_processor_s2_sr.py`)
- S2-SR generator → Cloud percentage: uses (evidence: `step1_processors/step1_processor_s2_sr.py`)
- S2-SR generator → Terrain correction: uses (evidence: `step1_processors/step1_processor_s2_sr.py`)
- S2-SR generator → Parallel terrain: uses (evidence: `step1_processors/step1_processor_s2_sr.py`)
- S2-SR generator → RGB rendering: uses (evidence: `step1_processors/step1_processor_s2_sr.py`)
- S2-SR generator → Thumbnail generation: uses (evidence: `step1_processors/step1_processor_s2_sr.py`)
- S2-SR generator → STAC publisher: uses (evidence: `step1_processors/step1_processor_s2_sr.py`)
- VHI generator → STAC publisher: publishes with (evidence: `step1_processors/step1_processor_vhi.py`)
- STAC publisher → Asset upload: uploads assets (evidence: `main_functions/main_publish_stac_fsdi.py`)
- STAC publisher → STAC catalog: writes items (evidence: `main_functions/main_publish_stac_fsdi.py`)
- Terrain worker → Parallel terrain: invokes (evidence: `main_functions/_terrain_worker.py`)
- Parallel terrain → Terrain correction: uses (evidence: `main_functions/main_terrain_parallel.py`)
- CS+ publishing → Processing utilities: uses (evidence: `main_functions/csplus_publish.py`)
- Processing utilities → S3 storage: reads or writes
- Processing utilities → STAC catalog: queries
