Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid parameter timeIntervals when downloading from meteoblue #1413

Open
amarandon opened this issue Nov 21, 2024 · 1 comment
Open

Invalid parameter timeIntervals when downloading from meteoblue #1413

amarandon opened this issue Nov 21, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@amarandon
Copy link
Collaborator

Given this code:

from eodag import EODataAccessGateway, setup_logging
import datetime

setup_logging(3)


dag = EODataAccessGateway()
dag.set_preferred_provider("meteoblue")

tomorrow = (datetime.date.today() + datetime.timedelta(days=1)).isoformat()
after_tomorrow = (datetime.date.today() + datetime.timedelta(days=2)).isoformat()
aoi_bbox = [-5, 40, 10, 45]

products_from_product_type = dag.search(
    start=tomorrow,
    end=after_tomorrow,
    geom=aoi_bbox,
    productType="NEMSGLOBAL_TCDC",
    provider="meteoblue",
)
meteoblue_req_params = {
    "queries":[
        {
            "domain":"NEMSGLOBAL","gapFillDomain":None,"timeResolution":"daily",
            "codes":[{"code":71,"level":"sfc","aggregation":"mean"}],
        }
    ],
    "format": "netCDF",
    "units":{"temperature":"C","velocity":"km/h","length":"metric","energy":"watts"},
    "timeIntervalsAlignment": None,
}

results = dag.search(
    start=tomorrow,
    end=after_tomorrow,
    geom=aoi_bbox,
    **meteoblue_req_params,
)

product = results[0]
product.download()

We get this error:

ValidationError: NEMSGLOBAL_TCDC_20241122_20241123_8b6b1aa3a7cff98e249e49fdf682e2d301107b00 could 
not be ordered {"error_message":"Value was not of type 'Array<JSONValue>' at path 'timeIntervals'. Expected to 
decode Array<JSONValue> but found a string instead.","error":true}

In the output we can see that the parameter timeIntervals is passed as a bare string in the body of the download request:

2024-11-21 15:50:00,709 eodag.download.http              [DEBUG   ] POST https://my.meteoblue.com/dataset/query 
{'User-Agent': 'eodag/3.0.2.dev6+gc8eae412.d20241114'} {'json': {'format': 'netCDF', 'geometry': {"coordinates": [[[-5.0, 40.0], 
[-5.0, 45.0], [10.0, 45.0], [10.0, 40.0], [-5.0, 40.0]]], "type": "Polygon"}, 'runOnJobQueue': True, 'queries': {'codes': [{'aggregation': 
'mean', 'code': 71, 'level': 'sfc'}], 'domain': 'NEMSGLOBAL', 'gapFillDomain': None, 'timeResolution': 'daily'},
'timeIntervals': '2024-11-22/2024-11-22', 'units': {'energy': 'watts', 'length': 'metric', 'temperature': 'C', 'velocity': 'km/h'}}}

Note that in the case of the search request, the timeIntervals parameter is passed wrapped in an array as expected by the API:

2024-11-21 16:00:18,431 eodag.search.qssearch            [DEBUG   ] Query parameters: {"queries": [{"domain": "NEMSGLOBAL", "gapFillDomain": null, "timeResolution": "daily", "codes": [{"code": 71, "level": "sfc"
, "aggregation": "mean"}]}], "format": "netCDF", "units": {"temperature": "C", "velocity": "km/h", "length": "metric", "energy": "watts"},
"timeIntervals": ["2024-11-22/2024-11-22"], "geometry": {"type": "Polygon", "coordinates": [[[-5.0, 40.0], [-5.0, 45.0], [10.0, 45.0], [10.0, 40.0], [-5.0, 40.0]]]}, "checkOnly": true}
@amarandon amarandon added the bug Something isn't working label Nov 21, 2024
@amarandon
Copy link
Collaborator Author

Note that this is blocking resolution of #1385

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants