Skip to content

Commit

Permalink
fix combine_by_coords (#267)
Browse files Browse the repository at this point in the history
* fix combine_by_coords

* change to new only for versions newer than previous xarray version

* fix tests
  • Loading branch information
AaronDavidSchneider authored May 28, 2021
1 parent 09f8f95 commit c793ecc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion xmitgcm/mds_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,10 @@ def open_mdsdataset(data_dir, grid_dir=None,
ds = xr.auto_combine(datasets)
elif xr.__version__ < '0.15.2':
ds = xr.combine_by_coords(datasets)
else:
elif xr.__version__ < '0.18.0':
ds = xr.combine_by_coords(datasets, compat='override', coords='minimal', combine_attrs='drop')
else:
ds = xr.combine_by_coords(datasets, compat='override', coords='minimal', combine_attrs='drop_conflicts')

if swap_dims:
ds = _swap_dimensions(ds, geometry)
Expand Down
2 changes: 1 addition & 1 deletion xmitgcm/test/test_mds_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ def test_swap_dims(all_mds_datadirs):
['_bounds', '_center', '_interface']]
expected_dims += extra_dims

assert list(ds.dims.keys()) == expected_dims
assert set(ds.dims.keys()) == set(expected_dims)

# make sure swapping works with multiple iters
ds = xmitgcm.open_mdsdataset(dirname, geometry=expected['geometry'],
Expand Down

0 comments on commit c793ecc

Please sign in to comment.