ajwdewit / pcse

Repository for the Python Crop Simulation Environment
Other
184 stars 125 forks source link

weather data from NASA provider error #54

Closed emilopez closed 2 years ago

emilopez commented 2 years ago

Dear,

I am using pcse version '5.4.2' from a jupyter lab environment. I am following the user guide but when I try to read the weather observations with nasa provides I get this error:

PCSEError: Failed retrieving POWER data, server returned HTTP code: 422 on following URL https://power.larc.nasa.gov/cgi-bin/v1/DataAccess.py?request=execute&identifier=SinglePoint&parameters=ALLSKY_TOA_SW_DWN%2CALLSKY_SFC_SW_DWN%2CT2M%2CT2M_MIN%2CT2M_MAX%2CT2MDEW%2CWS2M%2CPRECTOT&lat=52.0&lon=5.0&startDate=19830701&endDate=20210921&userCommunity=AG&tempAverage=DAILY&outputList=JSON&user=anonymous

In that link the message is: {"header":"The POWER Legacy API failed to complete your request; please review the errors below and the POWER Docs (https://power.larc.nasa.gov/docs).","messages":["The version one API V2 structure has been deprecated please use the POWER API V2 structure.","The version one API V2 structure has been deprecated please use the POWER API V2 structure.","The version one API V2 structure has been deprecated please use the POWER API V2 structure."]}

The API overview from NASA says: Changes from v1 to v2, No longer able to request multiple file types in a single API request, where previously a link was provided in the outputs section of the JSON response. The API now streams the requested file type directly as a response object.

it is possible to fix that? Any help would be appreciated, Thanks in advance. emiliano

Amarounek commented 2 years ago

Dear @emilopez,

You are using an old version (probably provided by PyPI)... Here you will find a stable version, which is dealing with the new API of the NASA POWER database. It was updated several hours ago and it should work.

So you can install a new version with this command: pip install https://github.com/ajwdewit/pcse/archive/refs/heads/master.zip

emilopez commented 2 years ago

Thanks @Amarounek It worked!

ajwdewit commented 2 years ago

hi all, please update to PCSE 5.5.0 which is now on PyPI. That should solve it.

Allard