Hint

You can run this notebook in a live session with Binder.

Configuration#

[1]:
from eodag import EODataAccessGateway

Add or update a provider#

An EODataAccessGateway object has the methods add_provider() to quickly add a new provider, and update_providers_config() that allows to either add a new provider or to update an existing one. The example below shows how to add a STAC provider using both methods.

[2]:
dag = EODataAccessGateway()
dag.available_providers()
[2]:
['peps',
 'cop_ads',
 'cop_cds',
 'cop_dataspace',
 'cop_ewds',
 'cop_marine',
 'creodias',
 'dedt_lumi',
 'earth_search',
 'earth_search_cog',
 'earth_search_gcs',
 'ecmwf',
 'eumetsat_ds',
 'geodes',
 'onda',
 'planetary_computer',
 'sara',
 'theia',
 'usgs_satapi_aws']
[3]:
dag.add_provider("uvt", "https://stac.sage.uvt.ro/search")

which is equivalent to:

[4]:
dag.update_providers_config("""
    uvt2:
        search:
            type: StacSearch
            api_endpoint: https://stac.sage.uvt.ro/search
        products:
            GENERIC_PRODUCT_TYPE:
                productType: '{productType}'
        download:
            type: HTTPDownload
""")
[5]:
"uvt" in dag.available_providers(), "uvt2" in dag.available_providers()
[5]:
(True, True)

Set a provider’s priority#

The method set_preferred_provider() can be used to dynamically set the preferred provider/prioritary.

And the method get_preferred_provider() will return the current preferred/prioritary provider associated to its priority.

By default, if priority is not passed as argument, add_provider() sets the added provider as the preferred one:

[6]:
dag.get_preferred_provider()
[6]:
('uvt', 2)
[7]:
dag.set_preferred_provider("uvt2")
dag.get_preferred_provider()
[7]:
('uvt2', 3)

Logging#

Logging is activated with the setup_logging() method. It’s a useful way to see what eodag does under the hood (e.g. requesting the provider, adapting the response, etc.). It’s also useful to detect when things go wrong and create an issue on GitHub if relevant.

The method accepts the following values for its verbose parameter:

  • 0: no logging and no progress bar

  • 1: no logging but progress bars displayed

  • 2: log at the INFO level

  • 3: log at the DEBUG level (even more information)

[8]:
from eodag import setup_logging
setup_logging(verbose=2)
[9]:
EODataAccessGateway()
2024-11-06 12:47:36,433 eodag.config                     [INFO    ] Loading user configuration from: /home/docs/.config/eodag/eodag.yml
2024-11-06 12:47:36,470 eodag.core                       [INFO    ] usgs: provider needing auth for search has been pruned because no credentials could be found
2024-11-06 12:47:36,471 eodag.core                       [INFO    ] aws_eos: provider needing auth for search has been pruned because no credentials could be found
2024-11-06 12:47:36,473 eodag.core                       [INFO    ] meteoblue: provider needing auth for search has been pruned because no credentials could be found
2024-11-06 12:47:36,474 eodag.core                       [INFO    ] hydroweb_next: provider needing auth for search has been pruned because no credentials could be found
2024-11-06 12:47:36,475 eodag.core                       [INFO    ] wekeo_main: provider needing auth for search has been pruned because no credentials could be found
2024-11-06 12:47:36,476 eodag.core                       [INFO    ] wekeo_ecmwf: provider needing auth for search has been pruned because no credentials could be found
2024-11-06 12:47:36,477 eodag.core                       [INFO    ] wekeo_cmems: provider needing auth for search has been pruned because no credentials could be found
2024-11-06 12:47:36,478 eodag.core                       [INFO    ] creodias_s3: provider needing auth for search has been pruned because no credentials could be found
2024-11-06 12:47:36,479 eodag.core                       [INFO    ] dedl: provider needing auth for search has been pruned because no credentials could be found
2024-11-06 12:47:36,484 eodag.core                       [INFO    ] Locations configuration loaded from /home/docs/.config/eodag/locations.yml
[9]:
<eodag.api.core.EODataAccessGateway at 0x7f7e77eb49d0>
[ ]: