home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 335608017

This data as json

id node_id number title user state locked assignee milestone comments created_at updated_at closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
335608017 MDU6SXNzdWUzMzU2MDgwMTc= 2251 netcdf roundtrip fails to preserve the shape of numpy arrays in attributes 90008 closed 0     5 2018-06-25T23:52:07Z 2018-08-29T16:06:29Z 2018-08-29T16:06:28Z CONTRIBUTOR      

Code Sample

```python import numpy as np import xarray as xr

a = xr.DataArray(np.zeros((3, 3)), dims=('y', 'x')) a.attrs['my_array'] = np.arange(6, dtype='uint8').reshape(2, 3)

a.to_netcdf('a.nc') b = xr.open_dataarray('a.nc') b.load() assert np.all(b == a) print('all arrays equal')

assert b.dtype == a.dtype print('dtypes equal')

print(a.my_array.shape) print(b.my_array.shape) assert a.my_array.shape == b.my_array.shape ```

Problem description

I have some metadata that is in the form of numpy arrays. I would think that it should round trip with netcdf.

Expected Output

equal shapes inside the metadata

Output of xr.show_versions()

INSTALLED VERSIONS ------------------ commit: None python: 3.6.5.final.0 python-bits: 64 OS: Linux OS-release: 4.16.15-300.fc28.x86_64 machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: en_US.UTF-8 xarray: 0.10.7 pandas: 0.23.0 numpy: 1.14.4 scipy: 1.1.0 netCDF4: 1.4.0 h5netcdf: 0.6.1 h5py: 2.8.0 Nio: None zarr: None bottleneck: 1.2.1 cyordereddict: None dask: 0.17.5 distributed: 1.21.8 matplotlib: 2.2.2 cartopy: None seaborn: None setuptools: 39.2.0 pip: 9.0.3 conda: None pytest: 3.6.1 IPython: 6.4.0 sphinx: 1.7.5
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/2251/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed 13221727 issue

Links from other tables

  • 0 rows from issues_id in issues_labels
  • 5 rows from issue in issue_comments
Powered by Datasette · Queries took 238.93ms · About: xarray-datasette