Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

What does every geoscience pipeline do, in order?

GeoStack · background · question → product → question

Abstract

Pictures first. Whatever the science, the job has the same outline: find the scenes, read only what you need, cut it into pieces, compute, stitch, and keep the result so that someone can find it again. This page names ten stages for that outline, says what each hands to the next, and runs all ten on one small example. It starts from the eight-stage diagram in geotoolz and adds the two stages that versioned storage and a product catalog bring.

The running example

Ten stages, three acts

Find no pixel is decoded

1 Search a question →\to file names an archive’s index STAC · CMR · a folder 24 files

2 Catalog file names →\to rows; a request →\to hits headers only geocatalog 24 rows →\to 6

3 Save hits →\to hits near the compute bytes, undecoded geocatalog · geocloud 6 files, 6.4 MB6.4\ \mathrm{MB}

Compute split →\to apply →\to combine, on a lazy field

4 Stream hits →\to one lazy field pixels, on demand geocatalog · geopatcher (2,400,500)(2, 400, 500)

5 Split field →\to patches pixels geopatcher 20×(2,128,128)20 \times (2, 128, 128)

6 Apply patch →\to patch pixels geoops 20×(128,128)20 \times (128, 128)

7 Combine patches →\to one array pixels geopatcher (400,500)(400, 500)

Keep a file, a version, a record

8 Write array →\to file or store a product geoops.io · geocloud 1 COG, 1.3 MB1.3\ \mathrm{MB}

9 Commit store →\to snapshot id a version new Icechunk 1 snapshot

10 Publish snapshot + recipe →\to record a row new product catalog 1 row

The eight stages of the geotoolz diagram, with two added at the end. Each row says what goes in and what comes out, what the stage actually touches, which package owns it, and the running example’s numbers.

Search24 files
Catalog6 rows that match
Save6 files
Stream1 field
Split20 patches
Apply20 patches
Combine1 array
Write1 file
Commit1 snapshot
Publish1 row

The shape every pipeline has: many candidates narrow to a few, the few become one field, the field fans out into patches and folds back into one result, and the result is kept three ways.

Act 1 · Find: from a question to a few files

Search asks an archive what it has. Catalog turns the answer into a table of footprints, times and paths, so the next question is a query on that table and not another crawl. Save brings only the matching files close to where the computing runs. The request itself is an object, a GeoSlice: bounds × time × resolution × CRS.

# Shapes: T = 2 bands; H × W = 400 × 500 px (the site); h × w = 128 × 128 px

# --- search ---
    # the archive: here a folder; in production a STAC, CMR or GEE search
    files = sorted(glob.glob(str(ARCHIVE / "*.tif")))             # → 24 paths

    # --- catalog ---
    # today (geocatalog)
    # index once: footprint, CRS, resolution and time per file; no pixels read
    catalog = build_raster_catalog(                               # 24 paths → 24 rows
        files, filename_regex=r"_(?P<date>\d{8})", date_format="%Y%m%d"
    )
    # today (geocatalog)
    # the request: bounds × time × resolution × CRS
    site = gc.GeoSlice(
        bounds=(723000.0, 4375000.0, 728000.0, 4379000.0),
        interval=pd.Interval(
            pd.Timestamp("2026-06-01"), pd.Timestamp("2026-06-30"), closed="both"
        ),
        resolution=(PIXEL_M, PIXEL_M),
        crs=CRS,
    )
    # today (geocatalog)
    hits = catalog.query(site)                                    # 24 rows → 6 rows

    # --- save ---
    # today (geocatalog)
    # fetch only the hits next to the compute; local files stay where they are
    staged = gc.staging.stage(hits, dest=str(WORK / "cache"))     # 6 rows → 6 rows

Act 2 · Compute: split, apply, combine

The field Split Apply Combine

patch

f(⋅)f(\cdot)

patch

f(⋅)f(\cdot)

patch

f(⋅)f(\cdot)

overlapping windows, read on demand weights fade each patch out towards its edges

xarray’s split → apply → combine, on space. Measured on the running example: 20 patches of 128 px with 32 px of overlap give the same NDVI as computing the whole site at once, to 2e-16.

Stream presents the saved files as one field: an array on the request’s grid that reads pixels only when a window is asked for. Split cuts the field into overlapping patches. Apply runs one operator on each patch. Combine merges the results, weighting each patch so that the seams disappear.

