search¶
Import path: earth2studio.data.stac.search
Documentation¶
Search a STAC catalog and open the results as one lazy array.
Runs search_items, opens the requested assets of every matching
item (see open_asset), clips them to bbox and stacks them into
Earth2Studio's (time, variable, y, x) layout. The grid is that of the
first asset of the first item, so list the finest-resolution asset first.
Nothing beyond file headers is read until values are computed, with one
exception: assets or items on a different grid than the first (other
resolution, scene or UTM zone) are resampled onto it (nearest neighbour)
while search runs, which reads their clipped window eagerly. Items
whose assets do not intersect bbox are skipped with a warning.
Parameters:
-
collection(str) –Collection id, e.g.
"landsat-c2-l2". -
assets(Sequence[str] | None, default:None) –Asset keys to open; these become the
variablecoordinate. None opens every raster (GeoTIFF/COG) asset of the first item, by default None -
provider(StacProvider, default:PLANETARY_COMPUTER) –Catalog to query, by default PLANETARY_COMPUTER
-
bbox(Sequence[float] | None, default:None) –[min_lon, min_lat, max_lon, max_lat]; used for the search and to clip each asset, by default None (whole scenes) -
intersects(Mapping[str, Any] | None, default:None) –GeoJSON geometry to search with, by default None
-
time_range(str | None, default:None) –ISO 8601
"start/end"interval or single instant, by default None -
query(Mapping[str, Any] | None, default:None) –STAC query-extension filter, e.g.
{"eo:cloud_cover": {"lt": 5}}, by default None -
cql2_filter(Mapping[str, Any] | None, default:None) –CQL2-JSON filter, by default None
-
ids(Sequence[str] | None, default:None) –Restrict the search to these item ids, by default None
-
sortby(Sequence[Mapping[str, str]] | None, default:None) –Sort spec, e.g.
[{"field": "properties.eo:cloud_cover", "direction": "asc"}], by default None -
max_items(int | None, default:10) –Maximum number of items, by default 10
-
chunks(int | Mapping[str, int] | None, default:1024) –Dask chunk size per asset (see
open_asset), by default 1024 -
rescale(bool, default:True) –Apply
raster:bandsscale/offset, by default True -
mask_nodata(bool, default:True) –Replace nodata with NaN, by default True. When False, a layer that has to be resampled and declares no nodata is still returned as float with NaN where the source does not cover the grid
-
lazy(bool, default:True) –Return a dask-backed array; False computes before returning, by default True
Returns:
-
DataArray–Lazy
(time, variable, y, x)array sorted by time, with.rio.crs/.rio.transform()describing the grid and the STAC item ids inattrs["stac_items"].
Raises:
-
FileNotFoundError–If the search returns no items.