mathworks / mathworks/MATLAB-support-for-Zarr-files

Request: Support for structured (compound) data types

Open
#121 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
MATLAB
Stars
19
Forks
3
PR merge metrics
No merged PRs in 30d

Description

From the Zarr v2 specification

Structured data types (i.e., with multiple named fields) are encoded as a list of lists, following NumPy array protocol type descriptions (descr). Each sub-list has the form [fieldname, datatype, shape] where shape is optional. fieldname is a string, datatype is a string specifying a simple data type (see above), and shape is a list of integers specifying subarray shape. For example, the JSON list below defines a data type composed of three single-byte unsigned integer fields named “r”, “g” and “b”:


[["r", "|u1"], ["g", "|u1"], ["b", "|u1"]]

I am getting an error when trying to load a compound data type using zarrread.

Error using ZarrDatatype.fromZarrType (line 80)
Invalid argument at position 1. Value must be of type string or be convertible to string.

Error in Zarr/read (line 339)
            obj.Datatype = ZarrDatatype.fromZarrType(info.dtype);
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in zarrread (line 36)
data = zarrObj.read(options.Start, options.Count, options.Stride);
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Dataset: pixel_mask.zip
MATLAB Release: R2024b

Let me know if you need more info!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with ZarrDatatype.fromZarrType at line 80 and trace how Zarr/read at line 339 handles info.dtype before zarrread invokes it at line 36. Use the attached pixel_mask.zip dataset to reproduce the compound dtype error. Done means zarrread can load the structured data type described by the Zarr v2 specification.

Written by the indexing model from the issue text.

Assessment

Tech stack
matlab
Domain
data
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.