Skip to content

NCZarr reading a Zarr file with no variable name #2603

@abhibaruah

Description

@abhibaruah

NetCDF version: 4.9.0
OS: Linux

I am using Zarr Python to create a Zarr file without a variable name.

My Python code:

import zarr
import numpy as np
z1 = zarr.open('example_zarr_py.zarr', mode='w', shape=(100,100), chunks=(10,10), dtype='i4')
z1[:] = 42
z1[0, :] = np.arange(100)
z1[:, 0] = np.arange(100)

The 'example_zarr_py.zarr' folder created has files like '.zarray', '0.0', '0.1'.... (the array data) and does not have a sub-folder with a variable or dataset name or a .zgroup file.

I am trying to read this file using NCZarr.

While I can open this file with:

status = nc_open(FILENAME, NC_NOWRITE, &ncid);
where FILENAME is "file://example_zarr_py.zarr#mode=zarr,file"

I am not sure of how to proceed after this to read the data as the logical next step in netCDF to read a variable is to use 'nc_inq_varid' with the variable name (For example in the example here) or 'nc_inq_var' to get the name of the first variable.

Are these Zarr files with no variable or dataset names and no '.zgroup' files not supported?
If not, how do I read the variable data?

example_zarr_py.zarr.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions