Assets#
The Assets module provides classes and methods to manage and interact with assets associated with EOProduct.
These assets can include files, metadata, or other resources that are part of a product’s data package.
The module offers functionality for accessing, manipulating, and extending asset-related operations.
- class eodag.api.product._assets.AssetsDict(product, *args, **kwargs)[source]#
A UserDict object which values are
Assetcontained in aEOProductresulting from a search.- Parameters:
Example#
>>> from eodag.api.product import EOProduct >>> product = EOProduct( ... provider="foo", ... properties={"id": "bar", "geometry": "POINT (0 0)"} ... ) >>> type(product.assets) <class 'eodag.api.product._assets.AssetsDict'> >>> product.assets.update({"foo": {"href": "http://somewhere/something"}}) >>> product.assets {'foo': {'href': 'http://somewhere/something'}}
- as_dict()[source]#
Builds a representation of AssetsDict to enable its serialization
- Return type:
- Returns:
The representation of a
AssetsDictas a Python dict
- class eodag.api.product._assets.Asset(product, key, *args, **kwargs)[source]#
A UserDict object containg one of the
assetsresulting from a search.- Parameters:
Example#
>>> from eodag.api.product import EOProduct >>> product = EOProduct( ... provider="foo", ... properties={"id": "bar", "geometry": "POINT (0 0)"} ... ) >>> product.assets.update({"foo": {"href": "http://somewhere/something"}}) >>> type(product.assets["foo"]) <class 'eodag.api.product._assets.Asset'> >>> product.assets["foo"] {'href': 'http://somewhere/something'}
- download(**kwargs)[source]#
Downloads a single asset
- Parameters:
kwargs (
Unpack[DownloadConf]) – (optional) Additional named-arguments passed to plugin.download()- Return type:
- Returns:
The absolute path to the downloaded product on the local filesystem
- stream_download(**kwargs)[source]#
Downloads a single asset as StreamResponse
- Parameters:
kwargs (
Unpack[DownloadConf]) – (optional) Additional named-arguments passed to plugin.download()- Return type:
- Returns:
StreamResponse stream representation of the asset file
Pixel access#
Warning
The following methods will only be available with eodag-cube installed.
- class eodag_cube.api.product._assets.AssetsDict#
Inherits from
eodag.api.product._assets.AssetsDictand implements pixel access related methods.
- class eodag_cube.api.product._assets.Asset#
Inherits from
eodag.api.product._assets.Assetand implements pixel access related methods.
- Asset.to_xarray(wait=0.2, timeout=10, **xarray_kwargs)[source]#
Return asset data as a
xarray.Dataset.- Parameters:
wait (
float, default:0.2) – (optional) If order is needed, wait time in minutes between two order status checktimeout (
float, default:10) – (optional) If order is needed, maximum time in minutes before stop checking order statusxarray_kwargs (
Any) – (optional) keyword arguments passed toxarray.open_dataset()
- Return type:
- Returns:
Asset data as a
xarray.Dataset