Skip to content

Commit 11af299

Browse files
committed
Update open_mfdataset() to avoid data vars dim concat
1 parent 68e8c00 commit 11af299

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

xcdat/dataset.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,10 @@ def open_mfdataset(
146146
>>> from xcdat.dataset import open_dataset
147147
>>> ds = open_mfdataset(["file_path1", "file_path2"], data_var=["ts", "tas"])
148148
"""
149-
ds = xr.open_mfdataset(paths, decode_times=False, **kwargs)
149+
# Data variables are concatenated together with data_vars=“minimal”, where
150+
# only data variables in which the dimension already appears are included.
151+
# https://github.com/pydata/xarray/issues/438
152+
ds = xr.open_mfdataset(paths, decode_times=False, data_vars="minimal", **kwargs)
150153
ds = infer_or_keep_var(ds, data_var)
151154

152155
if ds.cf.dims.get("T") is not None:

0 commit comments

Comments
 (0)