Skip to content

Commit

Permalink
Add support for drop_variables
Browse files Browse the repository at this point in the history
  • Loading branch information
alexamici committed Mar 23, 2024
1 parent b77b29a commit 3fdab27
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions xarray_ecmwf/engine_ecmwf.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,17 @@ def open_dataset( # type:ignore

data_vars = {}
for var_name, var_request_chunker in request_chunker.get_variables().items():
(
name,
coords,
attrs,
var_attrs,
dtype,
) = var_request_chunker.get_coords_attrs_and_dtype(dataset_cacher)
# drop_variables: both on var_name...
if drop_variables is not None and var_name in drop_variables:
continue
try:
var_def = var_request_chunker.get_coords_attrs_and_dtype(dataset_cacher)
except Exception:
LOGGER.exception(f"failed to define {var_name}")
name, coords, attrs, var_attrs, dtype = var_def
# drop_variables: ... and on name
if drop_variables is not None and name in drop_variables:
continue
shape = tuple(c.size for c in coords.values())
dims = list(coords)
encoding = {
Expand Down

0 comments on commit 3fdab27

Please sign in to comment.