issues: 673504545
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
673504545 | MDU6SXNzdWU2NzM1MDQ1NDU= | 4311 | uint32 variable in zarr, but float64 when loading with xarray | 49512274 | closed | 0 | 1 | 2020-08-05T12:34:35Z | 2021-04-19T08:59:51Z | 2021-04-19T08:59:51Z | NONE | Hi all, I start to play with xarray and zarr and came across something curious : I create a zarr folder and a zarr variable in uint32. When i load this dataset with xarray, it loads in float64. I don't know if it is something expected ? ```python fichier1 = "/tmp/test.zarr" zh = zarr.open(fichier1, "w") example = np.zeros(10, dtype=np.uint32) myvar = zh.create_dataset("myvar", shape=example.shape, dtype=example.dtype ) myvar.attrs["_ARRAY_DIMENSIONS"] = ["obs"] # <- without this, the zarr dataset will not be readable by xarray myvar[:] = example dtype is uint32zh.myvar.dtype
when reloading with zarr : ```python dtype is stil uint32zh = zarr.open(fichier1, 'r') zh.myvar.dtype ``` ```python
But when loading with xarray : ```python dtype is float64ds = xr.open_zarr(fichier1) ds.myvar.dtype ``` ```python
Is it something expected ? Am I missing something ? link to the notebook created : bad_dtype_zarr_xarray Environment: Output of <tt>xr.show_versions()</tt>INSTALLED VERSIONS ------------------ commit: None python: 3.7.6 (default, Jan 8 2020, 19:59:22) [GCC 7.3.0] python-bits: 64 OS: Linux OS-release: 4.15.0-106-generic machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: fr_FR.UTF-8 LOCALE: fr_FR.UTF-8 libhdf5: 1.10.4 libnetcdf: 4.6.1 xarray: 0.15.1 pandas: 1.0.3 numpy: 1.18.1 scipy: 1.4.1 netCDF4: 1.4.2 pydap: None h5netcdf: None h5py: 2.10.0 Nio: None zarr: 2.3.2 cftime: 1.1.1.1 nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: None dask: 2.13.0 distributed: 2.13.0 matplotlib: 3.1.3 cartopy: None seaborn: None numbagg: None setuptools: 46.1.1.post20200323 pip: 20.0.2 conda: None pytest: 5.4.1 IPython: 7.13.0 sphinx: None |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/4311/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |