EOProduct#
EOProduct is the main class representing Earth Observation (EO) products in the EODAG library. It provides a comprehensive interface for interacting with EO products, including metadata access, downloading, and conversion to various formats. This section details the attributes, methods, and additional functionalities available in the EOProduct class.
Constructor#
- class eodag.api.product._product.EOProduct(provider, properties, **kwargs)[source]#
A wrapper around an Earth Observation Product originating from a search.
Every Search plugin instance must build an instance of this class for each of the result of its query method, and return a list of such instances. A EOProduct has a location attribute that initially points to its remote location, but is later changed to point to its path on the filesystem when the product has been downloaded. It also has a remote_location that always points to the remote location, so that the product can be downloaded at anytime if it is deleted from the filesystem. An EOProduct instance also has a reference to the search parameters that led to its creation.
- Parameters:
Note
The geojson spec enforces the expression of geometries as WGS84 CRS (EPSG:4326) coordinates and EOProduct is intended to be transmitted as geojson between applications. Therefore it stores geometries in the before mentioned CRS.
- Parameters:
kwargs (
Any)- Attributes:
-
-
geometry:
BaseGeometry# The geometry of the product
-
search_intersection:
BaseGeometry|None# The intersection between the product’s geometry and the search area.
-
assets:
AssetsDict# Assets of the product
-
driver:
DatasetDriver# Driver enables additional methods to be called on the EOProduct
-
geometry:
Download#
- EOProduct.download(progress_callback=None, wait=0.2, timeout=10, **kwargs)[source]#
Download the EO product using the provided download plugin and the authenticator if necessary.
The actual download of the product occurs only at the first call of this method. A side effect of this method is that it changes the
locationattribute of an EOProduct, from its remote address to the local address.- Parameters:
progress_callback (
ProgressCallback|None, default:None) – (optional) A method or a callable object which takes a current size and a maximum size as inputs and handle progress bar creation and update to give the user a feedback on the download progresswait (
float, default:0.2) – (optional) If download fails, wait time in minutes between two download triestimeout (
float, default:10) – (optional) If download fails, maximum time in minutes before stop retrying to downloadkwargs (
Unpack[DownloadConf]) – output_dir (str), extract (bool), delete_archive (bool) and dl_url_params (dict) can be provided as additional kwargs and will override any other values defined in a configuration file or with environment variables.
- Return type:
- Returns:
The absolute path to the downloaded product on the local filesystem
- Raises:
- Raises:
- EOProduct.get_quicklook(filename=None, output_dir=None, progress_callback=None)[source]#
Download the quicklook image of a given EOProduct from its provider if it exists.
This method retrieves the quicklook URL from the EOProduct metadata and delegates the download to the internal download_quicklook method.
- Parameters:
filename (
str|None, default:None) – (optional) The name to give to the downloaded quicklook. If not given, it defaults to the product’s ID (without file extension).output_dir (
str|None, default:None) – (optional) The absolute path of the directory where to store the quicklooks in the filesystem. If not given, it defaults to the quicklooks directory under this EO product downloader’soutput_dirconfig param (e.g. ‘/tmp/quicklooks/’)progress_callback (
ProgressCallback|None, default:None) – (optional) A method or a callable object which takes a current size and a maximum size as inputs and handle progress bar creation and update to give the user a feedback on the download progress
- Return type:
- Returns:
The absolute path of the downloaded quicklook
Conversion#
Interface#
Pixel access#
Warning
The following methods will only be available with eodag-cube installed.
- class eodag_cube.api.product._product.EOProduct#
Inherits from
eodag.api.product._product.EOProductand implements pixel access related methods.
- EOProduct.to_xarray(asset_key=None, wait=0.2, timeout=10, roles={'data', 'data-mask'}, **xarray_kwargs)[source]#
Return product data as a dictionary of
xarray.Dataset.- Parameters:
asset_key (
str|None, default:None) – (optional) key of the asset. If not specified the whole product data will be retrievedwait (
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 statusroles (
Iterable[str], default:{'data-mask', 'data'}) – (optional) roles of assets that must be fetchedxarray_kwargs (
Any) – (optional) keyword arguments passed toxarray.open_dataset()
- Return type:
- Returns:
a dictionary of
xarray.Dataset
- EOProduct.get_file_obj(asset_key=None, wait=0.2, timeout=10)[source]#
Open data using fsspec
- Parameters:
asset_key (
str|None, default:None) – (optional) key of the asset. If not specified the whole product will be openedwait (
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 status
- Return type:
- Returns:
product data file object
- EOProduct.get_data(band, crs=None, resolution=None, extent=None, resampling=None, **rioxr_kwargs)[source]#
Retrieves all or part of the raster data abstracted by the
EOProduct- Parameters:
band (
str) – The band of the dataset to retrieve (e.g.: ‘B01’)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.BaseGeometrywith 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.WarpedVRTrioxr_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._product.EOProduct.to_xarray()method instead.