metno / esd

An R-package designed for climate and weather data analysis, empirical-statistical downscaling, and visualisation.
87 stars 30 forks source link

test run error #255

Closed fipoucat closed 2 years ago

fipoucat commented 3 years ago

I a trying to run a test to download data with esd package and get error messages: ERA5.CDS(param='2m_temperature',varnm='t2m',it=2015:2018,lon=c(0,10), lat=c(50,60),

Hope help to find a solution. Thanks

kajsamp commented 3 years ago

The function ERA5.CDS requires that you have installed the python package 'cdsapi' and you have to get an API key from the CDS portal and place it in ~/.cdsapirc. It's all described here: https://pypi.org/project/cdsapi/

I hope this helps. Please let us know if it still doesn't work.

fipoucat commented 3 years ago

Thank you, in fact I have an API in /Users/sarr/.cdsapirc, do I have to set the UID and/or Key somewhere in the esd functions?

On Mon, Dec 14, 2020 at 2:52 PM kajsamp notifications@github.com wrote:

The function ERA5.CDS requires that you have installed the python package 'cdsapi' and you have to get an API key from the CDS portal and place it in ~/.cdsapirc. It's all described here: https://pypi.org/project/cdsapi/

I hope this helps. Please let us know if it still doesn't work.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/metno/esd/issues/255#issuecomment-744492048, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXY6LJ6NW427QI3277FIITSUYRBBANCNFSM4U2ZR7JQ .

kajsamp commented 3 years ago

That shouldn't be necessary and I see now that ERA5.CDS is supposed to install cdsapi for you and give an error message if you don't have the API key in the right place. It seems to me like it is a python related problem. Something goes wrong when importing both pkg_resources and cdsapi. Do you have both of these installed? And what operating system are you running?

fipoucat commented 3 years ago

I have both installed, I can access ERA5 data with a more or less identical package mcera5. I am using OSX system,.

On Mon, Dec 14, 2020 at 3:34 PM kajsamp notifications@github.com wrote:

That shouldn't be necessary and I see now that ERA5.CDS is supposed to install cdsapi for you and give an error message if you don't have the API key in the right place. It seems to me like it is a python related problem. Something goes wrong when importing both pkg_resources and cdsapi. Do you have both of these installed? And what operating system are you running?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/metno/esd/issues/255#issuecomment-744519787, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXY6LKI2HA3ZVKRHYV4RCTSUYV7NANCNFSM4U2ZR7JQ .

fipoucat commented 3 years ago

The first error message related to pip is fixed now but it can't find the cdsap which is well installed. Using the terminal I can import it without problem but not from R!

ERA5.CDS(param='2m_temperature',varnm='t2m',it=2015:2018,lon=c(0,10), lat=c(50,60),FUN='daymean') Requirement already satisfied: cdsapi in /usr/local/lib/python3.9/site-packages (0.4.0) Requirement already satisfied: requests>=2.5.0 in /usr/local/lib/python3.9/site-packages (from cdsapi) (2.25.0) Requirement already satisfied: tqdm in /usr/local/lib/python3.9/site-packages (from cdsapi) (4.54.1) Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.9/site-packages (from requests>=2.5.0->cdsapi) (2020.12.5) Requirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python3.9/site-packages (from requests>=2.5.0->cdsapi) (2.10) Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.9/site-packages (from requests>=2.5.0->cdsapi) (1.26.2) Requirement already satisfied: chardet<4,>=3.0.2 in /usr/local/lib/python3.9/site-packages (from requests>=2.5.0->cdsapi) (3.0.4) [1] "['50','0','60','10']" [1] "'ERA5_t2m_YYYY.nc'" [1] "python ./get-era5-t2m_cds_2015.py" Traceback (most recent call last): File "./get-era5-t2m_cds_2015.py", line 3, in import cdsapi ImportError: No module named cdsapi cdo daymean: Open failed on >ERA5_t2m_2015.nc< No such file or directory

On Mon, Dec 14, 2020 at 3:53 PM Abdoulaye Sarr abdoulayesar@gmail.com wrote:

I have both installed, I can access ERA5 data with a more or less identical package mcera5. I am using OSX system,.

On Mon, Dec 14, 2020 at 3:34 PM kajsamp notifications@github.com wrote:

That shouldn't be necessary and I see now that ERA5.CDS is supposed to install cdsapi for you and give an error message if you don't have the API key in the right place. It seems to me like it is a python related problem. Something goes wrong when importing both pkg_resources and cdsapi. Do you have both of these installed? And what operating system are you running?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/metno/esd/issues/255#issuecomment-744519787, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXY6LKI2HA3ZVKRHYV4RCTSUYV7NANCNFSM4U2ZR7JQ .

fipoucat commented 3 years ago

Sttill wonder why I am getting this error message:

File "./get-era5-t2m_cds_2015.py", line 3, in import cdsapi

kajsamp commented 3 years ago

HI, sorry we don't have an answer for you yet. The code runs smoothly on my computer (on Ubuntu) and I haven't been able to recreate the error. I'll try it on my Mac later today. I think it's an OSX specific problem and that the fault is in the python files generated by the R code (get-era5-t2m_cds_2015.py, get-era5-t2m_cds_2016.py, ...).