Zarrdump: printing metadata of Zarr's from the command line

Hello!

I hope this is an appropriate topic for this forum. I recently wrote a small package to make it easy to inspect metadata of zarr stores from the command-line. It was designed with xarray-dataset zarr stores in mind but also works with generic zarr stores. Pretty much a bare-bones ncdump for zarr:

$ zarrdump gs://my-bucket/dataset.zarr
<xarray.Dataset>
Dimensions:  (lat: 73, lon: 144, time: 32)
Coordinates:
* lat      (lat) float64 -90.0 -87.5 -85.0 -82.5 -80.0 ... 82.5 85.0 87.5 90.0
* lon      (lon) float64 0.0 2.5 5.0 7.5 10.0 ... 350.0 352.5 355.0 357.5
* time     (time) object 2016-12-01 00:00:00 ... 2017-01-01 00:00:00
Data variables:
    ps       (time, lat, lon) float32 dask.array<chunksize=(4, 73, 144), meta=np.ndarray>
    ts       (time, lat, lon) float32 dask.array<chunksize=(4, 73, 144), meta=np.ndarray>

I was getting tired of popping open a python console or notebook every time I wanted to remind myself the variables/dimensions/coordinates/attributes of some given dataset :upside_down_face:

I’m unaware of any other efforts in this direction, but I’d be interested if anyone is already thinking about this! And of course any feedback is welcome.

It’s available on PyPI: pip install zarrdump

Cheers,
Oli

8 Likes

Hi Oli,

Nice work, I was looking for exactly this sort of thing - thanks! Have you seen anything similar to ncview that can be used on zarr stores?

Best wishes,
Barry

1 Like

Hi Barry, sorry for slow reply, just seeing this now. Glad zarrdump was useful for you.

I am not aware of any direct replacements for ncview that work with zarr stores. Probably your best bet would be to use holoviews within a jupyter notebook, but this involves multiple steps. It would be nice to be able to launch directly from the command line.

Since Zarr is now a valid storage backend for NetCDF, it’s conceivable that you could compile a version of ncview with Zarr support. Would be very curious to see this in action.

1 Like

Thanks both! Turns out psy-view works if you have zarr installed in your environment.

Although, in the docs, it states that it is not as fast as ncview via X11. So compiling ncview with zarr support could still be useful and I have not tried.

1 Like