dep_tools.loaders module
ABC definition and implementation of Loader objects.
- class dep_tools.loaders.Loader[source]
Bases:
ABCA base class for something that loads data based on input areas.
- class dep_tools.loaders.StacLoader[source]
Bases:
LoaderA loader which loads data based on (STAC) items and areas.
- class dep_tools.loaders.OdcLoader(load_as_dataset=True, clip_to_areas=False, **kwargs)[source]
Bases:
StacLoaderA wrapper around
odc.stac.load().In addition to allowing conformance to the
Loaderform, this class offers a number of convenience operations which complimentodc.stac.load():If the data is loaded as floating point, any nodata values (as defined by the “nodata” attribute of the loaded data) are set to NaN, and the attribute itself is reset to NaN.
The nodata value is also set to be accessed via the rioxarray accessor (.rio.nodata).
- Parameters:
load_as_dataset (
bool) – If False, load as a DataArray with each variable in the band dimension.clip_to_areas (
bool) – If True, loaded data is clipped to the given areas usingodc.geo.mask().**kwargs – Additional arguments to
odc.stac.load().
- load(items, areas=None)[source]
Load STAC Items into an xarray object.
If nodata is passed as a kwarg on initialization, or the stac item contains the nodata value, xr[variable].nodata will be set on load.
- Parameters:
items (
Iterable[Item]) – The items to load.areas (
Union[GeoDataFrame,GeoBox,None]) – If clip_to_areas is True, the output is clipped to these areas.
- Return type:
Dataset|DataArray- Returns:
If load_to_dataset is True on initialization, a
xarray.Datasetis returned. Otherwise axarray:DataArrayis returned, with variables set on the “band” dimension.- Raises:
ValueError – If areas is a GeoBox and clip_to_areas is set to True.
- class dep_tools.loaders.StackStacLoader(stack_kwargs={'resolution': 30}, resamplers_and_assets=None, **kwargs)[source]
Bases:
StacLoader