Skip to content

opendap and gzipped files #816

@swnesbitt

Description

@swnesbitt

Found an issue with opening opendap files that are remotely gzipped - appears that the scipy netCDF backend is used to read gzipped netCDF, but that backend can't do openDAP apparently? Works with local files.

print(ncfiles[0])
ascat=xr.open_dataset(ncfiles[0])

http://opendap.jpl.nasa.gov/opendap/OceanWinds/ascat/preview/L2/metop_a/12km/2013/027/ascat_20130127_004801_metopa_32553_eps_o_125_2101_ovw.l2.nc.gz
---------------------------------------------------------------------------
IOError                                   Traceback (most recent call last)
<ipython-input-35-c5425b003df3> in <module>()
      1 print(ncfiles[0])
----> 2 ascat=xr.open_dataset(ncfiles[0])

/data/keeling/a/snesbitt/anaconda2/lib/python2.7/site-packages/xarray/backends/api.pyc in open_dataset(filename_or_obj, group, decode_cf, mask_and_scale, decode_times, concat_characters, decode_coords, engine, chunks, lock, drop_variables)
    197                                  'supported on Python 2.6')
    198             try:
--> 199                 store = backends.ScipyDataStore(gzip.open(filename_or_obj))
    200             except TypeError as e:
    201                 # TODO: gzipped loading only works with NetCDF3 files.

/data/keeling/a/snesbitt/anaconda2/lib/python2.7/gzip.pyc in open(filename, mode, compresslevel)
     32 
     33     """
---> 34     return GzipFile(filename, mode, compresslevel)
     35 
     36 class GzipFile(io.BufferedIOBase):

/data/keeling/a/snesbitt/anaconda2/lib/python2.7/gzip.pyc in __init__(self, filename, mode, compresslevel, fileobj, mtime)
     92             mode += 'b'
     93         if fileobj is None:
---> 94             fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb')
     95         if filename is None:
     96             # Issue #13781: os.fdopen() creates a fileobj with a bogus name

IOError: [Errno 2] No such file or directory: 'http://opendap.jpl.nasa.gov/opendap/OceanWinds/ascat/preview/L2/metop_a/12km/2013/027/ascat_20130127_004801_metopa_32553_eps_o_125_2101_ovw.l2.nc.gz'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions