How to use EODAG in Destination Earth

EODAG is a command line tool and a Python package for searching and downloading earth observation data via a unified API regardless of the data provider. Detailed information about the usage of EODAG can be found on the project documentation page.

Querying and interacting with data provided in Destination Earth with EODAG requires configuration of EODAG. The different configuration options provided hereafter will work for all Destination Earth Data Lake services or any external environment with EODAG installed. The complete guide on how to configure EODAG is available via https://eodag.readthedocs.io/en/stable/getting_started_guide/configure.html.

YAML user configuration file

The first time EODAG is used after an install, a default YAML user configuration file is saved in a local directory (~/.config/eodag/eodag.yml on Linux). Update the DEDL providers configuration included in this file by adding the DEDL provider specifically with your username and password.

YAML configuration DEDL provider
dedl:
    priority: 10
    search:
        timeout: 60
    download:
        outputs_prefix:
    auth:
    credentials:
        username: # your DESP user name
        password: # your DESP password

Note

It is recommended to configure a search timeout of 60 seconds or even greater.

This will avoid any unexpected errors because of long running search queries.

One can also directly utilise the YAML format to configure EODAG within Python as depicted in the following example.

DEDL provider configuration directly in Python
from eodag import EODataAccessGateway
from rich.prompt import Prompt

dag = EODataAccessGateway()

username = Prompt.ask(prompt="Username")
pwd = Prompt.ask(prompt="Password", password=True)

dedl_config = \
f"""
dedl:
    priority: 10
    search:
        timeout: 60
    download:
        outputs_prefix:
    auth:
    credentials:
        username: {username}
        password: {pwd}
"""

dag.update_providers_config(yaml_conf=dedl_config)

# Print providers to verify DEDL is available.
providers = dag.available_providers()
print(providers)

Environment variable configuration

In addition, one can configure the DEDL provider by utilising environment variables. Therefore, EODAG makes use of the following naming convention EODAG__KEY1__KEY2__[…]__KEYN (note the double underscore between the keys). This translates into the following environment variables

Environment variables DEDL provider
EODAG__DEDL__PRIORITY=10
EODAG__DEDL__SEARCH__TIMEOUT=60
EODAG__DEDL__AUTH__CREDENTIALS__USERNAME=<your-desp-username>
EODAG__DEDL__AUTH__CREDENTIALS__PASSWORD=<your-desp-password>

An example on how to configure EODAG directly within in Jupyter notebook is provided hereafter.

EODAG configuration example
import os
from eodag import EODataAccessGateway

os.environ["EODAG__DEDL__PRIORITY"]="10"
os.environ["EODAG__DEDL__SEARCH__TIMEOUT"]="60"
os.environ["EODAG__DEDL__AUTH__CREDENTIALS__USERNAME"]="<your-username>"
os.environ["EODAG__DEDL__AUTH__CREDENTIALS__PASSWORD"]="<your-password>"

dag = EODataAccessGateway()
providers = dag.available_providers()
print(providers)

Note

Priority and search timeout have to be provided as a string.

EODAG JupyterLab extension

The EODAG JupyterLab extension is enabled in the Destination Earth Data Lake Stack service JupyterHub. The following steps are required to make the extension work with Destination Earth Data Lake:

  • EODAG user configuration needs to be done either via

    • YAML file configuration, or

    • via environment variables configuration

  • open the EODAG Lab extension in JupyterLab

../../../_images/eodag-lab-icon.png

  • Refresh the EODAG Lab extension to make use of the user configuration

../../../_images/eodag-config-refresh.png

  • DEDL will appear in the dropdown menu of the providers

../../../_images/eodag-dedl-provider.png