Drivers#

Drivers enable additional methods to be called on the EOProduct. They are set as driver attribute of the EOProduct during its initialization, using some criteria to determine the most adapted driver. The first driver having its associated criteria matching will be used. If no driver matches, the GenericDriver driver is used by default.

Criteria#

class eodag.api.product.drivers.DriverCriteria[source]#

Driver criteria definition

criteria: list[Callable[..., bool]]#

Function that returns True if the driver is suitable for the given EOProduct

driver: DatasetDriver#

driver to use

eodag.api.product.drivers.DRIVERS: list[DriverCriteria]#

list of drivers and their criteria

Methods available#

class eodag.api.product.drivers.base.DatasetDriver[source]#

Parent class for all dataset drivers.

Drivers will provide methods adapted to a given EOProduct related to predefined criteria.

ASSET_KEYS_PATTERNS_ROLES: list[AssetPatterns] = []#

list of patterns to match asset keys and roles

STRIP_SPECIAL_PATTERN = re.compile('^[^A-Z0-9]+|[^A-Z0-9]+$', re.IGNORECASE)#

strip non-alphanumeric characters at the beginning and end of the key

abstractmethod static match(product, by='*')[source]#

Resolve if given product matches with current driver.

Parameters:
  • product (EOProduct) – product as reference use to extract criteria

  • by (str, default: '*') – specific criteria match

Return type:

bool

Returns:

True if given product matches with current driver, else False

guess_asset_key_and_roles(href, eo_product)[source]#

Guess the asset key and roles from the given href.

Parameters:
  • href (str) – The asset href

  • eo_product (EOProduct) – The product to which the asset belongs

Return type:

tuple[str | None, list[str] | None]

Returns:

The asset key and roles, or (None, None) if the filename extracted from href has no extension

class eodag.api.product.drivers.base.AssetPatterns[source]#

Asset patterns definition

pattern: Pattern#

pattern to match and extract asset key

roles: list[str]#

roles associated to the asset key

Drivers Available#

EODAG currently advertises the following drivers:

generic.GenericDriver()

Generic default Driver

sentinel1.Sentinel1Driver()

Driver for Sentinel1 products

sentinel2.Sentinel2Driver()

Driver for Sentinel2 products