RISE (Rapid Intelligence System for the Environment) is NASA Harvest's toolkit for producing crop and land maps quickly for a new region. rise-eo is its satellite half: imagery in, model-ready data out, your model's predictions back as maps. The RISE repository (NASA Harvest members only, for now) pins rise-eo next to RISE's reference-data module and shared notebooks; rise-eo also works on its own.
The same calls run on your laptop or across an Azure ML cluster. Scaling out is one argument
(runner="aml"), not a rewrite.
rise-eo does not train your model. It hands you training arrays, takes back your trained model wrapped in a small adapter, and runs it over any region. That line is deliberate and permanent.
| stage | you give | you get | call |
|---|---|---|---|
| Download | an ROI, dates, bands | a shared imagery archive + a GeoParquet catalog | rise_eo.download |
| Training data | labelled polygons | (samples, timestamps, bands) arrays, with ids, labels and coordinates |
rise_eo.create_training_data |
| Check your model | your model, wrapped as a ModelAdapter |
a pass on one real grid cell, before any cluster spend | rise_eo.verify_adapter |
| Bundle and publish | the adapter + its files | a portable bundle folder; optionally a registry ref like crop-rf:1 |
rise_eo.save_bundle, rise_eo.deploy |
| Inference | a bundle or ref + an ROI | one COG per grid cell, a merged map, a STAC catalog | rise_eo.run_inference |
| Scale out | runner="aml" |
the same calls, fanned out on Azure ML | every verb above |
| Serve | the COGs + STAC | XYZ map tiles, through stock open-source servers | none; see below |
Imagery: Sentinel-2 L2A from the Microsoft Planetary Computer (MPC, no account needed) or the Copernicus Data Space Ecosystem (CDSE), and Sentinel-1 RTC from MPC.
Measured on real data:
- The whole pipeline at scale: a 300-cell Austria ROI ran end to end on Azure ML, from imagery to a merged map, in 18.8 minutes across 32 nodes: 8 steps, 213 MPC granules in, 300 COGs + STAC + a merged map out (run-at-scale how-to).
- Training data at scale: 900 field datacubes on blob storage reduced into one training array on a single node in 6.8 minutes (report).
pip install "rise-eo[local,mpc,grid] @ git+https://github.com/nasaharvest/rise-eo@v0.3.0"Python ≥ 3.11. If you use RISE, it installs rise-eo for you. Install only the extras you need; for
most of them, a missing extra gives an error that names it (aml and serving raise a plain
ImportError).
| extra | you need it for |
|---|---|
local |
the default runner="local" pipeline (Snakemake), and every AML node image |
mpc |
source="mpc" |
s3 |
source="cdse" downloads, and any s3:// path |
grid |
splitting an ROI into grid cells (roi= on run_inference and verify_adapter) |
azure, aml |
abfss:// storage and managed identity; runner="aml" |
titiler, serving |
the map-serving demos (see step 5) |
For development: clone, then follow CONTRIBUTING.md.
import datetime
import rise_eo
catalog = rise_eo.download(
roi="my_roi.geojson",
startdate=datetime.datetime(2018, 1, 1),
enddate=datetime.datetime(2019, 1, 1),
bands=["B04", "B08", "B8A", "SCL"],
dst_folderpath="data/imagery", # one shared archive for every run
source="mpc", # no credentials; for CDSE: source="cdse", creds=CdseCredentials.from_env()
max_tiles=20, # refuse the run if the ROI matches more MGRS granules than this
max_cloudcover=60, # optional: skip granules cloudier than this (%)
)- The archive is shared and lossless. A repeat run downloads only what is missing. If one
acquisition is stored under two processing baselines, later steps ask you to pick one with
processing=instead of silently choosing. - Preflight runs before any spend.
max_tilesis required; rise-eo counts the matching granules from metadata alone and stops if the ROI is bigger than you meant. - Sentinel-1 RTC uses the same call with
collection="sentinel-1-rtc",bands=["vv", "vh"]andsource="mpc", and withoutmax_cloudcover(radar has no cloud cover, so it raises). S1 downloads whole scenes, not MGRS granules. Ascending and descending passes are not mixed in one datacube by default: when you build, pick one withproperties_filter={"sat:orbit_state": "ascending"}. To median both on purpose, list both,{"sat:orbit_state": ["ascending", "descending"]}; the two passes view a field from different sides and incidence angles, so that median mixes two geometries. - Several collections in one call.
inputs=[rise_eo.CollectionInput("sentinel-2-l2a", [...], max_cloudcover=60), rise_eo.CollectionInput("sentinel-1-rtc", ["vv", "vh"], ...)]replacescollection,bands(passNone),properties_filter,processingandmax_cloudcover; passing both raises. Each collection may appear once and each band name once. rise-eo checks every input before the first download, so a bad Sentinel-1 input fails before the Sentinel-2 download is paid for.downloadthen returns{collection: catalog_filepath}.create_training_dataandrun_inferencetake the sameinputs=witharchive_root="data/imagery"in place ofcatalog_filepath; one input builds exactly as the scalar arguments do. More than one builds a fused cube per polygon or grid cell: the first input (it must declare a reference band, assentinel-2-l2adoes with B08) is built as usual, every other input is built onto its grid, and the cubes are joined along the band axis ininputsorder into onefloat32cube with nodata 0. Each other input is read with the shape buffered by two reference pixels and blanked outside the shape, so its footprint equals the first input's. A polygon any input has no imagery for in its window is skipped and the skip line names the collection. Inference builds the same cube, andadapter.required_bandsnames bands of the fused cube (a mask band dropped after masking is not one).
training = rise_eo.create_training_data(
label_polygons="my_labeled_fields.geojson",
catalog_filepath=catalog,
startdate=datetime.datetime(2018, 1, 1),
enddate=datetime.datetime(2019, 1, 1),
mosaic_days=20,
bands=["B04", "B08", "B8A", "SCL"],
id_col="fid",
label_col="crop_type",
export_folderpath="data/training",
)
arrays = training.load() # {"data", "ids", "window_starts", "labels", "coords", "metadata"}
# arrays["data"] has shape (samples, timestamps, bands). Train any model you like on it.For each labelled polygon, rise-eo builds a datacube and flattens the cubes into one array:
- cloud-masked with the Sentinel-2 scene classification (SCL);
- mosaicked into calendar intervals (median):
mosaic_days=20for 20-day windows, ormosaic_days="month"for calendar months (startdatethen starts on the 1st of a month). Every cube in a run has the same number of timestamps. To give each polygon its own window, passstartdate=None, enddate=Noneand putstartdateandenddatecolumns in the polygons: every polygon must give the same T, or the call raises before any download.arrays["window_starts"]holds each sample's window start; read it, notmetadata["timestamps"], for the dates of a sample; - merged across MGRS tiles, after moving them all into one CRS, and resampled to a real 10 m band.
Pass your adapter (adapter=) to compute its features here; inference later computes the exact same
features.
Wrap your trained model in a ModelAdapter. It declares the bands and number of timestamps it
needs, its features (feature_sequence) and what it outputs, and implements load and predict.
Subclass rise_eo.BaseModelAdapter and the rest is filled in. examples/eurocrops_rf.py is a complete one to copy.
rise_eo.verify_adapter( # one real grid cell, end to end, before a large run
my_adapter,
roi="my_roi.geojson",
catalog_filepath=catalog,
startdate=datetime.datetime(2018, 1, 1),
enddate=datetime.datetime(2019, 1, 1),
mosaic_days=20,
bands=["B04", "B08", "B8A", "SCL"],
export_folderpath="data/verify",
)
rise_eo.save_bundle(
my_adapter, {"model": "model.joblib"}, "my_bundle/",
requirements=["scikit-learn"], # what another machine must install to run it
)
result = rise_eo.run_inference(
"my_bundle/",
output_folderpath="data/predictions",
roi="my_roi.geojson", # split into ~5 km grid cells; one datacube per cell
catalog_filepath=catalog,
startdate=datetime.datetime(2018, 1, 1),
enddate=datetime.datetime(2019, 1, 1),
mosaic_days=20,
bands=["B04", "B08", "B8A", "SCL"],
merge="reproject", # also write one merged map, in one CRS
)run_inference checks that the adapter's bands and timestamp count match the run before any heavy
work, and writes one COG per grid cell plus a STAC catalog. Bundling is covered in
docs/howto/bundle-your-model.md.
Every training set and every inference output carries a lineage.json (next to data.npy, or next to the
STAC catalog) saying where it came from: the geometry (copied beside it as geometry.geojson), the
granules each collection used, the ordered process steps, the request, the library versions and the
rise-eo version and commit that built the cubes. rise_eo.save_bundle(..., training_data=td) copies the
training set's lineage.json into the bundle, and run_inference refuses a request whose collections,
bands, properties_filter, period or T differ from it, before any job starts.
To share a model, rise_eo.deploy publishes a saved bundle to a registry. It refuses a bundle with no
requirements, and first runs the bundle on one Azure ML node with the image you name, so it takes
the same runner_kwargs as step 4. run_inference then takes the returned
ref in place of the path, plus the registry:
ref = rise_eo.deploy(
"my_bundle/", name="crop-rf", registry="abfss://.../models", environment="rise-eo-infer-sklearn:3",
runner_kwargs=runner_kwargs, # cluster, root, identity_client_id
) # -> "crop-rf:1"
rise_eo.run_inference(ref, registry="abfss://.../models", output_folderpath="data/predictions")
# ...plus the ROI arguments from the run_inference call aboveAdd runner="aml" and runner_kwargs (your cluster, node image, blob working root and identity) to
the same calls. ROI-mode inference also takes storage="azure". Every file goes through one storage
layer (fsspec), so local paths and abfss:// paths are interchangeable. The one difference: cluster
nodes can't read your laptop, so the archive and its catalog go on blob storage, from a download run
with runner="aml" and an abfss:// dst_folderpath.
result = rise_eo.run_inference(
"my_bundle/", output_folderpath="data/predictions",
roi="my_roi.geojson", catalog_filepath=blob_catalog, # returned by download(runner="aml")
startdate=datetime.datetime(2018, 1, 1), enddate=datetime.datetime(2019, 1, 1),
mosaic_days=20, bands=["B04", "B08", "B8A", "SCL"],
merge="reproject",
runner="aml", storage="azure", runner_kwargs=runner_kwargs,
)Keep your cluster settings in a user-level config file, written once. The verbs never read it: load it
with rise_eo.config.load() and pass its values into runner_kwargs.
rise-eo init # -> ~/.config/rise-eo/config.toml
rise-eo config # print the resolved config and where each value came fromA crashed inference run resumes per grid cell: finished cells are skipped. Full setup:
docs/howto/run-at-scale.md.
Building an AML node image? It must include the
localextra, because nodes run the same Snakemake steps a laptop does. An image without it builds fine, then fails about 30 minutes into a run. Seedocs/howto/build-the-images.md.
rise-eo writes standard outputs (Cloud-Optimized GeoTIFFs and a STAC catalog) and hosts nothing
itself. Any standard tile server can turn them into XYZ tiles for a web map. Two worked demos live in
demos/, so they need a clone of this repo:
- One map, no database: a small rio-tiler server (
demos/titiler_serve.py, thetitilerextra) serves the merged COG with a class colour map. - Many runs, searchable: a Docker stack of stock pgSTAC + titiler-pgstac (
demos/mini_mpc/);pypgstacloads the STAC into it.
Both are walked through in docs/howto/serve-xyz.md.
- Two collections only: Sentinel-2 L2A and Sentinel-1 RTC. No HLS, Landsat, L1C, ERA5 or CHIRPS.
- One cluster runner: Azure ML. Storage is generic (
fsspec, so S3 works), but job dispatch is not. - Fixed output grid: datacubes are at the reference band's resolution (10 m for Sentinel-2), with median mosaics only. Downloads fetch whole MGRS granules.
- No hosted map, and no colour scheme on the outputs for a viewer to pick up.
- The API is not stable yet. rise-eo is
0.y.z, and a minor release can break it; each release's notes list what broke.
Everything else, with what would trigger a fix: LIMITATIONS.md.
| you want | read |
|---|---|
| a first run that works offline, with no credentials | docs/tutorial.md |
| your own region, real imagery, your own model, a cluster or a map | docs/howto/ |
| a complete script to copy | examples/eurocrops_rf.py |
| everything rise-eo does not do yet | LIMITATIONS.md |
| to change rise-eo: setup, the review process, design docs | CONTRIBUTING.md |
Code: MIT (LICENSE). Data derived from EuroCrops (notebooks/shapefiles/AT_2018_TRAIN.geojson,
tests/data/tutorial/fields.geojson) is CC BY 4.0; see each folder's NOTICE for the citation.