From b3e4a8e131325330099f3a48146f69ff7bfde641 Mon Sep 17 00:00:00 2001 From: Jeremy Magland Date: Mon, 14 Oct 2024 14:25:21 -0400 Subject: [PATCH] Fix soft link for datasets --- lindi/LindiH5pyFile/LindiH5pyGroup.py | 7 +++++-- pyproject.toml | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lindi/LindiH5pyFile/LindiH5pyGroup.py b/lindi/LindiH5pyFile/LindiH5pyGroup.py index 91e6637..325d3c2 100644 --- a/lindi/LindiH5pyFile/LindiH5pyGroup.py +++ b/lindi/LindiH5pyFile/LindiH5pyGroup.py @@ -43,10 +43,11 @@ def __getitem__(self, name): "Accessing a group is done with bytes or str, " "not {}".format(type(name)) ) - if isinstance(x, zarr.Group): - # follow the link if this is a soft link + # check for soft link + if isinstance(x, zarr.Group) or isinstance(x, zarr.Array): soft_link = x.attrs.get('_SOFT_LINK', None) if soft_link is not None: + # follow the link if this is a soft link link_path = soft_link['path'] target_item = self._file.get(link_path) if not isinstance(target_item, (LindiH5pyGroup, LindiH5pyDataset)): @@ -54,6 +55,8 @@ def __getitem__(self, name): f"Expected a group or dataset at {link_path} but got {type(target_item)}" ) return target_item + + if isinstance(x, zarr.Group): return LindiH5pyGroup(x, self._file) elif isinstance(x, zarr.Array): return LindiH5pyDataset(x, self._file) diff --git a/pyproject.toml b/pyproject.toml index a691510..af02a27 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "lindi" -version = "0.4.2" +version = "0.4.3" description = "" authors = [ "Jeremy Magland ",