I'm reading a Xenium folder, from a new python environment on a new machine, which uses zarr==3.2.0 instead of zarr==3.1.6.
Now, it seems, I have to add this config line to not have an error:
zarr.config.set({'array.rectilinear_chunks': True})
sdata = xenium(os.path.join(DATA_DIR,XENIUM_DIR))
https://zarr.readthedocs.io/en/latest/release-notes/#320-2026-04-30
The chunks in my data are: ((1, 1, 1, 1), (4096, 4096, 4096, 4096, 4096, 3413), (4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 1955))
Can someone explain what would be the difference between the sdata obtained for zarr<3.2.0 and for zarr>=3.2.0, considering that change?
How did the previous versions handle rectilinear data?
EDIT:
I actually have a problem when reading the zarr that I wrote with the code above and sdata.write(os.path.join(OUT_EXP_DIR,sample_id+".zarr"))
Now:
sdata = sp.read_zarr(os.path.join(OUT_EXP_DIR,"Acute_D10.zarr"))
gives the error:
File /z1-mheitz/mheitz/Projects/liver_reg/venv-liver-reg-312/lib/python3.12/site-packages/zarr/api/synchronous.py:533, in open_group(store, mode, cache_attrs, synchronizer, path, chunk_store, storage_options, zarr_format, meta_array, attributes, use_consolidated)
463 def open_group(
464 store: StoreLike | None = None,
465 *,
(...) 475 use_consolidated: bool | str | None = None,
476 ) -> Group:
477 """Open a group using file-mode-like semantics.
478
...
297 "or set the environment variable ZARR_ARRAY__RECTILINEAR_CHUNKS=True"
298 )
299 object.setattr(self, "chunk_shapes", _validate_chunk_shapes(self.chunk_shapes))
ValueError: Rectilinear chunk grids are experimental and disabled by default. Enable them with: zarr.config.set({'array.rectilinear_chunks': True}) or set the environment variable ZARR_ARRAY__RECTILINEAR_CHUNKS=True
And
zarr.config.set({'array.rectilinear_chunks': True})
sdata = sp.read_zarr(os.path.join(OUT_EXP_DIR,"Acute_D10.zarr"))
gives the error:
File /z1-mheitz/mheitz/Projects/liver_reg/venv-liver-reg-312/lib/python3.12/site-packages/spatialdata/_io/io_zarr.py:203, in read_zarr(store, selection, on_bad_files)
183 group_readers: dict[
184 Literal["images", "labels", "shapes", "points", "tables"],
185 tuple[
(...) 196 "tables": (_read_table, "tables", tables),
197 }
198 for group_name, (
199 read_func,
200 element_type,
201 element_container,
202 ) in group_readers.items():
--> 203 _read_zarr_group_spatialdata_element(
204 root_group=root_group,
205 root_store_path=root_store_path,
206 sdata_version=sdata_version,
207 selector=selector,
...
--> 554 raise NotImplementedError(msg)
556 from zarr.codecs.sharding import ShardingCodec
558 if len(self.codecs) == 1 and isinstance(self.codecs[0], ShardingCodec):
NotImplementedError: The chunks attribute is only defined for arrays using regular chunk grids. This array has a rectilinear chunk grid. Use read_chunk_sizes for general access.
Not sure what to make of this, is this a bug or is this expected?
I'm reading a Xenium folder, from a new python environment on a new machine, which uses zarr==3.2.0 instead of zarr==3.1.6.
Now, it seems, I have to add this config line to not have an error:
https://zarr.readthedocs.io/en/latest/release-notes/#320-2026-04-30
The chunks in my data are:
((1, 1, 1, 1), (4096, 4096, 4096, 4096, 4096, 3413), (4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 1955))Can someone explain what would be the difference between the sdata obtained for zarr<3.2.0 and for zarr>=3.2.0, considering that change?
How did the previous versions handle rectilinear data?
EDIT:
I actually have a problem when reading the zarr that I wrote with the code above and
sdata.write(os.path.join(OUT_EXP_DIR,sample_id+".zarr"))Now:
gives the error:
And
gives the error:
Not sure what to make of this, is this a bug or is this expected?