Xee icon indicating copy to clipboard operation
Xee copied to clipboard

netCDF conversion issue

Open tylere opened this issue 11 months ago • 2 comments

Discussed in https://github.com/google/Xee/discussions/143

Originally posted by daviddkovacs February 15, 2024 Hi all,

I have successfully retrieved my dataset of interest in xarray.Dataset format, however I would like to export it to process it further locally. My isssue is that when I try to use the dataset.to_netcdf() function, I get the following error:

ValueError                                Traceback (most recent call last)
[/usr/local/lib/python3.10/dist-packages/xarray/backends/api.py](https://localhost:8080/#) in to_netcdf(dataset, path_or_file, mode, format, group, engine, encoding, unlimited_dims, compute, multifile, invalid_netcdf)
   1257         if isinstance(target, BytesIO):
-> 1258             store.sync()
   1259             return target.getvalue()

14 frames
ValueError: 1337 is not in list

During handling of the above exception, another exception occurred:

ValueError                                Traceback (most recent call last)
[/usr/local/lib/python3.10/dist-packages/scipy/io/_netcdf.py](https://localhost:8080/#) in _write_var_metadata(self, name)
    479         self._pack_int(len(var.dimensions))
    480         for dimname in var.dimensions:
--> 481             dimid = self._dims.index(dimname)
    482             self._pack_int(dimid)
    483 

ValueError: 1337 is not in list

Any help would be appreciated Untitled

tylere avatar Jan 23 '25 23:01 tylere

@daviddkovacs could you provide a Minimum Reproducible Example that demonstrates this issue, or let us know if this issue is obsolete?

tylere avatar Jan 24 '25 00:01 tylere

I ran into this recently as well and this can be resolved by installing the netCDF4 Python package as suggested in https://github.com/google/Xee/issues/194

!pip install netCDF4

spatialthoughts avatar Jan 24 '25 08:01 spatialthoughts