# --- stream ---
    # today (geocatalog)
    # a Field: the six files as one lazy mosaic on the site's grid
    field = gc.patch.field_for(staged, site)                      # 6 rows → (T, H, W)

    # --- split ---
    # today (geopatcher)
    patcher = gp.SpatialPatcher(
        geometry=gp.spatial.geometry.Rectangular(size=(128, 128), boundary="pad"),
        sampler=gp.spatial.sampler.RegularStride(step=(96, 96)),
        window=gp.spatial.window.Hann(),
        aggregation=gp.spatial.aggregation.OverlapAdd(),
    )
    # today (geoops)
    patches = GridSampler(patcher=patcher)(field)                 # (T, H, W) → 20 × (T, h, w)

    # --- apply ---
    # today (geoops)
    # NDVI = (ρ_nir − ρ_red) / (ρ_nir + ρ_red)
    ndvi = gz.DNToReflectance(scale=1e-4) | gz.NDVI(red=0, nir=1)
    # today (geoops)
    results = ApplyToChips(operator=ndvi)(patches)                # 20 × (T, h, w) → 20 × (h, w)

    # --- combine ---
    # today (geoops)
    # window-weighted merge of the overlaps, back on the site's grid
    merge = MergePatches(
        aggregation=gp.spatial.aggregation.OverlapAdd(), domain=field.domain
    )
    product = merge(results)                                      # 20 × (h, w) → (H, W)

Why the merge has no seams (overlap-add)

Let patch pp give a result y(p)(n)y^{(p)}(n) at pixel nn, with a window weight w(p)(n)≥0w^{(p)}(n) \ge 0 that is largest at the patch’s centre and falls towards its edge (zero where the patch does not cover nn). The merged value is the weighted mean over the patches that cover the pixel:

y^(n)=∑p=1Npatchw(p)(n)y(p)(n)∑p=1Npatchw(p)(n)\hat{y}(n) = \frac{\sum_{p=1}^{N_\text{patch}} w^{(p)}(n) y^{(p)}(n)}{\sum_{p=1}^{N_\text{patch}} w^{(p)}(n)}

For an operator that acts pixel by pixel, such as NDVI, every patch gives the same value at a shared pixel, so y^(n)=y(n)\hat{y}(n) = y(n) exactly; the measured difference is 2.2e-16. For an operator that looks at a neighbourhood (a convolution, a neural network), values near a patch edge are less reliable, and the weights are what keep them from showing.

Act 3 · Keep: a file, a version, a record

Write puts the result somewhere with its georeference intact. That is where the original eight stages end, and where two problems begin: a half-written result looks like a result, and nobody else knows it exists. Commit makes the write a version that appears all at once and can be named for ever. Publish adds one row to a product catalog saying what the product is, where it is, which version, and what made it.

# --- write ---
    # today (geoops)
    gz.WriteCOG(path=str(WORK / "ndvi_june.tif"))(product)        # (H, W) → 1 file

    # --- commit ---
    # today (icechunk)
    # the same product into a versioned store: visible all at once, or not at all
    repo = icechunk.Repository.create(
        icechunk.local_filesystem_storage(str(WORK / "products.icechunk"))
    )
    session = repo.writable_session("main")
    values = np.asarray(product)                                  # (H, W)
    array = zarr.create_array(
        session.store, name="ndvi", shape=values.shape, chunks=(256, 256), dtype="f4"
    )
    array[:] = values
    array.attrs["transform"] = [float(v) for v in product.transform]
    array.attrs["crs"] = "EPSG:32630"
    snapshot_id = session.commit("NDVI, site, June 2026")         # → snapshot id

    # --- publish ---
    # today (pipekit)
    # h = SHA-256(stable_json(state) ‖ 0x00 ‖ weights): the recipe's id
    recipe_hash = pipekit_ops.pipeline_hash(ndvi, b"")
    # one row in the product table: what, where, when, from what, by what
    record = {
        "id": "ndvi_site_2026-06",
        "start_time": "2026-06-01",
        "end_time": "2026-06-30",
        "bbox": list(site.bounds),
        "crs": "EPSG:32630",
        "href": "products.icechunk",
        "snapshot_id": snapshot_id,
        "recipe_hash": recipe_hash,
        "sources": [pathlib.Path(path).name for path in hits.gdf["filepath"]],
    }
    pq.write_table(pa.Table.from_pylist([record]), WORK / "products.parquet")

    # --- loop ---
    # the next pipeline's search is a query on the product table
    found = pq.read_table(WORK / "products.parquet").to_pylist()[0]
    reopened = repo.readonly_session(snapshot_id=found["snapshot_id"])
    again = zarr.open_array(reopened.store, path="ndvi")[:]       # → (H, W)

The record is the whole of what the next user needs:

