problem with netCDF4 OpenDAP

George Trojan george.trojan at noaa.gov
Fri Aug 14 12:11:10 EDT 2015


> Subject:
> problem with netCDF4 OpenDAP
> From:
> Tom P <werotizy at freent.dd>
> Date:
> 08/13/2015 10:32 AM
>
> To:
> python-list at python.org
>
>
> I'm having a problem trying to access OpenDAP files using netCDF4.
> The netCDF4 is installed from the Anaconda package. According to their 
> changelog, openDAP is supposed to be supported.
>
> netCDF4.__version__
> Out[7]:
> '1.1.8'
>
> Here's some code:
>
> url = 
> 'http://www1.ncdc.noaa.gov/pub/data/cmb/ersst/v3b/netcdf/ersst.201507.nc'
> nc = netCDF4.Dataset(url)
>
> I get the error -
> netCDF4/_netCDF4.pyx in netCDF4._netCDF4.Dataset.__init__ 
> (netCDF4/_netCDF4.c:9551)()
>
> RuntimeError: NetCDF: file not found
>
>
> However if I download the same file, it works -
> url = '/home/tom/Downloads/ersst.201507.nc'
> nc = netCDF4.Dataset(url)
> print nc
>  . . . .
>
> Is it something I'm doing wrong?
Same thing here:

(devenv-3.4.1) dilbert at gtrojan> python
Python 3.4.1 (default, Jul  7 2014, 15:47:25)
[GCC 4.8.3 20140624 (Red Hat 4.8.3-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
 >>> import netCDF4
 >>> url = 
'http://www1.ncdc.noaa.gov/pub/data/cmb/ersst/v3b/netcdf/ersst.201507.nc'
 >>> nc = netCDF4.Dataset(url)
syntax error, unexpected WORD_WORD, expecting SCAN_ATTR or SCAN_DATASET 
or SCAN_ERROR
context: <!DOCTYPE^ HTML PUBLIC "-//IETF//DTD HTML 
2.0//EN"><html><head><title>404 Not Found</title></head><body><h1>Not 
Found</h1><p>The requested URL 
/pub/data/cmb/ersst/v3b/netcdf/ersst.201507.nc.dds was not found on this 
server.</p></body></html>
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "netCDF4.pyx", line 1466, in netCDF4.Dataset.__init__ 
(netCDF4.c:19738)
RuntimeError: NetCDF: file not found
 >>>

It looks like NCDC does not support OpeNDAP (note the .dds extension in 
the error message). It is not a Python/netCDF4 issue.

(devenv-3.4.1) dilbert at gtrojan> ncdump -h 
http://www1.ncdc.noaa.gov/pub/data/cmb/ersst/v3b/netcdf/ersst.201507.nc
syntax error, unexpected WORD_WORD, expecting SCAN_ATTR or SCAN_DATASET 
or SCAN_ERROR
context: <!DOCTYPE^ HTML PUBLIC "-//IETF//DTD HTML 
2.0//EN"><html><head><title>404 Not Found</title></head><body><h1>Not 
Found</h1><p>The requested URL 
/pub/data/cmb/ersst/v3b/netcdf/ersst.201507.nc.dds was not found on this 
server.</p></body></html>
ncdump: 
http://www1.ncdc.noaa.gov/pub/data/cmb/ersst/v3b/netcdf/ersst.201507.nc: 
NetCDF: file not found


George

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20150814/366e2e6f/attachment.html>


More information about the Python-list mailing list