@@ -581,6 +581,25 @@ def test_infer_order_from_coords(self):
581
581
expected = data
582
582
assert expected .broadcast_equals (actual )
583
583
584
+ def test_combine_leaving_bystander_dimensions (self ):
585
+ # Check non-monotonic bystander dimension coord doesn't raise
586
+ # ValueError on combine (https://github.com/pydata/xarray/issues/3150)
587
+ ycoord = ['a' , 'c' , 'b' ]
588
+
589
+ data = np .random .rand (7 , 3 )
590
+
591
+ ds1 = Dataset (data_vars = dict (data = (['x' , 'y' ], data [:3 , :])),
592
+ coords = dict (x = [1 , 2 , 3 ], y = ycoord ))
593
+
594
+ ds2 = Dataset (data_vars = dict (data = (['x' , 'y' ], data [3 :, :])),
595
+ coords = dict (x = [4 , 5 , 6 , 7 ], y = ycoord ))
596
+
597
+ expected = Dataset (data_vars = dict (data = (['x' , 'y' ], data )),
598
+ coords = dict (x = [1 , 2 , 3 , 4 , 5 , 6 , 7 ], y = ycoord ))
599
+
600
+ actual = combine_by_coords ((ds1 , ds2 ))
601
+ assert_identical (expected , actual )
602
+
584
603
def test_combine_by_coords_previously_failed (self ):
585
604
# In the above scenario, one file is missing, containing the data for
586
605
# one year's data for one variable.
0 commit comments