issues: 862110000
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
862110000 | MDU6SXNzdWU4NjIxMTAwMDA= | 5192 | Writing np.bool8 data array reads in as int8 | 193170 | closed | 0 | 2 | 2021-04-19T23:33:20Z | 2021-04-20T05:19:44Z | 2021-04-20T05:19:44Z | NONE | What happened: I have an dataarray with dtype What you expected to happen: The loaded data array should have dtype bool Minimal Complete Verifiable Example: I have had a hard time reducing this to a sample. The data array comes from a larger dataset which exhibits the same problem. I can copy the dataarray using copy() and it still exhibits the problem; however if I build a new data array using the constructor, the new array doesn't exhibit the problem. As far as I can tell, though, the original and the rebuilt dataarray are otherwise identical. ```python in a pdb session(Pdb) ci <xarray.DataArray 'cut_inclusive' (cut: 15)> array([False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]) Dimensions without coordinates: cut (Pdb) ci.to_netcdf('foo_ci.nca', engine="h5netcdf") (Pdb) csi = xr.read_dataarray('foo_ci_nca', engine="h5netcdf"); csi <xarray.DataArray 'cut_inclusive' (cut: 15)> array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], dtype=int8) Dimensions without coordinates: cut (Pdb) ci2 = xr.DataArray(ci, dims=('cut', )) (Pdb) ci2.equals(ci) True (Pdb) ci2.to_netcdf('foo_ci2.nca', engine="h5netcdf") (Pdb) csi2 = xr.open_dataarray('foo_ci2.nca', engine="h5netcdf"); csi2 <xarray.DataArray 'cut_inclusive' (cut: 15)> array([False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]) Dimensions without coordinates: cut (Pdb) ci3 = ci.copy() (Pdb) ci3.to_netcdf('foo_ci3.nca', engine="h5netcdf") (Pdb) csi3 = xr.open_dataarray('foo_ci3.nca', engine="h5netcdf"); csi3 <xarray.DataArray 'cut_inclusive' (cut: 15)> array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], dtype=int8) Dimensions without coordinates: cut ``` Anything else we need to know?: I am at a loss how to investigate why Environment: Output of <tt>xr.show_versions()</tt>xr.show_versions() INSTALLED VERSIONS ------------------ commit: None python: 3.8.5 (default, Sep 4 2020, 07:30:14) [GCC 7.3.0] python-bits: 64 OS: Linux OS-release: 5.8.0-48-generic machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: en_US.UTF-8 libhdf5: 1.12.0 libnetcdf: None xarray: 0.17.0 pandas: 1.2.4 numpy: 1.20.2 scipy: 1.6.2 netCDF4: None pydap: None h5netcdf: 0.10.0 h5py: 3.2.1 Nio: None zarr: None cftime: None nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: None dask: 2021.04.0 distributed: 2021.04.0 matplotlib: 3.4.1 cartopy: None seaborn: None numbagg: None pint: None setuptools: 51.0.0 pip: 20.3.1 conda: None pytest: 6.2.3 IPython: 7.22.0 sphinx: None |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/5192/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |