Workflows¶
This page is task-first: start from what you want to do, then use the smallest API surface that gets you there.
For full signatures and edge cases, see API Reference.
Use get_embedding(...) for the fastest path to a single embedding.
Use get_embeddings_batch(...) when the model is fixed and you have many ROIs.
Use export_batch(...) for reproducible, resumable exports across many ROIs/models.
Use inspect_provider_patch(...) before blaming the model.
How to read this page
Start from the task tab above, then scroll to the matching section for a runnable example and "Choose this when" guidance.
Single Embedding (Fastest Path)¶
Use get_embedding(...) when you want one ROI embedding now.
from rs_embed import PointBuffer, TemporalSpec, OutputSpec, get_embedding
emb = get_embedding(
"remoteclip", # (1)!
spatial=PointBuffer(lon=121.5, lat=31.2, buffer_m=2048), # (2)!
temporal=TemporalSpec.range("2022-06-01", "2022-09-01"), # (3)!
output=OutputSpec.pooled(), # (4)!
backend="gee",
device="auto",
)
pooled() is the best default for comparison/classification workflows.
Choose this when:
- you are prototyping
- you want to inspect metadata
- you are debugging model behavior on one location
Batch Embeddings for One Model¶
Use get_embeddings_batch(...) when the model is fixed and you have multiple ROIs.
from rs_embed import PointBuffer, TemporalSpec, OutputSpec, get_embeddings_batch
spatials = [
PointBuffer(121.5, 31.2, 2048),
PointBuffer(120.5, 30.2, 2048),
]
embs = get_embeddings_batch(
"remoteclip",
spatials=spatials,
temporal=TemporalSpec.range("2022-06-01", "2022-09-01"),
output=OutputSpec.pooled(),
backend="gee",
)
Choose this when:
- same model, many points
- you want simpler code than manual loops
- you may benefit from embedder-level batch inference
Dataset Export (Recommended)¶
Use export_batch(...) for reproducible data pipelines and downstream experiments.
For new code, prefer the out + layout target style so the same API pattern works for single-ROI and multi-ROI exports.
from rs_embed import export_batch, PointBuffer, TemporalSpec
spatials = [
PointBuffer(121.5, 31.2, 2048),
PointBuffer(120.5, 30.2, 2048),
]
export_batch(
spatials=spatials,
names=["p1", "p2"], # (1)!
temporal=TemporalSpec.range("2022-06-01", "2022-09-01"), # (2)!
models=["remoteclip", "prithvi"], # (3)!
out="exports", # (4)!
layout="per_item", # (5)!
backend="gee",
save_inputs=True,
save_embeddings=True,
resume=True,
)
per_item keeps each ROI grouped together; useful for inspection and resume.
Choose this when:
- multiple models and/or many points
- you need manifests for bookkeeping
- you want resumable exports
- you want to avoid duplicate input downloads
Inspect Inputs Before Modeling¶
Use patch inspection when outputs look suspicious (clouds, wrong band order, bad dynamic range, etc.).
Preferred: provider-agnostic¶
from rs_embed import inspect_provider_patch, PointBuffer, TemporalSpec, SensorSpec
report = inspect_provider_patch(
spatial=PointBuffer(121.5, 31.2, 2048),
temporal=TemporalSpec.range("2022-06-01", "2022-09-01"),
sensor=SensorSpec(
collection="COPERNICUS/S2_SR_HARMONIZED",
bands=("B4", "B3", "B2"),
scale_m=10,
),
backend="gee",
)
Backward-compatible alias¶
inspect_gee_patch(...)calls the same underlying inspection flow for GEE paths.
Export convenience wrapper (optional)¶
export_npz(...)is a single-ROI.npzconvenience wrapper aroundexport_batch(...).- Prefer
export_batch(...)in tutorials and pipelines so one API scales from one ROI to many ROIs.
Large ROI with Tiling¶
If you request large ROIs for on-the-fly models, try API-side tiling:
from rs_embed import get_embedding, PointBuffer, TemporalSpec, OutputSpec
emb = get_embedding(
"remoteclip",
spatial=PointBuffer(121.5, 31.2, 8000),
temporal=TemporalSpec.range("2022-06-01", "2022-09-01"),
output=OutputSpec.grid(),
backend="gee",
input_prep="tile",
)
Use input_prep="tile" when:
OutputSpec.grid()matters- large ROI resize would lose too much detail
- you accept extra runtime cost for better spatial structure preservation
Fair Cross-Model Comparison¶
When benchmarking models, prefer:
- same ROI list
- same temporal window
- same compositing policy (
SensorSpec.composite) OutputSpec.pooled()first- default model normalization unless replicating original training setup
Then use Supported Models to review model-specific preprocessing and required side inputs.
Choosing the Right Page¶
- Need runnable setup steps: Quickstart
- Need mental model and semantics: Concepts
- Need model capability matrix: Model Overview
- Need exact function signatures/options: API Reference