Skip to content

Commit

Permalink
feat: minor changes to support fsspec store Support reading remote za…
Browse files Browse the repository at this point in the history
…rrs via authenticated HTTP calls #9
  • Loading branch information
lorenzocerrone committed Nov 5, 2024
1 parent fa7a405 commit 0b38491
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/ngio/core/image_like_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ def _init_dataset(self, dataset: Dataset) -> None:
This method is for internal use only.
"""
self._dataset = dataset
self._array = self._group.get(self._dataset.path, None)

if self._dataset.path not in self._group.array_keys():
if self._array is None:
raise ValueError(f"Dataset {self._dataset.path} not found in the group.")

self._array = self._group[self.dataset.path]
self._diminesions = Dimensions(
on_disk_shape=self._array.shape,
axes_names=self._dataset.axes_names,
Expand Down
9 changes: 8 additions & 1 deletion src/ngio/io/_zarr_group_utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from pathlib import Path

import fsspec
import zarr

from ngio.io._zarr import (
Expand All @@ -22,8 +23,14 @@ def _check_store(store: StoreLike) -> StoreLike:
if isinstance(store, str) or isinstance(store, Path):
return store

if isinstance(store, fsspec.mapping.FSMap) or isinstance(

Check warning on line 26 in src/ngio/io/_zarr_group_utils.py

View check run for this annotation

Codecov / codecov/patch

src/ngio/io/_zarr_group_utils.py#L26

Added line #L26 was not covered by tests
store, zarr.storage.FSStore
):
return store

Check warning on line 29 in src/ngio/io/_zarr_group_utils.py

View check run for this annotation

Codecov / codecov/patch

src/ngio/io/_zarr_group_utils.py#L29

Added line #L29 was not covered by tests

raise NotImplementedError(
"RemoteStore is not yet supported. Please use LocalStore."
f"Store type {type(store)} is not supported. supported types are: "
"str, Path, fsspec.mapping.FSMap, zarr.storage.FSStore"
)


Expand Down

0 comments on commit 0b38491

Please sign in to comment.