issues: 980549418
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
980549418 | MDU6SXNzdWU5ODA1NDk0MTg= | 5741 | Dataset.to_zarr fails on dask array with zero-length dimension (ZeroDivisonError) | 4666753 | closed | 0 | 0 | 2021-08-26T18:57:00Z | 2021-10-10T00:02:42Z | 2021-10-10T00:02:42Z | CONTRIBUTOR | What happened: I have an What you expected to happen: I expect it to save without any errors. Minimal Complete Verifiable Example: the following commands fail. ```python import numpy as np import xarray as xr ds = xr.Dataset( {"x": (("a", "b", "c"), np.empty((75, 0, 30))), "y": (("a", "c"), np.random.normal(size=(75, 30)))}, {"a": np.arange(75), "b": [], "c": np.arange(30)}, ).chunk({}) ds.to_zarr("fails.zarr") # RAISES ZeroDivisionError ``` Anything else we need to know?: If we load all the empty arrays to numpy, it is able to save correctly. That is:
I'll make a PR using this solution, but not sure if this is a deeper bug that should be fixed in zarr or in a nicer way. Environment: Output of <tt>xr.show_versions()</tt>``` INSTALLED VERSIONS ------------------ commit: None python: 3.8.8 | packaged by conda-forge | (default, Feb 20 2021, 16:22:27) [GCC 9.3.0] python-bits: 64 OS: Linux OS-release: 5.4.72-microsoft-standard-WSL2 machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: C.UTF-8 LOCALE: ('en_US', 'UTF-8') libhdf5: 1.10.6 libnetcdf: 4.8.0 xarray: 0.19.0 pandas: 1.2.4 numpy: 1.20.2 scipy: 1.7.1 netCDF4: 1.5.6 pydap: None h5netcdf: None h5py: 2.10.0 Nio: None zarr: 2.9.3 cftime: 1.5.0 nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: None dask: 2021.08.1 distributed: 2021.08.1 matplotlib: 3.4.1 cartopy: None seaborn: None numbagg: None pint: None setuptools: 49.6.0.post20210108 pip: 21.0.1 conda: None pytest: None IPython: 7.22.0 sphinx: None ``` |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/5741/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |