Skip to content

Commit

Permalink
Pass fsspec instance to ome-zarr
Browse files Browse the repository at this point in the history
  • Loading branch information
pgarrison committed Jul 17, 2024
1 parent 57ee482 commit 84af9c4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
7 changes: 4 additions & 3 deletions bioio_ome_zarr/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
from typing import Any, Dict, List, Optional, Tuple

import xarray as xr
import zarr.storage
from bioio_base import constants, dimensions, exceptions, io, reader, types
from fsspec.spec import AbstractFileSystem
from ome_zarr.io import parse_url
from ome_zarr.io import parse_url, ZarrLocation
from ome_zarr.reader import Reader as ZarrReader

from . import utils as metadata_utils
Expand All @@ -25,7 +26,7 @@ class Reader(reader.Reader):
image: types.PathLike
String or Path to the ZARR root
fs_kwargs: Dict[str, Any]
Ignored
Passed to fsspec. For public S3 buckets, use {"anon": True}.
"""

_xarray_dask_data: Optional["xr.DataArray"] = None
Expand Down Expand Up @@ -263,5 +264,5 @@ def _get_coords(

def get_zarr_reader(fs: AbstractFileSystem, path: str) -> ZarrReader:
if fs is not None:
path = fs.unstrip_protocol(path)
return ZarrReader(ZarrLocation(zarr.storage.FSStore(url=path, fs=fs)))
return ZarrReader(parse_url(path, mode="r"))
13 changes: 5 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
requires = ["setuptools>=65", "wheel", "setuptools_scm[toml]>=6.2"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]

# package basics
# https://peps.python.org/pep-0621/
[project]
name = "bioio-ome-zarr"
description = "A BioIO reader plugin for reading Zarr files in the OME format."
Expand All @@ -27,10 +23,11 @@ classifiers = [
]
dynamic = ["version"]
dependencies = [
"bioio-base>=1.0.0",
"fsspec>=2022.8.0",
"ome-zarr>=0.8.0",
"xarray>=0.16.1",
"bioio-base>=1.0.0",
"fsspec>=2022.8.0",
"ome-zarr>=0.9.0",
"xarray>=0.16.1",
"zarr>=2.18.2",
]

[project.urls]
Expand Down

0 comments on commit 84af9c4

Please sign in to comment.