Hi there, I'm downloading a small test subset of total precip from ERA5 through CDS API. I think that my download is working properly, however, when I try to use the netcdf4 dataset command to open the file through opendap, I get an error saying the file cannot be found. Am I not opening the download correctly? I just started using this source very recently and I realize this could also be a python/netcdf4 issue (just trying to figure out where to troubleshoot). Code below – 


In[3]: import cdsapi

c = cdsapi.Client()

c.retrieve(
'reanalysis-era5-single-levels',
{
'product_type':'reanalysis',
'variable':'total_precipitation',
'year':'2014',
'month':[
'06'
],
'day':[
'01','02','03'
],
'time':[
'00:00','01:00','02:00',
'03:00','04:00','05:00',
'06:00','07:00','08:00',
'09:00','10:00','11:00',
'12:00','13:00','14:00',
'15:00','16:00','17:00',
'18:00','19:00','20:00',
'21:00','22:00','23:00'
],
'format':'netcdf'
},
'download.nc')

2019-08-13 17:55:30,327 INFO Sending request to https://cds.climate.copernicus.eu/api/v2/resources/reanalysis-era5-single-levels
2019-08-13 17:55:30,770 INFO Request is completed
2019-08-13 17:55:30,771 INFO Downloading http://136.156.133.42/cache-compute-0014/cache/data3/adaptor.mars.internal-1565729310.0289395-13532-9-b8efddf2-abca-417a-a7ae-0d8bad2fc387.nc to download.nc (142.6M)
2019-08-13 17:55:47,135 INFO Download rate 8.7M/s
Out[3]: Result(content_length=149516548,content_type=application/x-netcdf,location=http://136.156.133.42/cache-compute-0014/cache/data3/adaptor.mars.internal-1565729310.0289395-13532-9-b8efddf2-abca-417a-a7ae-0d8bad2fc387.nc)

In[4]: from netCDF4 import Dataset
data = Dataset('http://136.156.133.42/cache-compute-0014/cache/data3/adaptor.mars.internal-1565729310.0289395-13532-9-b8efddf2-abca-417a-a7ae-0d8bad2fc387.nc')

Out[4]: from netCDF4 import Dataset
data = Dataset('http://136.156.133.42/cache-compute-0014/cache/data3/adaptor.mars.internal-1565729310.0289395-13532-9-b8efddf2-abca-417a-a7ae-0d8bad2fc387.nc')
syntax error, unexpected WORD_WORD, expecting SCAN_ATTR or SCAN_DATASET or SCAN_ERROR
context: <html^><head><title>404 Not Found</title></head><body><center><h1>404 Not Found</h1></center><hr><center>nginx/1.16.0</center></body></html>
Traceback (most recent call last):

File "<ipython-input-4-5af935da6a02>", line 2, in <module>
data = Dataset('http://136.156.133.42/cache-compute-0014/cache/data3/adaptor.mars.internal-1565729310.0289395-13532-9-b8efddf2-abca-417a-a7ae-0d8bad2fc387.nc')

File "netCDF4/_netCDF4.pyx", line 2135, in netCDF4._netCDF4.Dataset.__init__

File "netCDF4/_netCDF4.pyx", line 1752, in netCDF4._netCDF4._ensure_nc_success

OSError: [Errno -90] NetCDF: file not found: b'http://136.156.133.42/cache-compute-0014/cache/data3/adaptor.mars.internal-1565729310.0289395-13532-9-b8efddf2-abca-417a-a7ae-0d8bad2fc387.nc'

5 Comments

  1. Hi Rachel,

    When you finished running your Python script, the NetCDF file download.nc should be available on your local disk. Please open it as you wish. The URL you were using below points to the cache on the CDS. And data in the cache could be deleted at any time.

    http://136.156.133.42/cache-compute-0014/cache/data3/adaptor.mars.internal-1565729310.0289395-13532-9-b8efddf2-abca-417a-a7ae-0d8bad2fc387.nc

    I hope this helps.

    Regards,

    Xiaobo

    1. Thank you, Xiaobo. I did not properly locate the download.nc file my first time but redid the download in the proper directory/with a new name.

  2. Is everything working fine now?

    1. yes, thank you for your replies!