Skip to content

Converting rasm file to netCDF3 using xarray #1114

Closed
pydata/xarray-data
#7
@fmaussion

Description

@fmaussion

This would help new users like #1113 and simplify the RTD build process (#1106).

The problem is that it is not as trivial as expected. On the latest master:

import xarray as xr
ds = xr.tutorial.load_dataset('rasm')
ds.to_netcdf('rasm.nc', format='NETCDF3_CLASSIC', engine='scipy')

Throws an error:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
/home/mowglie/Documents/git/xarray/xarray/backends/api.py in to_netcdf(dataset, path, mode, format, group, engine, writer, encoding)
    516     try:
--> 517         dataset.dump_to_store(store, sync=sync, encoding=encoding)
    518         if isinstance(path, BytesIO):

/home/mowglie/Documents/git/xarray/xarray/core/dataset.py in dump_to_store(self, store, encoder, sync, encoding)
    754         if sync:
--> 755             store.sync()
    756 

/home/mowglie/Documents/git/xarray/xarray/backends/scipy_.py in sync(self)
    149         super(ScipyDataStore, self).sync()
--> 150         self.ds.flush()
    151 

/home/mowglie/.pyvirtualenvs/py3/lib/python3.4/site-packages/scipy/io/netcdf.py in flush(self)
    388         if hasattr(self, 'mode') and self.mode in 'wa':
--> 389             self._write()
    390     sync = flush

/home/mowglie/.pyvirtualenvs/py3/lib/python3.4/site-packages/scipy/io/netcdf.py in _write(self)
    400         self._write_gatt_array()
--> 401         self._write_var_array()
    402 

/home/mowglie/.pyvirtualenvs/py3/lib/python3.4/site-packages/scipy/io/netcdf.py in _write_var_array(self)
    448             for name in variables:
--> 449                 self._write_var_metadata(name)
    450             # Now that we have the metadata, we know the vsize of

/home/mowglie/.pyvirtualenvs/py3/lib/python3.4/site-packages/scipy/io/netcdf.py in _write_var_metadata(self, name)
    466         for dimname in var.dimensions:
--> 467             dimid = self._dims.index(dimname)
    468             self._pack_int(dimid)

ValueError: '2' is not in list

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions