Hint

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

Providers and products#

[1]:
from eodag import EODataAccessGateway
dag = EODataAccessGateway()

Providers available#

The method available_providers() returns a list of the pre-configured providers.

[2]:
available_providers = dag.available_providers()
available_providers
[2]:
['astraea_eod',
 'creodias',
 'earth_search',
 'earth_search_cog',
 'ecmwf',
 'mundi',
 'onda',
 'peps',
 'sobloo',
 'theia',
 'usgs_satapi_aws']
[3]:
print(f"eodag has {len(available_providers)} providers already configured.")
eodag has 11 providers already configured.

It can take a product type as an argument and will return the providers known to eodag that offer this product.

[4]:
dag.available_providers("S2_MSI_L1C")
[4]:
['astraea_eod', 'creodias', 'earth_search', 'mundi', 'onda', 'peps', 'sobloo']

Note

If a provider is configured to need authentication for search, and has no crendentials set, it will be pruned on EODAG initialization, and will not appear in available providers list.

Product types available#

The method list_product_types() returns a dictionary that represents eodag’s internal product type catalog.

[5]:
catalog = dag.list_product_types()
[6]:
catalog[0]
[6]:
{'ID': 'L57_REFLECTANCE',
 'abstract': 'Landsat 5,7,8 L2A data (old format) distributed by Theia (2014 to 2017-03-20) using MUSCATE prototype,\nLamber 93 projection.\n',
 'instrument': 'OLI,TIRS',
 'platform': 'LANDSAT',
 'platformSerialIdentifier': 'L5,L7,L8',
 'processingLevel': 'L2A',
 'keywords': 'OLI,TIRS,LANDSAT,L5,L7,L8,L2,L2A,MUSCATE',
 'sensorType': 'OPTICAL',
 'license': 'proprietary',
 'missionStartDate': '2014-01-01T00:00:00Z',
 'missionEndDate': '2017-03-20T00:00:00Z',
 'title': 'Landsat 5,7,8 Level-2A'}
[7]:
products_id = [p["ID"] for p in catalog]
products_id
[7]:
['L57_REFLECTANCE',
 'L8_OLI_TIRS_C1L1',
 'L8_REFLECTANCE',
 'LANDSAT_C2L1',
 'LANDSAT_C2L2ALB_BT',
 'LANDSAT_C2L2ALB_SR',
 'LANDSAT_C2L2ALB_ST',
 'LANDSAT_C2L2ALB_TA',
 'LANDSAT_C2L2_SR',
 'LANDSAT_C2L2_ST',
 'MODIS_MCD43A4',
 'NAIP',
 'OSO',
 'PLD_BUNDLE',
 'PLD_PAN',
 'PLD_PANSHARPENED',
 'PLD_XS',
 'S1_SAR_GRD',
 'S1_SAR_OCN',
 'S1_SAR_RAW',
 'S1_SAR_SLC',
 'S2_MSI_L1C',
 'S2_MSI_L2A',
 'S2_MSI_L2A_COG',
 'S2_MSI_L2A_MAJA',
 'S2_MSI_L2B_MAJA_SNOW',
 'S2_MSI_L2B_MAJA_WATER',
 'S2_MSI_L3A_WASP',
 'S3_EFR',
 'S3_ERR',
 'S3_LAN',
 'S3_OLCI_L2LFR',
 'S3_OLCI_L2LRR',
 'S3_SLSTR_L1RBT',
 'S3_SLSTR_L2LST',
 'S3_SRA',
 'S3_SRA_A_BS',
 'S3_SRA_BS',
 'S3_WAT',
 'SPOT5_SPIRIT',
 'SPOT_SWH',
 'SPOT_SWH_OLD',
 'TIGGE_CF_SFC',
 'VENUS_L1C',
 'VENUS_L2A_MAJA',
 'VENUS_L3A_MAJA']
[8]:
print(f"EODAG has {len(products_id)} product types stored in its internal catalog.")
EODAG has 46 product types stored in its internal catalog.

The method can take a provider name as an argument and will return the product types known to eodag that are offered by this provider.

[9]:
peps_products = dag.list_product_types("peps")
[p["ID"] for p in peps_products]
[9]:
['S1_SAR_GRD', 'S1_SAR_OCN', 'S1_SAR_SLC', 'S2_MSI_L1C', 'S2_MSI_L2A']

Combine these two methods#

These two methods can be combined to find which product type is the most common in eodag’s catalog among all the providers.

[10]:
availability_per_product = []
for product in products_id:
    providers = dag.available_providers(product)
    availability_per_product.append((product, len(providers)))
availability_per_product = sorted(availability_per_product, key=lambda x: x[1], reverse=True)
most_common_p_type, nb_providers = availability_per_product[0]
print(f"The most common product type is '{most_common_p_type}' with {nb_providers} providers offering it.")
The most common product type is 'S2_MSI_L1C' with 7 providers offering it.

These can be also used to find out which provider (as configured by eodag) offers the hights number of different product types.

[11]:
availability_per_provider = []
for provider in dag.available_providers():
    provider_products_id = [
        p["ID"]
        for p in dag.list_product_types(provider)
    ]
    availability_per_provider.append(
        (provider, len(provider_products_id))
    )
availability_per_provider = sorted(availability_per_provider, key=lambda x: x[1], reverse=True)
provider, nb_p_types = availability_per_provider[0]
print(f"The provider with the largest number of product types is '{provider}' with {nb_p_types}.")
The provider with the largest number of product types is 'onda' with 18.