@@ -291,18 +291,18 @@ class TestConcatDatasetNewApi:
291
291
def setUp (self ):
292
292
self .ds1 = Dataset (
293
293
{
294
- "has_x_y " : (("y" , "x" ), [[1 , 2 ]]),
295
- "has_x " : ("x" , [1 , 2 ]),
296
- "no_x_y " : ("z" , [1 , 2 ]),
294
+ "only_x_y " : (("y" , "x" ), [[1 , 2 ]]),
295
+ "only_x " : ("x" , [1 , 2 ]),
296
+ "only_z " : ("z" , [1 , 2 ]),
297
297
"const1" : 1.0 ,
298
298
},
299
299
coords = {"x" : [0 , 1 ], "y" : [0 ], "z" : [- 1 , - 2 ], "coord1" : ("x" , [0 , 1 ])},
300
300
)
301
301
self .ds2 = Dataset (
302
302
{
303
- "has_x_y " : (("y" , "x" ), [[3 , 4 ]]),
304
- "has_x " : ("x" , [1.1 , 2.1 ]),
305
- "no_x_y " : ("z" , [1 , 2 ]),
303
+ "only_x_y " : (("y" , "x" ), [[3 , 4 ]]),
304
+ "only_x " : ("x" , [1.1 , 2.1 ]),
305
+ "only_z " : ("z" , [1 , 2 ]),
306
306
"const1" : 1.0 ,
307
307
},
308
308
coords = {
@@ -315,22 +315,22 @@ def setUp(self):
315
315
316
316
self .expected_y = Dataset (
317
317
{
318
- "has_x_y " : (("y" , "x" ), [[1 , 2 ], [3 , 4 ]]),
319
- "has_x " : ("x" , [1 , 2 ]),
320
- "no_x_y " : ("z" , [1 , 2 ]),
318
+ "only_x_y " : (("y" , "x" ), [[1 , 2 ], [3 , 4 ]]),
319
+ "only_x " : ("x" , [1 , 2 ]),
320
+ "only_z " : ("z" , [1 , 2 ]),
321
321
"const1" : 1.0 ,
322
322
},
323
323
coords = {"x" : [0 , 1 ], "y" : [0 , 1 ], "z" : [- 1 , - 2 ], "coord1" : ("x" , [0 , 1 ])},
324
324
)
325
325
326
326
self .expected_new_dim = Dataset (
327
327
{
328
- "has_x_y " : (
328
+ "only_x_y " : (
329
329
("new_dim" , "y" , "x" ),
330
330
[[[1 , 2 ], [np .nan , np .nan ]], [[np .nan , np .nan ], [3 , 4 ]]],
331
331
),
332
- "has_x " : (("new_dim" , "x" ), [[1 , 2 ], [1.1 , 2.1 ]]),
333
- "no_x_y " : (("new_dim" , "z" ), [[1 , 2 ], [1 , 2 ]]),
332
+ "only_x " : (("new_dim" , "x" ), [[1 , 2 ], [1.1 , 2.1 ]]),
333
+ "only_z " : (("new_dim" , "z" ), [[1 , 2 ], [1 , 2 ]]),
334
334
"const1" : ("new_dim" , [1.0 , 1.0 ]),
335
335
},
336
336
coords = {
@@ -345,7 +345,7 @@ def setUp(self):
345
345
346
346
def test_concat_sensible_compat_errors (self ):
347
347
348
- with raises_regex (ValueError , "'has_x ' is not equal across datasets." ):
348
+ with raises_regex (ValueError , "'only_x ' is not equal across datasets." ):
349
349
concat (self .dsets , data_vars = "sensible" , dim = "y" )
350
350
351
351
with raises_regex (ValueError , "'coord1' is not equal across datasets." ):
@@ -378,15 +378,15 @@ def test_compat_override(self, data_vars, coords):
378
378
)
379
379
380
380
if data_vars == "all" :
381
- expected_y_dim = ["has_x_y " , "has_x " , "no_x_y " , "const1" ]
381
+ expected_y_dim = ["only_x_y " , "only_x " , "only_z " , "const1" ]
382
382
equal_to_first_ds = []
383
383
elif data_vars == "sensible" :
384
- expected_y_dim = ["has_x_y " ]
384
+ expected_y_dim = ["only_x_y " ]
385
385
if coords == "all" :
386
- # in this case, variable has_x will not have coord1 as non-dim coord
387
- equal_to_first_ds = ["no_x_y " , "const1" ]
386
+ # in this case, variable only_x will not have coord1 as non-dim coord
387
+ equal_to_first_ds = ["only_z " , "const1" ]
388
388
if coords == "sensible" :
389
- equal_to_first_ds = ["has_x " , "no_x_y " , "const1" ]
389
+ equal_to_first_ds = ["only_x " , "only_z " , "const1" ]
390
390
391
391
if coords == "all" :
392
392
expected_y_dim += ["coord1" ]
0 commit comments