{
  "id": "ndvi_site_2026-06",
  "start_time": "2026-06-01",
  "end_time": "2026-06-30",
  "bbox": [
    723000.0,
    4375000.0,
    728000.0,
    4379000.0
  ],
  "crs": "EPSG:32630",
  "href": "products.icechunk",
  "snapshot_id": "VA8A4RKN3DPMS833N72G",
  "recipe_hash": "4b8c154a8762594f\u2026",
  "sources": [
    "S2_A_20260605.tif",
    "S2_A_20260612.tif",
    "S2_A_20260621.tif",
    "S2_B_20260605.tif",
    "S2_B_20260612.tif",
    "S2_B_20260621.tif"
  ]
}

The loop

Publish feeds the next search

L2 reflectance scenes

search →\to …\ldots →\to publish

the same ten stages

NDVI, June, per site

L3

NDVI, per month

search →\to …\ldots →\to publish

the same ten stages

anomaly vs 5-year mean

L4

anomalies, per site

search →\to …\ldots →\to publish

the same ten stages

drought alerts

indicator

Each lap searches what the lap before published, and raises the processing level.

Without publish, the chain ends in a file somebody has to know about. With it, the product catalog is an archive like any other, and a pipeline’s output is the next pipeline’s input.

What crosses each seam

BetweenWhat is handed overIn the running example
search → catalogfile names or URIs24 paths
catalog → savea GeoCatalog: rows of footprint, time, path6 rows
save → streamthe same catalog, pointing at nearby copies6 rows
stream → splita RasterField: a lazy array with a grid(2, 400, 500) uint16
split → apply → combinea list of Patch, each a small GeoArray with its place20 patches
combine → writeone GeoArray on the request’s grid(400, 500) float64
write → commita store with uncommitted changes1 array, 4 chunks
commit → publisha snapshot idVA8A4RKN3DPMS833N72G
publish → the next searcha record: id, footprint, time, where, snapshot, recipe1 row

Because each seam is an object with a known shape, a stage can be replaced without touching its neighbours: a different archive behind search, a different operator in apply, a different store behind write.

The pipeline and the role ladder

The pipeline is a recipe; each stage is a step
⑥ recipe
Search⑤ step Catalog⑤ step Save⑤ step Stream⑤ step Split⑤ step Apply⑤ step Combine⑤ step Write⑤ step Commit⑤ step Publish⑤ step
inside Apply
④ algorithm ③ model ② strategy ① primitive ⓪ structure
The lower rungs live inside one stage. They take arrays and know nothing of files, catalogs or snapshots.Orchestration runs the recipe: per site, per month, on a schedule.

How this page meets the role ladder. The ladder describes what is inside a library; the pipeline describes what a job does from start to finish. They meet at rung ⑤: every stage is a step, and the science sits under one of them.

What Icechunk and the product catalog change

The two new stages are the visible part. The same two ideas also change four of the original eight. Rows marked proposed are the workstreams of the storage design pages.

StageTodayWith Icechunk and a product catalogStatus
Catalogrows in a GeoParquet file beside the datarows stored in the repository with the chunks; a snapshot id pins bothproposed · geotoolz#664
Savedownload the hitsrecord references to the original COGs; copy nothingproposed · geotoolz#668
Streamone mosaic on the request’s gridalso: one tree node per scene, each on its own gridproposed · geotoolz#666
Writea COG or a Zarr storethe same, with standard CRS metadata in Zarrproposed · geotoolz#667
Commit—append in one transaction; the snapshot id is the versionruns here with Icechunk directly; API proposed · geotoolz#665
Publish—one record to a product catalog (GeoParquet, PostGIS, pgstac or a STAC API)runs here as a Parquet row; API proposed · geotoolz#671
Stamp (rides along)the recipe’s hash can be computedwritten onto every product with the snapshot it readproposed · pipekit#235

Where the time went

StageTimeWhat it did here
search0.3 mslisted a folder
catalog55.6 msread 24 headers, answered one request
save7.5 msnothing to copy: the files are local
stream91.7 msopened six files as one mosaic
split3.7 mscut 20 windows
apply10.9 msNDVI on 20 patches
combine3.9 msweighted merge
write41.1 msone COG with overviews
commit21.4 msone Icechunk commit
publish14.7 msone Parquet row

These are local-disk timings on a tiny archive and say little about a real run, where search, save and stream wait on the network and dominate. They are here to show that every stage ran, and that the two new ones are cheap.

Where this goes next

StageBackground pageDesign page
Search, catalogDatabases and catalogsLevel 2 collections
Save, streamObject storage, storage formatsLevel 2 collections
Split, apply, combineParallelism, the role ladderKinds and roles
Write, commitVersions and identityLevel 2 collections
Publish, stampDatabases and catalogs, versions and identityProduct catalog, recipe registries