Skip to content

Commit 0128c29

Browse files
Fix compatibility pre-0.1 spatialdata store (#1012)
* fix compatibility pre-0.1 spatialdata store * fix pre-commit
1 parent 79cf8c9 commit 0128c29

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/spatialdata/_io/io_zarr.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,11 @@ def read_zarr(
155155
resolved_store = _resolve_zarr_store(store)
156156
root_group = zarr.open_group(resolved_store, mode="r")
157157
# the following is the SpatialDataContainerFormat version
158-
sdata_version = root_group.metadata.attributes["spatialdata_attrs"]["version"]
158+
if "spatialdata_attrs" not in root_group.metadata.attributes:
159+
# backward compatibility for pre-versioned SpatialData zarr stores
160+
sdata_version = cast(Literal["0.1", "0.2"], "0.1")
161+
else:
162+
sdata_version = root_group.metadata.attributes["spatialdata_attrs"]["version"]
159163
if sdata_version == "0.1":
160164
warnings.warn(
161165
"SpatialData is not stored in the most current format. If you want to use Zarr v3"

0 commit comments

Comments
 (0)