muend.
Remote sensing · Reproducible data pipeline

sentinel-crop-pipeline

A reproducible Sentinel-2 data preparation pipeline for crop-classification research, where every discarded pixel is accounted for.

Zenodo DOIApache-2.0BetaCDSE
LicenseApache-2.0
Packagepip install sentinel-crop-pipeline
DOI10.5281/zenodo.21284444
StatusBeta research software
SourceCopernicus Data Space Ecosystem · Sentinel-2 L2A
BandsB02, B03, B04, B08 + derived MASK
ConfigYAML, one file per run
Why

The dataset is the experiment

Most of the reproducibility problem in remote-sensing machine learning sits upstream of the model. Which scenes were selected and why, how many pixels the cloud mask removed, whether two patches from the same field ended up on opposite sides of the split — these decisions determine the result, and they are usually undocumented.

This pipeline treats them as first-class outputs. Every stage writes a timestamped JSON summary, and the patch manifest records the split assignment and invalid-pixel percentage of every patch.

Fig. 01

Five stages, each one auditable

Stages run individually or as sentinel-crop run-all. The illustrations show what each stage does to the data, not what it is called.

Fig. 01 / Sentinel-2 data lineage
SENTINEL-2 / REPRODUCIBLE DATA LINEAGE SHEET C-03 · L2A · AOI-CROPPED 01 / ACQUIRE 02 / MASK 03 / DERIVE 04 / SPLIT 05 / EXPORT AOI FOOTPRINT VALID CLOUD SHADOW REFLECTANCE → INDEX NDVI NDRE TRAIN VALID TEST TRAINING ARTIFACT COG / TIFF NPY TFRECORD CDSE + AOI CROPSAFE · L2A SCENE SCL QUALITY MASKCLOUD · SHADOW · SNOW SPECTRAL INDICESNDVI · NDRE · STACK SPATIAL BLOCKINGLEAKAGE-AWARE SPLIT VERSIONED EXPORTCOG · NPY · TFRECORD ACCOUNTING REPORT / DISCOVERED → DOWNLOADED → MASKED → PATCHED → SPLIT · EVERY LOSS IS COUNTED
Stages

What each command produces

discover01

STAC search with deterministic scene selection; writes per-scene accept and reject decisions.

download02

AOI-cropped retrieval through the CDSE Process API rather than whole tiles.

preprocess03

SCL masking, reflectance normalisation, NDVI / NDRE / NDWI where bands allow.

patch04

Fixed-size patches with spatially blocked train, validation and test assignment.

label05

Rasterises externally prepared ground-truth polygons into uint8 masks.

Whole grid blocks are assigned to a single split, which reduces the spatial autocorrelation that makes random splits flatter the model.

Outputs

The audit trail is part of the deliverable

  • logs/run_<stage>_<timestamp>.json — per-stage summaries.
  • logs/selection_results.json — why each scene was kept or dropped.
  • data/patches/index.csv — the patch manifest: split, paths, invalid percentage.
  • data/patches/cog/ — georeferenced GeoTIFFs you can open and look at.
  • Training exports as COG/TIFF, NPY, and optional TFRecord.

A validated live run over an Urla area of interest produced 990 training patches from 9 Sentinel-2 L2A scenes in June 2025.

Limitations

The interim Urla AOI is a rectangle, not an official boundary. Spatial blocks reduce leakage but do not eliminate it where fields cross block edges. The label stage requires externally prepared ground-truth polygons; nothing is downloaded automatically. And the pipeline prepares data — it makes no claim about downstream model accuracy.

Open to collaboration

Build spatial systems that hold up.

© 2026 Muhammed Enes Duran Static site · no trackers
Technical diagram