File tree Expand file tree Collapse file tree 3 files changed +7
-12
lines changed Expand file tree Collapse file tree 3 files changed +7
-12
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,9 @@ Breaking changes
56
56
Deprecations
57
57
~~~~~~~~~~~~
58
58
59
+ - :py:meth: `xarray.open_mfdataset ` will now error instead of warn when a value for ``concat_dim `` is
60
+ passed alongside ``combine='by_coords' ``. By `Tom Nicholas <https://github.com/TomNicholas >`_.
61
+
59
62
60
63
Bug fixes
61
64
~~~~~~~~~
Original file line number Diff line number Diff line change 1
1
import os
2
- import warnings
3
2
from glob import glob
4
3
from io import BytesIO
5
4
from numbers import Number
@@ -885,15 +884,11 @@ def open_mfdataset(
885
884
list (combined_ids_paths .keys ()),
886
885
list (combined_ids_paths .values ()),
887
886
)
888
-
889
- # TODO raise an error instead of a warning after v0.19
890
887
elif combine == "by_coords" and concat_dim is not None :
891
- warnings . warn (
888
+ raise ValueError (
892
889
"When combine='by_coords', passing a value for `concat_dim` has no "
893
- "effect. This combination will raise an error in future. To manually "
894
- "combine along a specific dimension you should instead specify "
895
- "combine='nested' along with a value for `concat_dim`." ,
896
- DeprecationWarning ,
890
+ "effect. To manually combine along a specific dimension you should "
891
+ "instead specify combine='nested' along with a value for `concat_dim`." ,
897
892
)
898
893
899
894
open_kwargs = dict (engine = engine , chunks = chunks or {}, ** kwargs )
Original file line number Diff line number Diff line change @@ -3497,17 +3497,14 @@ def test_open_mfdataset_auto_combine(self):
3497
3497
with open_mfdataset ([tmp2 , tmp1 ], combine = "by_coords" ) as actual :
3498
3498
assert_identical (original , actual )
3499
3499
3500
- # TODO check for an error instead of a warning once deprecated
3501
3500
def test_open_mfdataset_raise_on_bad_combine_args (self ):
3502
3501
# Regression test for unhelpful error shown in #5230
3503
3502
original = Dataset ({"foo" : ("x" , np .random .randn (10 )), "x" : np .arange (10 )})
3504
3503
with create_tmp_file () as tmp1 :
3505
3504
with create_tmp_file () as tmp2 :
3506
3505
original .isel (x = slice (5 )).to_netcdf (tmp1 )
3507
3506
original .isel (x = slice (5 , 10 )).to_netcdf (tmp2 )
3508
- with pytest .warns (
3509
- DeprecationWarning , match = "`concat_dim` has no effect"
3510
- ):
3507
+ with pytest .raises (ValueError , match = "`concat_dim` has no effect" ):
3511
3508
open_mfdataset ([tmp1 , tmp2 ], concat_dim = "x" )
3512
3509
3513
3510
@pytest .mark .xfail (reason = "mfdataset loses encoding currently." )
You can’t perform that action at this time.
0 commit comments