landstac.read¶
Read helpers for opening STAC assets as xarray DataArrays.
Access modes¶
Public HREFs: open directly with rioxarray.
Auth + cache: download to a cache dir, then open.
Auth + RAM: stream the whole asset into memory, no files on disk.
Notes
Native resolution by default: set overview_level=None.
Internal overviews: pass an int overview level to read a lower-res pyramid.
- When download_dir is provided, assets are cached to:
download_dir/<scene_id>/<filename>
Functions
|
Open one or more STAC asset bands as rioxarray DataArrays. |
- landstac.read.read_stac_bands(item, bands=('blue', 'green', 'red', 'nir08'), overview_level=None, to_linear=False, session=None, download_dir=None, in_memory=False)[source]¶
Open one or more STAC asset bands as rioxarray DataArrays.
- Parameters:
item (pystac.Item) – STAC item.
bands (Iterable[str]) – Asset keys to open (e.g., [“blue”,”green”,”red”,”nir08”]).
overview_level (int or None) – None for native resolution; integer for an internal overview.
to_linear (bool) – Apply 10**(x/10) conversion (e.g., Sentinel-1 dB -> linear).
session (requests.Session, optional) – Authenticated ERS session. Required for protected assets if using download_dir or in_memory.
download_dir (str, optional) – Cache directory; files are stored under download_dir/<scene_id>/<filename>.
in_memory (bool) – If True, stream the full asset into RAM and open from memory file.
- Returns:
Mapping {band_name: DataArray}.
- Return type: