Skip to content

Partial read: Improvement to error messages #110

@jm9176

Description

@jm9176

Here, I am using the zarr array stored here: https://github.com/mathworks/MATLAB-support-for-Zarr-files/tree/main/test

  1. Start parameter is out of bounds
>> out = zarrread('grp_v2/arr_v2',Start=[30 40])
Error using ZarrPy>readZarr (line 107)
Python Error: IndexError: Computing interval slice for dimension 0: (29, 19) do not specify a valid closed index
interval [source
locations='tensorstore/index_interval.cc:358\ntensorstore/index_interval.cc:401\ntensorstore/index_space/internal/numpy_indexing_spec.cc:499\ntensorstore/index_space/internal/numpy_indexing_spec.cc:499\ntensorstore/index_space.h:438']

Error in zarrread (line 36)
data = zarrObj.read(options.Start, options.Count, options.Stride);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  1. Count parameter is out of bounds
>> out = zarrread('grp_v2/arr_v2',Start=[],Count=[30 40])
Error using ZarrPy>readZarr (line 107)
Python Error: ValueError: OUT_OF_RANGE: Propagated bounds [0, 20), with size=20, for dimension 0 are
incompatible with existing bounds [0, 30), with size=30. [transform='Rank 2 -> 2 index space transform:   Input
domain:     0: [0, 30)     1: [0, 40)   Output index maps:     out[0] = 0 + 1 * in[0]     out[1] = 0 + 1 * in[1]
'] [domain='{origin={0, 0}, shape={20, 25}}'] [source
locations='tensorstore/index_space/internal/propagate_bounds.cc:285\ntensorstore/index_space/index_transform.h:991']

Error in zarrread (line 36)
data = zarrObj.read(options.Start, options.Count, options.Stride);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  1. @krisfed For the following case, we have been following to read the whole HDF5 dataset if the input is defined as inf, so would you prefer a similar behavior in case of zarr partial read as well?

If any element of count is Inf, then h5read reads until the end of the corresponding dimension.(ref)

>> zarrread('prt_grp/arr_1',Count=[inf inf])
Error using zarrread (line 31)
 zarrread('prt_grp/arr_1',Count=[inf inf])
                                ^^^^^^^^^
Invalid value for 'Count' argument. Value must be integer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions