Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/terrafloww/rasteret/llms.txt

Use this file to discover all available pages before exploring further.

Method Signature

Collection.get_numpy(
    geometries,
    bands,
    *,
    max_concurrent=50,
    cloud_config=None,
    data_source=None,
    backend=None,
    target_crs=None,
    **filters
)
Load selected bands into NumPy arrays for the specified geometries.

Parameters

geometries
bbox tuple, pa.Array, Shapely, WKB bytes, or GeoJSON dict
required
Area(s) of interest to load. Accepts (minx, miny, maxx, maxy) bbox tuples, Arrow arrays (e.g. from GeoParquet), Shapely objects, raw WKB bytes, or GeoJSON dicts.
bands
list of str
required
Band codes to load (e.g. ["B04", "B03", "B02"]).
max_concurrent
int
default:"50"
Maximum concurrent HTTP requests for fetching raster tiles.
cloud_config
CloudConfig
Cloud configuration for URL rewriting and authenticated access.
data_source
str
Override the inferred data source identifier.
backend
StorageBackend
Pluggable I/O backend for authenticated range reads. See create_backend().
target_crs
int
EPSG code to reproject all records to before assembly.
**filters
kwargs
Additional keyword arguments passed to subset().

Returns

array
numpy.ndarray
Single-band queries return [N, H, W]. Multi-band queries return [N, C, H, W] in requested band order. Data is in native COG dtype (e.g. uint16 for Sentinel-2).

Examples

Single Band Load

import rasteret

collection = rasteret.load("my_collection")

# Load red band for a bounding box
bbox = (-122.5, 37.7, -122.3, 37.9)
red = collection.get_numpy(
    geometries=bbox,
    bands=["B04"]
)

print(red.shape)  # (N, H, W)

Multi-Band RGB Stack

# Load RGB bands as a stack
rgb = collection.get_numpy(
    geometries=bbox,
    bands=["B04", "B03", "B02"]
)

print(rgb.shape)  # (N, 3, H, W)

With Filters

# Load with cloud cover and date filters
clean_imagery = collection.get_numpy(
    geometries=bbox,
    bands=["B04", "B03", "B02"],
    cloud_cover_lt=10,
    date_range=("2023-06-01", "2023-08-31")
)

With CRS Reprojection

# Reproject to UTM Zone 10N before loading
data = collection.get_numpy(
    geometries=bbox,
    bands=["B08"],
    target_crs=32610
)

Notes

  • Data is returned in native COG dtype (typically uint16 for Sentinel-2, Landsat)
  • All scenes are loaded and stacked along the first dimension
  • For single-band queries, shape is [N, H, W]
  • For multi-band queries, shape is [N, C, H, W] where C is the number of bands
  • Bands are ordered as specified in the bands parameter

Build docs developers (and LLMs) love