@@ -40,7 +40,6 @@ def open_virtual_datatree(
4040 registry : ObjectStoreRegistry ,
4141 parser : Parser ,
4242 * ,
43- drop_variables : Iterable [str ] | None = None ,
4443 loadable_variables : Iterable [str ] | None = None ,
4544 decode_times : bool | None = None ,
4645) -> xr .DataTree :
@@ -72,33 +71,13 @@ def open_virtual_datatree(
7271 - [virtualizarr.parsers.ZarrParser][] for virtualizing Zarr stores.
7372 - [virtual_tiff.VirtualTIFF][] for virtualizing TIFFs.
7473
75- drop_variables
76- Variables in the data source to drop before returning.
77-
78- Variable names are matched by their simple name (not a path). Matching is applied uniformly
79- across all groups in the DataTree. For example, ``drop_variables=["time"]`` will drop any variable
80- named "time" from every group that contains it.
81-
82- Path-like strings (e.g., ``"/group1/time"``) are ignored unless they match a specific variable name.
83- To drop variables from specific groups only, open the DataTree first and then use xarray's
84- ``.drop_vars()`` method on the desired nodes.
85-
86- Unlike xarray's opening functions, errors are not raised when a specified variable is not found.
87-
8874 loadable_variables
89- Variables in the data source to load as Dask/NumPy arrays instead of as virtual arrays. If
90- ``None`` (the default), dimension coordinate variables (1D variables whose name matches
75+ If ``None`` (the default), dimension coordinate variables (1D variables whose name matches
9176 their dimension) will be loaded automatically to enable xarray indexing.
9277
93- Variable names are matched by their simple name (not a path). Matching is applied uniformly
94- across all groups in the DataTree. For example, ``loadable_variables=["time", "lat", "lon"]``
95- will load any variable with those names from every group that contains them.
96-
97- Path-like strings (e.g., ``"/group1/time"``) are ignored unless they match a specific variable name.
98- To load variables from specific groups only, you would need to open groups separately using
99- ``open_virtual_dataset`` with the parser's ``group`` parameter.
78+ If an empty iterable, no variables will be loaded.
10079
101- Unlike xarray's opening functions, errors are not raised when a specified variable is not found .
80+ Other options are not yet supported .
10281
10382 decode_times
10483 Bool that is passed into [xarray.open_dataset][]. Allows time to be decoded into a datetime object.
@@ -162,17 +141,6 @@ def open_virtual_datatree(
162141 )
163142 ```
164143
165- Drop the "lon" variable from all groups:
166-
167- ```python
168- vdt = open_virtual_datatree(
169- url=url,
170- registry=registry,
171- parser=parser,
172- drop_variables=["lon"],
173- )
174- ```
175-
176144 Drop variables from a specific group after opening:
177145
178146 ```python
@@ -187,6 +155,10 @@ def open_virtual_datatree(
187155 """
188156 filepath = validate_and_normalize_path_to_uri (url , fs_root = Path .cwd ().as_uri ())
189157
158+ if loadable_variables :
159+ raise NotImplementedError (
160+ f"Only `loadable_variables=[]` or `loadable_variables=None` are supported, got loadable_variables={ loadable_variables } "
161+ )
190162 manifest_store = parser (
191163 url = filepath ,
192164 registry = registry ,
@@ -195,7 +167,6 @@ def open_virtual_datatree(
195167 return manifest_store .to_virtual_datatree (
196168 loadable_variables = loadable_variables ,
197169 decode_times = decode_times ,
198- drop_variables = drop_variables ,
199170 )
200171
201172
@@ -522,7 +493,6 @@ def construct_virtual_datatree(
522493 manifest_store : ManifestStore ,
523494 group : str = "" ,
524495 * ,
525- drop_variables : Iterable [str ] | None = None ,
526496 loadable_variables : Iterable [str ] | None = None ,
527497 decode_times : bool | None = None ,
528498) -> xr .DataTree :
@@ -548,7 +518,7 @@ def construct_virtual_datatree(
548518 virtual_node .to_dataset (),
549519 fully_loadable_datatree [name ].to_dataset (),
550520 loadable_variables ,
551- ). drop_vars ( list ( drop_variables or ()), errors = "ignore" )
521+ )
552522 for name , virtual_node in node .to_virtual_datatree ().subtree_with_keys
553523 }
554524
0 commit comments