From bd147d608a3896c207d35ab4d611bb952b04986b Mon Sep 17 00:00:00 2001 From: mavaylon1 Date: Wed, 20 Nov 2024 19:48:53 -0800 Subject: [PATCH 1/2] read --- src/hdmf_zarr/backend.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/hdmf_zarr/backend.py b/src/hdmf_zarr/backend.py index 1636487c..a48458fe 100644 --- a/src/hdmf_zarr/backend.py +++ b/src/hdmf_zarr/backend.py @@ -530,6 +530,7 @@ def __open_file_consolidated(self, This method will check to see if the metadata has been consolidated. If so, use open_consolidated. """ + # breakpoint() # This check is just a safeguard for possible errors in the future. But this should never happen if mode == 'r-': raise ValueError('Mode r- not allowed for reading with consolidated metadata') @@ -755,7 +756,10 @@ def resolve_ref(self, zarr_ref): source_file = str(zarr_ref['source']) # Resolve the path relative to the current file if not self.is_remote(): - source_file = os.path.abspath(os.path.join(self.source, source_file)) + if isinstance(self.source, str) and self.source.startswith(("s3://")): + source_file = self.source + else: + source_file = os.path.abspath(os.path.join(self.source, source_file)) else: # get rid of extra "/" and "./" in the path root and source_file root_path = str(self.path).rstrip("/") @@ -767,7 +771,7 @@ def resolve_ref(self, zarr_ref): target_name = os.path.basename(object_path) else: target_name = ROOT_NAME - + # breakpoint() target_zarr_obj = self.__open_file_consolidated(store=source_file, mode='r', storage_options=self.__storage_options) From a00345d17fc3c5fc5ab563079d302f8792b195ec Mon Sep 17 00:00:00 2001 From: mavaylon1 Date: Wed, 20 Nov 2024 19:49:56 -0800 Subject: [PATCH 2/2] read --- src/hdmf_zarr/backend.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/hdmf_zarr/backend.py b/src/hdmf_zarr/backend.py index a48458fe..51109946 100644 --- a/src/hdmf_zarr/backend.py +++ b/src/hdmf_zarr/backend.py @@ -530,7 +530,6 @@ def __open_file_consolidated(self, This method will check to see if the metadata has been consolidated. If so, use open_consolidated. """ - # breakpoint() # This check is just a safeguard for possible errors in the future. But this should never happen if mode == 'r-': raise ValueError('Mode r- not allowed for reading with consolidated metadata') @@ -771,7 +770,7 @@ def resolve_ref(self, zarr_ref): target_name = os.path.basename(object_path) else: target_name = ROOT_NAME - # breakpoint() + target_zarr_obj = self.__open_file_consolidated(store=source_file, mode='r', storage_options=self.__storage_options)