zarr-python icon indicating copy to clipboard operation
zarr-python copied to clipboard

[v3] reimplement / develop `Group.info` and `Array.info` properties

Open jhamman opened this issue 1 year ago • 4 comments

Zarr Python 2 had nice info properties on the Group and Array classes. We haven't built these for v3 yet.

  >>> import zarr
  >>> z = zarr.zeros(1000000, chunks=100000, dtype='i4')
  >>> z.info
  Type               : zarr.core.Array
  Data type          : int32
  Shape              : (1000000,)
  Chunk shape        : (100000,)
  Order              : C
  Read-only          : False
  Compressor         : Blosc(cname='lz4', clevel=5, shuffle=SHUFFLE, blocksize=0)
  Store type         : zarr.storage.KVStore
  No. bytes          : 4000000 (3.8M)
  No. bytes stored   : 320
  Storage ratio      : 12500.0
  Chunks initialized : 0/10

Reference to stub in v3: https://github.com/zarr-developers/zarr-python/blob/61683be6f13775c3b9fa78b433812ec1fac41786/src/zarr/core/array.py#L598-L599

jhamman avatar Aug 28 '24 03:08 jhamman

Thanks for the issue, @jhamman. I'd like to work on this.

AFAIK we discussed, leaving out properties that require computation, i.e., the number of bytes, the number of bytes stored, the storage ratio, etc.

sanketverma1704 avatar Aug 28 '24 12:08 sanketverma1704

@MSanKeys963 - I think that is a great place to start. We could also make the trigger for computation something that you have to opt into. Like Array.info(compute=True) or something like that.

jhamman avatar Aug 28 '24 13:08 jhamman

I can take a shot at this quick.

TomAugspurger avatar Oct 18 '24 15:10 TomAugspurger

I'd like to keep .info as a properly, like it was in v2. I think we can include fields requiring computation in an info_full or info_complete method.

TomAugspurger avatar Oct 18 '24 15:10 TomAugspurger