CS-SI / eodag

Earth Observation Data Access Gateway
https://eodag.readthedocs.io
Apache License 2.0
324 stars 44 forks source link

inconsistent number of results #1188

Closed gch-meoss closed 4 months ago

gch-meoss commented 5 months ago

Hello

for specific request eodag seem to return too much results.

request https://peps.cnes.fr/resto/api/collections/S1/search.json?tileid=31TCJ&sensorMode=IW&polarisation=VV VH&startDate=2020-02-01&completionDate=2020-02-16&productType=GRD&maxRecords=20&page=1

return Found 11892 result(s) on provider 'peps' which seem really too much

when i use PEPS plateform I find about 17 products https://peps.cnes.fr/rocket/#/search?maxRecords=50&productType=GRD&sensorMode=IW&box=0.7553100585937498,43.230195712668774,1.8292236328124998,43.89492363306684&polarisation=VV%20VH&collection=S1&startDate=2020-02-01T00:00:00&completionDate=2020-02-16T00:00:02&page=1

do you have an idea why ?

Code To Reproduce

import os
from eodag import EODataAccessGateway, setup_logging
from dotenv import load_dotenv

load_dotenv()

dag = EODataAccessGateway()
setup_logging(verbose=3)

dag.set_preferred_provider("theia")
dag.providers_config["theia"].auth.credentials["ident"] = os.getenv("THEIA_LOGIN")
dag.providers_config["theia"].auth.credentials["pass"] = os.getenv("THEIA_PASSWORD")

os.environ["EODAG__THEIA__SEARCH__TIMEOUT"] = "10"  # not sure about utility of this

next_page = True
page = 1
print("finding products...")
while next_page or page > 50:

    search_results, total_count = dag.search(
        productType='S1_SAR_GRD',
        start='2020-02-01',
        end='2020-02-16',
        tileIdentifier='31TCJ',
        sensorMode="IW",
        polarizationMode="VV VH",
        page=page
    )

    if not search_results:
        next_page = False
    else:
        print(f"page {page}, {len(search_results)} products...")
        page = page + 1

Output

finding products...
finding products...
2024-06-07 09:42:00,542 eodag.core                       [WARNING ] (tid=139964516270080) Product type 'S1_SAR_GRD' is not available with provider 'theia'. Searching it on provider 'peps' instead.
2024-06-07 09:42:00,543 eodag.search.base                [DEBUG   ] (tid=139964516270080) Mapping eodag product type to provider product type
2024-06-07 09:42:00,543 eodag.search.base                [DEBUG   ] (tid=139964516270080) Getting provider product type definition parameters for S1_SAR_GRD
2024-06-07 09:42:00,543 eodag.search.qssearch            [DEBUG   ] (tid=139964516270080) Building the query string that will be used for search
2024-06-07 09:42:00,543 eodag.product.metadata_mapping   [DEBUG   ] (tid=139964516270080) Retrieving queryable metadata from metadata_mapping
2024-06-07 09:42:00,543 eodag.search.qssearch            [INFO    ] (tid=139964516270080) Sending search request: https://peps.cnes.fr/resto/api/collections/S1/search.json?tileid=31TCJ&sensorMode=IW&polarisation=VV VH&startDate=2020-02-01&completionDate=2020-02-16&productType=GRD&maxRecords=20&page=1
2024-06-07 09:42:01,927 eodag.search.qssearch            [DEBUG   ] (tid=139964516270080) Adapting 20 plugin results to eodag product representation
2024-06-07 09:42:02,041 eodag.core                       [INFO    ] (tid=139964516270080) Found 11892 result(s) on provider 'peps'

Environment:

sbrunato commented 4 months ago

Hello @gch-meoss , the difference comes from the geometry that is in one request and not in the other:

Please also note that if you need to fetch all products and not only the first page of results, you can use [search_all](https://eodag.readthedocs.io/en/stable/notebooks/api_user_guide/4_search.html#search_all()) or [search_iter_page](https://eodag.readthedocs.io/en/stable/notebooks/api_user_guide/4_search.html#search_iter_page()) methods

gch-meoss commented 4 months ago

ok thank your very much for your support, so if I understand well it is the peps rocket api which did not manage well the "tileIdentifier" arguments ?

dag.search( provider="peps", productType='S1_SAR_GRD', start='2020-02-01', end='2020-02-16', sensorMode="IW", polarizationMode="VV VH", geom=[0.7553100585937498, 43.230195712668774, 1.8292236328124998, 43.89492363306684], )

give me 17 results whereas

dag.search( provider="peps", productType='S1_SAR_GRD', start='2020-02-01', end='2020-02-16', tileIdentifier='31TCJ', sensorMode="IW", polarizationMode="VV VH", )

give me incoherent number of results

sbrunato commented 4 months ago

search by tileIdentifier is only available for Sentiel-2 tiled product types on peps. This parameter will be ignored on non-tiled Sentinel-1 product types. You can see on their web-ui that the tile-specific form only appears for Sentinel-2. Also, tileid is listed in https://peps.cnes.fr/resto/api/collections/S2ST/describe.xml but not https://peps.cnes.fr/resto/api/collections/S1/describe.xml