11from __future__ import annotations
22
33import math
4- from pathlib import Path
54from typing import (
65 TYPE_CHECKING ,
7- Any ,
86 Dict ,
97 Hashable ,
108 Iterable ,
3028 ManifestGroup ,
3129 ManifestStore ,
3230)
33- from virtualizarr .manifests .manifest import validate_and_normalize_path_to_uri
3431from virtualizarr .manifests .utils import create_v3_array_metadata
3532from virtualizarr .readers .api import VirtualBackend
3633from virtualizarr .readers .hdf .filters import cfcodec_from_dataset , codecs_from_dataset
@@ -151,7 +148,7 @@ def _construct_manifest_group(
151148 if variable is not None :
152149 manifest_dict [key ] = variable
153150 return ManifestGroup (arrays = manifest_dict , attributes = attrs )
154-
151+
155152 @staticmethod
156153 def _create_manifest_store (
157154 filepath : str ,
@@ -163,7 +160,10 @@ def _create_manifest_store(
163160 ) -> ManifestStore :
164161 # Create a group containing dataset level metadata and all the manifest arrays
165162 manifest_group = HDFVirtualBackend ._construct_manifest_group (
166- store = store , filepath = filepath , group = group , drop_variables = drop_variables ,
163+ store = store ,
164+ filepath = filepath ,
165+ group = group ,
166+ drop_variables = drop_variables ,
167167 )
168168 # Convert to a manifest store
169169 return ManifestStore (stores = {prefix : store }, group = manifest_group )
@@ -187,13 +187,14 @@ def open_virtual_dataset(
187187 )
188188
189189 # filepath = validate_and_normalize_path_to_uri(
190- # filepath, fs_root=Path.cwd().as_uri()
190+ # filepath, fs_root=Path.cwd().as_uri()
191191 # )
192192
193193 _drop_vars : list [Hashable ] = (
194194 [] if drop_variables is None else list (drop_variables )
195195 )
196196 from obstore .store import LocalStore
197+
197198 manifest_store = HDFVirtualBackend ._create_manifest_store (
198199 filepath = filepath ,
199200 store = LocalStore (),
@@ -208,12 +209,15 @@ def open_virtual_dataset(
208209 )
209210 non_loadable_vars = set (ds_virtual .variables ).difference (_loadable_vars )
210211 ds_loadable = xr .open_zarr (
211- manifest_store , consolidated = False , zarr_format = 3 , drop_variables = non_loadable_vars
212+ manifest_store ,
213+ consolidated = False ,
214+ zarr_format = 3 ,
215+ drop_variables = non_loadable_vars ,
212216 )
213217 ds_virtual = ds_virtual .drop_vars (_loadable_vars )
214218 ds = xr .merge ([ds_virtual , ds_loadable ])
215219 return ds
216-
220+
217221 @staticmethod
218222 def _dataset_chunk_manifest (
219223 path : str ,
0 commit comments