rasteret.core.execution¶
Data loading pipeline: iterate collection records, fetch tiles, and merge results into xarray or GeoDataFrame outputs.
bands is required because each raster in the collection may contain dozens
of assets (bands). Specifying which bands to load avoids fetching unnecessary
data and keeps memory usage predictable.
execution
¶
Data loading pipeline for Collection reads.
This module orchestrates the read path:
- Iterate records in the Collection
- Load bands concurrently via COGReader
- Merge results into xarray.Dataset or geopandas.GeoDataFrame
Users access this via Collection.get_xarray() and Collection.get_gdf().
Classes¶
Functions¶
get_collection_xarray
¶
get_collection_xarray(
*,
collection: "Collection",
geometries: Any,
bands: list[str],
data_source: str | None = None,
max_concurrent: int = 50,
backend: object | None = None,
target_crs: int | None = None,
**filters: Any,
) -> Dataset
Load selected bands as an xarray.Dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
Collection
|
Source collection. |
required |
geometries
|
bbox tuple, pa.Array, Shapely, WKB bytes, or GeoJSON dict
|
Area(s) of interest. |
required |
bands
|
list of str
|
Band codes to load (e.g. |
required |
data_source
|
str
|
Override the inferred data source for band mapping and URL signing. |
None
|
max_concurrent
|
int
|
Maximum concurrent HTTP requests (default 50). |
50
|
backend
|
StorageBackend
|
Pluggable I/O backend (e.g. |
None
|
target_crs
|
int
|
Reproject all records to this EPSG code before merging. When
|
None
|
filters
|
kwargs
|
Additional keyword arguments forwarded to |
{}
|
Returns:
| Type | Description |
|---|---|
Dataset
|
Band arrays in native COG dtype (e.g. |
Examples:
>>> ds = get_collection_xarray(
... collection=col,
... geometries=(77.55, 13.01, 77.58, 13.08),
... bands=["B04", "B08"],
... )
>>> ds.B04.dtype
dtype('uint16')
Source code in src/rasteret/core/execution.py
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 | |
get_collection_gdf
¶
get_collection_gdf(
*,
collection: "Collection",
geometries: Any,
bands: list[str],
data_source: str | None = None,
max_concurrent: int = 50,
backend: object | None = None,
target_crs: int | None = None,
**filters: Any,
) -> GeoDataFrame
Load selected bands as a geopandas.GeoDataFrame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection
|
Collection
|
Source collection. |
required |
geometries
|
bbox tuple, pa.Array, Shapely, WKB bytes, or GeoJSON dict
|
Area(s) of interest. |
required |
bands
|
list of str
|
Band codes to load. |
required |
data_source
|
str
|
Override the inferred data source. |
None
|
max_concurrent
|
int
|
Maximum concurrent HTTP requests (default 50). |
50
|
backend
|
StorageBackend
|
Pluggable I/O backend. |
None
|
target_crs
|
int
|
Reproject all records to this EPSG code before building the GeoDataFrame. |
None
|
filters
|
kwargs
|
Additional keyword arguments forwarded to |
{}
|
Returns:
| Type | Description |
|---|---|
GeoDataFrame
|
Band arrays in native COG dtype. Each row is a geometry-record pair with pixel data as columns. |