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:
  • provider (str) – The provider from which the product originates

  • properties (dict[str, Any]) – The metadata of the product

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:
provider: str#

The provider from which the product originates

properties: dict[str, Any]#

The metadata of the product

product_type: str | None#

The product type

geometry: BaseGeometry#

The geometry of the product

search_intersection: BaseGeometry | None#

The intersection between the product’s geometry and the search area.

location: str#

The path to the product, either remote or local if downloaded

remote_location: str#

The remote path to the product

assets: AssetsDict#

Assets of the product

driver: DatasetDriver#

Driver enables additional methods to be called on the EOProduct

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 location attribute 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 progress

  • wait (float, default: 0.2) – (optional) If download fails, wait time in minutes between two download tries

  • timeout (float, default: 10) – (optional) If download fails, maximum time in minutes before stop retrying to download

  • kwargs (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:

str

Returns:

The absolute path to the downloaded product on the local filesystem

Raises:

PluginImplementationError

Raises:

RuntimeError

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’s output_dir config 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:

str

Returns:

The absolute path of the downloaded quicklook

Conversion#

EOProduct.as_dict()[source]#

Builds a representation of EOProduct as a dictionary to enable its geojson serialization

Return type:

dict[str, Any]

Returns:

The representation of a EOProduct as a Python dict

classmethod EOProduct.from_geojson(feature)[source]#

Builds an EOProduct object from its representation as geojson

Parameters:

feature (dict[str, Any]) – The representation of a EOProduct as a Python dict

Return type:

EOProduct

Returns:

An instance of EOProduct

Interface#

property EOProduct.__geo_interface__: dict[str, Any]#

Builds a representation of EOProduct as a dictionary to enable its geojson serialization

Returns:

The representation of a EOProduct as a Python dict

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.EOProduct and 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 retrieved

  • wait (float, default: 0.2) – (optional) If order is needed, wait time in minutes between two order status check

  • timeout (float, default: 10) – (optional) If order is needed, maximum time in minutes before stop checking order status

  • roles (Iterable[str], default: {'data-mask', 'data'}) – (optional) roles of assets that must be fetched

  • xarray_kwargs (Any) – (optional) keyword arguments passed to xarray.open_dataset()

Return type:

XarrayDict

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 opened

  • wait (float, default: 0.2) – (optional) If order is needed, wait time in minutes between two order status check

  • timeout (float, default: 10) – (optional) If order is needed, maximum time in minutes before stop checking order status

Return type:

OpenFile

Returns:

product data file object

EOProduct.rio_env(dataset_address=None)[source]#

Get rasterio environment

Parameters:

dataset_address (str | None, default: None) – address of the data to read

Return type:

Env | nullcontext

Returns:

The rasterio environment

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 returned

  • resolution (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 to rasterio.vrt.WarpedVRT

  • rioxr_kwargs (Any) – kwargs passed to rioxarray.open_rasterio()

Return type:

Dataset | DataArray | list[Dataset]

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.