Serve your L1B data as ortho images and embeddings#
This guide sets up a GeoNeMo development stack that serves your own Sentinel-2 L1B granules in two ways:
Ortho images: surface-reflectance GeoTIFFs and JPEG previews of any window of a granule, computed on a GPU when requested. Nothing is stored.
Embeddings: 128-pixel chips encoded with Clay v1.5 and stored in Milvus, so you can find chips that look like a chosen one.
You prepare the granules once, and both use the same prepared inputs. The Find similar Sentinel-2 chips from L1B data shows the embedding half with a synthetic table, and On-demand ortho images from Sentinel-2 L1B describes the ortho service.
The result is surface reflectance from a fixed Sen2Cor atmosphere preset and a fixed visibility. It is not ESA’s operational L2A, and there is no cloud mask.
Contents#
Check the prerequisites
Get the code and build the images
Arrange your L1B data
Prepare the granules
Make the embeddings
Start the stack
Load the embeddings
Register the granules for ortho images
Use it
Stop or reset
Troubleshooting
Limits
1. Check the prerequisites#
Need |
Detail |
|---|---|
Linux host with an NVIDIA GPU |
x86-64 or ARM64 (for example Grace). CUDA 13 driver. One GPU is enough. The ortho service reserves one GPU while the stack runs |
Docker |
Compose v2, BuildKit ( |
Python 3.12 and uv |
uv 0.12.5 is the version CI uses |
git |
A full clone, not shallow |
Source access |
A clone of the GeoNeMo repository, and read access to the cuGeo repository ( |
Internet |
PyPI, npm, Docker Hub, NVIDIA NGC and Hugging Face (the Clay checkpoint, downloaded on first use) |
Disk |
Your corpus, plus about 15 MB per extracted granule, 26 MB per DEM cell, and about 5 GB for the model and GPU kernel cache |
If you share the host with someone else’s GeoNeMo development stack, don’t run
dev.sh there. It uses a fixed compose project (geonemo-services-dev), fixed ports
and the geonemo-services:local image, so it would replace their stack. Use a host of
your own.
2. Get the code and build the images#
Clone GeoNeMo and enter the repository.
git clone https://github.com/NVIDIA/geonemo.git geonemo
cd geonemo
Set up the workspace and prepare the server’s local skills catalog.
uv sync --locked --all-packages --extra dev --python 3.12
sh ci/prepare-public-skills.sh
Build the L1B image with build-l1b-image.sh in packs/sentinel/examples/l1b-similarity/. It holds the GPU pipeline and cuGeo’s native L1B libraries.
The builder uses the latest cuGeo main from https://github.com/NVIDIA/cugeo.git.
Both images use the same checkout. The build targets GPU 0’s architecture. Pass
--arch 90 (for example) to choose another.
cd packs/sentinel/examples/l1b-similarity
./build-l1b-image.sh
cd -
The result is geonemo-l1b-pipeline:local. The server images are built later, by
dev.sh up --build. Every image is built for the host’s own architecture, so the same
commands work on x86-64 and ARM64 hosts.
3. Arrange your L1B data#
The preparation script reads one folder in a fixed layout, called a corpus here. Put everything under one data root, because every container mounts that root read-only at the same path. This guide uses these names:
Variable |
Example |
Holds |
|---|---|---|
|
|
Everything below |
|
|
Your L1B, L1C and auxiliary data |
|
|
Prepared inputs (written in section 4) |
|
|
Sen2Cor LUTs for your spacecraft |
|
|
The embedding table (written in section 5) |
export DATA=/data/l1b
export CORPUS=$DATA/corpus
export WORK=$DATA/work
export VECTORS=$DATA/vectors
Corpus layout#
corpus/
├── worklists/
│ ├── ortho.jsonl
│ └── surface.jsonl
├── inputs/
│ ├── l1b/granules/*.tar
│ ├── l1b/datastrips/*.tar
│ └── l1c/*.SAFE/
└── auxiliary/
├── dem/*.tif
├── geoid/*.tif
└── gipp/
Path |
Contents |
|---|---|
|
One tar per L1B granule ( |
|
One tar per datastrip ( |
|
The L1C products of the same acquisition, unpacked as |
|
Copernicus GLO-30 DEM tiles, named |
|
One EGM2008 geoid GeoTIFF, for example |
|
The spacecraft’s GIPP files from your L1B source. Our reference corpus had |
worklists/ortho.jsonl#
This file has one JSON object per line, one per granule. Paths are relative to the corpus root.
Field |
Example |
|---|---|
|
|
|
|
|
|
|
A GeoJSON Polygon in longitude, latitude: |
|
|
|
|
|
Any name for this corpus, the same on every line |
worklists/surface.jsonl#
This file has one line per L1C tile.
Field |
Example |
|---|---|
|
|
|
|
|
The matching L2A |
|
|
|
The same name as in |
Each granule is processed on the L1C tile whose 10 m grid contains its whole footprint. A granule that no single tile contains is skipped.
Sen2Cor LUTs#
Download the Sen2Cor 02.12.04 Linux installer from ESA’s Sen2Cor page and unpack it without running it:
sh Sen2Cor-02.12.04-Linux64.run --noexec \
--target $DATA/sen2cor-02.12.04
export LUTS=$DATA/sen2cor-02.12.04/lib/python2.7/site-packages/sen2cor/lib_S2B
Use lib_S2A, lib_S2B or lib_S2C to match your spacecraft. They aren’t
interchangeable.
Permissions#
The containers run as UID 10001. Make everything under DATA readable by it, and
create the output folders writable:
chmod -R a+rX $DATA
mkdir -p $VECTORS $DATA/pipeline-work $DATA/cache
chmod 777 $VECTORS $DATA/pipeline-work $DATA/cache
4. Prepare the granules#
packs/sentinel/scripts/prepare_l1b_ortho.py extracts each granule and its datastrip, converts the DEM
cells to the format cuGeo reads, and writes one cuGeo input per band. It also writes
l1b.json, the index both the ortho service and the embedding pipeline read. It needs
rasterio, which the server environment from section 2 has.
Start with a few granules:
.venv/bin/python packs/sentinel/scripts/prepare_l1b_ortho.py \
--dataset $CORPUS --work $WORK \
--lut-library $LUTS --limit 5
Use --granule NAME (repeatable) instead of --limit to choose granules. Rerunning
adds granules to the same l1b.json; re-preparing a granule replaces its ten band
inputs only when all of them succeed.
Option |
Default |
Meaning |
|---|---|---|
|
|
Sen2Cor preset: mid-latitude summer, rural, water vapour 2.0 |
|
|
Fixed visibility, 5 to 120 |
|
|
|
The script prints prepared NAME or skipped NAME: reason for each granule. Only
prepared granules are in $WORK/l1b.json; $WORK/granules.json holds their public
facts for the catalog (section 8).
chmod -R a+rX $WORK
5. Make the embeddings#
Run the pipeline once per prepared granule. Don’t pass the whole $WORK/granules
folder: it also holds the extracted granules that were skipped, and the pipeline stops
on the first one that isn’t in l1b.json. All runs append to one table.
GRANULES=$(python3 -c 'import json, sys
print(*json.load(open(sys.argv[1]))["products"])' $WORK/l1b.json)
for G in $GRANULES; do
docker run --rm --gpus device=0 --shm-size=2g \
--mount type=bind,src=$DATA,dst=$DATA,readonly \
--mount type=bind,src=$VECTORS,dst=/out \
--mount type=bind,src=$DATA/pipeline-work,dst=/work \
--mount type=bind,src=$DATA/cache,dst=/home/pipeline/.cache \
geonemo-l1b-pipeline:local pipeline $WORK/granules/$G \
--l1b-manifest $WORK/l1b.json --size 128 \
--run-mode inprocess --db-uri /out \
--table sentinel2_l1b --limit 16
done
Option |
Meaning |
|---|---|
|
Chips per granule. Keep the total under 1024 on the development stack (section 12) |
|
The GPU to use |
|
The prepared inputs name absolute host paths |
Each run ends with Ingest summary and the chip count. The table is now in
$VECTORS/sentinel2_l1b. The pipeline writes it readable only by UID 10001, so
open it up before the next step:
docker run --rm --mount type=bind,src=$VECTORS,dst=/out \
--entrypoint chmod geonemo-l1b-pipeline:local -R a+rX /out
Pin the table as a dataset. This fixes the exact manifest.json that the server reads,
so don’t append to the table afterwards.
.venv/bin/python packs/sentinel/examples/l1b-similarity/retrieval_config.py \
$VECTORS/sentinel2_l1b \
--dataset-id s2-l1b \
--producer-revision "$(git rev-parse HEAD)" \
> $DATA/retrieval.json
It prints the chip count, the index type (FLAT under 1024 chips) and a space_id.
Keep the space_id for section 7.
6. Start the stack#
One command starts the stack with both parts. It builds the server images the first time.
deploy/development/dev.sh up --build \
--retrieval $DATA/retrieval.json \
--retrieval-data $VECTORS \
--l1b-ortho $WORK/l1b.json \
--l1b-ortho-data $DATA \
--l1b-ortho-gpu 0
Option |
Meaning |
|---|---|
|
Adds Milvus and the retrieval worker, and mounts the vectors read-only |
|
Adds the ortho service. The index and every path it names (corpus, work, LUTs) must be inside the data folder |
|
The GPU index or UUID the ortho service reserves |
Milvus is the upstream image from Docker Hub, pinned by its multi-arch index, so the same reference works on x86-64 and ARM64.
The stack runs without sign-in, so no credentials are needed. The ortho service checks
every prepared granule’s inputs before it reports healthy, so the first start can take
a few minutes. When up finishes it prints:
URL |
What |
|---|---|
|
Console |
|
API |
|
MCP |
dev.sh remembers these options until dev.sh down, so a later plain
dev.sh up keeps them.
7. Load the embeddings#
Replace SPACE_ID with the value from section 5:
deploy/development/dev.sh retrieval dataset-provision s2-l1b s2-l1b SPACE_ID
deploy/development/dev.sh retrieval dataset-import s2-l1b
deploy/development/dev.sh retrieval dataset-build s2-l1b
deploy/development/dev.sh retrieval dataset-status s2-l1b
Search works once dataset-status reports "state": "ready" with vectors equal to
expected_vectors.
8. Register the granules for ortho images#
This creates one catalog record per prepared granule in the sentinel-2-l1b
collection. The stack must be running.
.venv/bin/python packs/sentinel/scripts/register_l1b_granules.py \
$WORK/granules.json --api http://127.0.0.1:8101
Each record’s ID is the granule name, for example
S2B_OPER_MSI_L1B_GR_2BPS_20260922T221139_S20260922T171005_D12_N05.13.
9. Use it#
Ortho images#
R=http://127.0.0.1:8101/v1/media/records/sentinel-2-l1b/GRANULE
curl "$R/l1b-ortho/grid"
curl -o window.tif "$R/l1b-ortho?bands=B04,B03,B02&x=1000&y=1000&width=1024&height=1024"
curl -o preview.jpg "$R/l1b-ortho/preview"
Route |
Returns |
|---|---|
|
The 10 m UTM grid (CRS, transform, size) and the ten bands |
|
A float32 GeoTIFF. Values are reflectance times 10000; 0 is no data |
|
A true-color JPEG |
Windows are 16 to 4096 pixels on a side; leave them out for the whole granule.
reduce (1 to 64) averages blocks for a coarser grid. A request can correct at most
128 M values (bands times pixels): all ten bands fit about 3600 x 3600 pixels. One
request runs at a time and takes about 2 seconds; the first after start is slower.
Embeddings#
In the console, choose Embeddings, open s2-l1b, then Explore. Select a chip
and choose Find similar to this embedding.
From a script, which also records the result in the knowledge base:
.venv/bin/python packs/sentinel/examples/l1b-similarity/find_similar_chips.py \
--api http://127.0.0.1:8101 --corpus s2-l1b
Search results and ortho images aren’t linked in the console. To see a match, take its granule and center from the result and request that window from the ortho routes.
10. Stop or reset#
Command |
Effect |
|---|---|
|
Stops the stack and keeps its data |
|
Also removes its volumes: the catalog, Milvus and the loaded dataset |
To change the embeddings, make a new table (section 5), pin it, and start again with
down -v: a pinned dataset can’t change.
11. Troubleshooting#
Symptom |
Cause and fix |
|---|---|
|
No tile in |
|
|
|
The pipeline was given a granule that isn’t in |
|
The pipeline’s work or cache folder isn’t writable by UID 10001 |
|
Run the |
|
Use absolute paths, with the index under the data folder |
Ortho service never healthy |
Something its inputs name is outside |
Milvus image pull fails |
Check access to Docker Hub, or set |
Ortho |
The record’s granule isn’t in |
Ortho |
Too many bands times pixels. Use fewer bands, a smaller window or a larger |
Ortho |
Four requests are already queued. Retry after 2 seconds |
|
1024 chips or more needs an |
12. Limits#
The atmosphere is a fixed Sen2Cor preset and visibility. Nothing is retrieved per scene, there is no cloud mask, and it isn’t ESA’s operational L2A.
Granules that cross an L1C tile edge are skipped.
The development stack’s Milvus has no GPU, so it serves only
FLATindexes: fewer than 1024 chips in total.The ortho service handles one request at a time on one GPU. A small window costs about as much as the whole granule.
The upstream Milvus image lacks the backport that reports embedded-etcd startup errors. GPU (
AISAQ) index builds haven’t been qualified on ARM64.
What was tested#
On 2026-11-20, on one host, with a real Sentinel-2B corpus (one acquisition, 2026-09-22, relative orbit 69):
Embedding pipeline (section 5): ran on two prepared granules, 16 chips each, into one table.
Pinning (section 5): pinned that table: 32 chips,
FLATindex.Ortho service: served windows, previews and whole granules from the same prepared inputs.
Embeddings in the stack (sections 7 and 9): load and search were tested with a synthetic table, not real vectors.
On 2026-11-24, on one GB300 (ARM64), with three granules of the same corpus, sections 2 to 9
ran as written: preparation, the embedding pipeline (48 chips), pinning, the stack,
loading, registration, ortho windows and previews, and find_similar_chips.py on the real
vectors. Each ortho request took about 4 seconds. The B04 reflectance of the whole
granules correlated with ESA’s L2A B04 on the same grid (r = 0.99 over land, 0.85 to
0.95 over Lake Superior, where this workflow’s water reflectance is lower than L2A’s).
This is not a pixel comparison with the same run on x86-64.