rs_server_common.data_retrieval package

Submodules

rs_server_common.data_retrieval.eodag_provider module

EODAG Provider.

class rs_server_common.data_retrieval.eodag_provider.EodagProvider(config_file: Path, provider: str)

Bases: Provider

An EODAG provider.

It uses EODAG to provide data from external sources.

create_eodag_product(product_id, filename)

Initialize an EO product with minimal properties.

The title is used by EODAG as the name of the downloaded file. The download link is used by EODAG as http request url for download. The geometry is mandatory in an EO Product so we add the all earth as geometry.

Parameters:
  • product_id – the id of EO Product

  • filename – the name of the downloaded file

Returns:

the initialized EO Product

download(product_id: str, to_file: Path) None

Download the expected product at the given local location.

EODAG needs an EOProduct to download. We build an EOProduct from the id and download location to be able to call EODAG for download.

Parameters:
  • product_id – the id of the product to download

  • to_file – the path where the product has to be download

Returns:

None

init_eodag_client(config_file: Path) EODataAccessGateway

Initialize the eodag client.

The EODAG client is initialized for the given provider.

Parameters:

config_file – the path to the eodag configuration file

Returns:

the initialized eodag client

lock = <unlocked _thread.lock object>

rs_server_common.data_retrieval.provider module

Provider mechanism.

exception rs_server_common.data_retrieval.provider.CreateProviderFailed

Bases: Exception

Exception raised when an error occurred during the init of a provider.

exception rs_server_common.data_retrieval.provider.DownloadProductFailed

Bases: Exception

Exception raised when an error occurred during the download.

class rs_server_common.data_retrieval.provider.Product(id_: str, metadata: dict[str, str])

Bases: object

A product.

A product has an external identifier and a dictionary of metadata.

id_: str
metadata: dict[str, str]
class rs_server_common.data_retrieval.provider.Provider

Bases: ABC

A product provider.

A provider gives a common interface to search for files from an external data source and download them locally.

abstract download(product_id: str, to_file: Path) None

Download the given product to the given local path.

Parameters:
  • product_id – id of the product to download

  • to_file – path where the file should be downloaded

Returns:

None

search(between: TimeRange, **kwargs) Any

Search for products with the given time range.

The search result is a dictionary of products found indexed by id.

Parameters:

between – the search period

Returns:

The files found indexed by file id. Specific to each provider.

exception rs_server_common.data_retrieval.provider.SearchProductFailed

Bases: Exception

Exception raised when an error occurred during the search.

class rs_server_common.data_retrieval.provider.TimeRange(start: datetime, end: datetime)

Bases: object

A time range.

duration() timedelta

Duration of the timerange.

Returns: duration of the timerange

end: datetime
start: datetime

Module contents

Main package of commons of rs-server services.