Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Nov 14, 2024
1 parent 29a407e commit 31e8c84
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
1 change: 0 additions & 1 deletion virtualizarr/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ def open_virtual_dataarray(
virtual_array_class=ManifestArray,
reader_options: Optional[dict] = None,
) -> DataArray:

drop_variables, loadable_variables = check_for_collisions(
drop_variables,
loadable_variables,
Expand Down
1 change: 0 additions & 1 deletion virtualizarr/readers/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ def construct_virtual_dataarray(
coord_names: Iterable[str],
attrs: dict[str, str],
) -> DataArray:

vda = DataArray(
data=virtual_var,
coords=coord_names,
Expand Down
10 changes: 5 additions & 5 deletions virtualizarr/readers/tiff.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import Iterable, Mapping, Optional

from xarray import DataArray, Dataset, Index
import zarr
from xarray import DataArray, Dataset, Index

from virtualizarr.readers.common import VirtualBackend
from virtualizarr.readers.zarr import virtual_variable_from_zarr_array
Expand All @@ -18,7 +18,6 @@ def open_virtual_dataarray(
indexes: Mapping[str, Index] | None = None,
reader_options: Optional[dict] = None,
) -> Dataset:

from tifffile import imread

store = imread(filepath, aszarr=True)
Expand All @@ -42,16 +41,17 @@ def open_virtual_dataset(
indexes: Mapping[str, Index] | None = None,
reader_options: Optional[dict] = None,
) -> Dataset:

from tifffile import imread

store = imread(filepath, aszarr=True)

try:
zg = zarr.open_group(store, mode="r")
except zarr.errors.ContainsArrayError as err:
except zarr.errors.ContainsArrayError:
# TODO tidy this up
print("TIFF file contains only a single array, please use `open_virtual_dataarray` instead")
print(
"TIFF file contains only a single array, please use `open_virtual_dataarray` instead"
)
raise

raise NotImplementedError()
10 changes: 5 additions & 5 deletions virtualizarr/readers/zarr.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import io

from xarray import Variable
import zarr
from xarray import Variable

from virtualizarr.zarr import ZArray
from virtualizarr.manifests import ChunkManifest, ManifestArray
from virtualizarr.zarr import ZArray


def virtual_variable_from_zarr_array(za: zarr.Array) -> Variable:
Expand All @@ -28,9 +28,9 @@ def virtual_variable_from_zarr_array(za: zarr.Array) -> Variable:
order=za.order,
compressor=za.compressor,
filters=za.filters,
#zarr_format=za.zarr_format,
# zarr_format=za.zarr_format,
)

manifest = chunkmanifest_from_zarr_array(za)

ma = ManifestArray(chunkmanifest=manifest, zarray=zarray)
Expand All @@ -44,7 +44,7 @@ def chunkmanifest_from_zarr_array(za: zarr.Array) -> ChunkManifest:
of2 = io.StringIO()

# TODO handle remote urls
za.store.write_fsspec(of2)# , url=url)
za.store.write_fsspec(of2) # , url=url)
out = ujson.loads(of2.getvalue())

print(out)

0 comments on commit 31e8c84

Please sign in to comment.