Skip to content
Hyo-Kyung Lee edited this page Jan 12, 2023 · 8 revisions

Use the following to test the latest.

python -m pip install git+https://github.com/zarr-developers/zarr-python.git

It cannot create Zarr file using DataTree from Kerchunk reference file.

File "/Users/hyoklee/miniconda3/lib/python3.9/site-packages/zarr/core.py", line 1888, in _process_chunk
    chunk = ensure_ndarray_like(cdata).view(self._dtype)
ValueError: When changing to a larger dtype, its size must be a divisor of the total size in bytes of the last axis of the array.

The above error is caused by the following code:

            if write_direct:

                # optimization: we want the whole chunk, and the destination is
                # contiguous, so we can decompress directly from the chunk
                # into the destination array
                if self._compressor:
                    if isinstance(cdata, PartialReadBuffer):
                        cdata = cdata.read_full()
                    self._compressor.decode(cdata, dest)
                else:
                    chunk = ensure_ndarray_like(cdata).view(self._dtype)
                    chunk = chunk.reshape(self._chunks, order=self._order)
                    np.copyto(dest, chunk)
                return

It fails to handle the following attribute:

ATL08dt.h5.zarr/ancillary_data/land/night_thresh/.zattrs:    "description": "Solar elevation threshold for determining night time conditions. (Default =0.0)",

Add the following lines to core.py:

                    print(dest)
                    print(self._chunks)
                    print(self._dtype)

Here's the output:

[b'Solar elevation threshold for determining night time conditions. (Default =0.0)']
(1,)
|S80

The use of 'S' is not recommended.

Clone this wiki locally