Assets#
- class eodag.api.product._assets.AssetsDict(product, *args, **kwargs)[source]#
A UserDict object which values are
Asset
contained in aEOProduct
resulting 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
AssetsDict
as a Python dict
- class eodag.api.product._assets.Asset(product, key, *args, **kwargs)[source]#
A UserDict object containg one of the
assets
resulting 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
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.AssetsDict
and implements pixel access related methods.
- class eodag_cube.api.product._assets.Asset#
Inherits from
eodag.api.product._assets.Asset
and 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
- Asset.rio_env()[source]#
Get rasterio environment
- Return type:
Env
|nullcontext
- Returns:
The rasterio environment
- Asset.get_data(crs=None, resolution=None, extent=None, resampling=None, **rioxr_kwargs)[source]#
Retrieves asset raster data abstracted by the
eodag.api.product._product.EOProduct
- Parameters:
crs (
str
|None
, default:None
) – (optional) The coordinate reference system in which the dataset should be returnedresolution (
float
|None
, default:None
) – (optional) The resolution in which the dataset should be returned (given in the unit of the crs)extent (
str
|Dict
[str
,float
] |List
[float
] |BaseGeometry
|None
, default:None
) –(optional) The coordinates on which to zoom, matching the given CRS. Can be defined in different ways (its bounds will be used):
with a Shapely geometry object:
shapely.geometry.base.BaseGeometry
with a bounding box (dict with keys: “lonmin”, “latmin”, “lonmax”, “latmax”):
dict.fromkeys(["lonmin", "latmin", "lonmax", "latmax"])
with a bounding box as list of float:
[lonmin, latmin, lonmax, latmax]
with a WKT str
resampling (
Resampling
|None
, default:None
) – (optional) Warp resampling algorithm passed torasterio.vrt.WarpedVRT
rioxr_kwargs (
Any
) – kwargs passed torioxarray.open_rasterio()
- Return type:
- Returns:
The numeric matrix corresponding to the sub dataset or an empty array if unable to get the data
Deprecated since version 0.6.0b1: Use the
eodag_cube.api.product._assets.Asset.to_xarray()
method instead.