diff --git a/virtualizarr/backend.py b/virtualizarr/backend.py index b2937093..78fea0a2 100644 --- a/virtualizarr/backend.py +++ b/virtualizarr/backend.py @@ -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, diff --git a/virtualizarr/readers/common.py b/virtualizarr/readers/common.py index 1fce389d..a546bc10 100644 --- a/virtualizarr/readers/common.py +++ b/virtualizarr/readers/common.py @@ -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, diff --git a/virtualizarr/readers/tiff.py b/virtualizarr/readers/tiff.py index 9d170450..2dafff51 100644 --- a/virtualizarr/readers/tiff.py +++ b/virtualizarr/readers/tiff.py @@ -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 @@ -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) @@ -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() diff --git a/virtualizarr/readers/zarr.py b/virtualizarr/readers/zarr.py index 4fda7e5d..84893dbc 100644 --- a/virtualizarr/readers/zarr.py +++ b/virtualizarr/readers/zarr.py @@ -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: @@ -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) @@ -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)