Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rasm.nc is not a valid NetCDF 3 file #1113

Closed
dokeeffe opened this issue Nov 11, 2016 · 8 comments
Closed

rasm.nc is not a valid NetCDF 3 file #1113

dokeeffe opened this issue Nov 11, 2016 · 8 comments

Comments

@dokeeffe
Copy link

dokeeffe commented Nov 11, 2016

Not sure if this is a duplicate of #1106 or something crazy that I'm doing....

I'm attempting to play with the xarray_multidimensional_coords.ipynb but I cant load the sample dataset.
Below are my versions (I just installed xarray using pip today)
('numpy version : ', '1.11.2')
('pandas version : ', u'0.19.0')
('xarray version : ', '0.8.2')

Pasting the full trace below

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-6-3af9bb5e86b6> in <module>()
----> 1 ds = xr.tutorial.load_dataset('rasm')
      2 ds

/usr/local/lib/python2.7/dist-packages/xarray/tutorial.pyc in load_dataset(name, cache, cache_dir, github_url, **kws)
     53         _urlretrieve(url, localfile)
     54 
---> 55     ds = _open_dataset(localfile, **kws).load()
     56 
     57     if not cache:

/usr/local/lib/python2.7/dist-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)
    210                 store = backends.NetCDF4DataStore(filename_or_obj, group=group)
    211             elif engine == 'scipy':
--> 212                 store = backends.ScipyDataStore(filename_or_obj)
    213             elif engine == 'pydap':
    214                 store = backends.PydapDataStore(filename_or_obj)

/usr/local/lib/python2.7/dist-packages/xarray/backends/scipy_.pyc in __init__(self, filename_or_obj, mode, format, group, writer, mmap)
     94             filename_or_obj = BytesIO(filename_or_obj)
     95         self.ds = scipy.io.netcdf_file(
---> 96             filename_or_obj, mode=mode, mmap=mmap, version=version)
     97         super(ScipyDataStore, self).__init__(writer)
     98 

/home/dokeeffe/.local/lib/python2.7/site-packages/scipy/io/netcdf.pyc in __init__(self, filename, mode, mmap, version, maskandscale)
    262 
    263         if mode in 'ra':
--> 264             self._read()
    265 
    266     def __setattr__(self, attr, value):

/home/dokeeffe/.local/lib/python2.7/site-packages/scipy/io/netcdf.pyc in _read(self)
    577         if not magic == b'CDF':
    578             raise TypeError("Error: %s is not a valid NetCDF 3 file" %
--> 579                             self.filename)
    580         self.__dict__['version_byte'] = fromstring(self.fp.read(1), '>b')[0]
    581 

TypeError: Error: /home/dokeeffe/.xarray_tutorial_data/rasm.nc is not a valid NetCDF 3 file
@fmaussion
Copy link
Member

You have to install netCDF4 in order to open the rasm dataset (at least until we convert the file to netCDF3 - this might take a bit).

@dokeeffe
Copy link
Author

Thanks for the fast response!! Yes that did it. All ok now. I'll close the issue.

@chunweiyuan
Copy link
Contributor

When I do conda install netcdf4, it ends up downgrading my numpy from 1.12.0 to 1.11.3, which triggers other dependency-related problems in my code. Is there a different solution to this problem?

@fmaussion
Copy link
Member

Did you try the conda-forge channel to install netcdf4?

https://conda-forge.github.io/

@chunweiyuan
Copy link
Contributor

Just did. Got it to work. Muchas Gracias.

@rabernat
Copy link
Contributor

rabernat commented Apr 28, 2017 via email

@dopplershift
Copy link
Contributor

Anaconda netcdf4 has just been flat out broken: ContinuumIO/anaconda-recipes#89

Not sure how that's really an xarray issue, though.

@fmaussion
Copy link
Member

Note that since pydata/xarray-data#7 , the rasm file can be read with scipy only:

ds = xr.open_dataset('.xarray_tutorial_data/rasm.nc', engine='scipy')

I guess that @chunweiyuan downloaded the file before that change.

We recommend to use conda-forge in the docs, I don't think there's much more we can do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants