MCPcopy
hub / github.com/pydata/xarray / test_concat_order_when_filling_missing

Function test_concat_order_when_filling_missing

xarray/tests/test_concat.py:374–410  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

372
373
374def test_concat_order_when_filling_missing() -> None:
375 vars_to_drop_in_first: list[str] = []
376 # drop middle
377 vars_to_drop_in_second = ["humidity"]
378 datasets = create_concat_datasets(2, seed=123)
379 expected1 = concat(datasets, dim="day")
380 for name in vars_to_drop_in_second:
381 expected1[name][..., 2:] = np.nan
382 expected2 = concat(datasets[::-1], dim="day")
383 for name in vars_to_drop_in_second:
384 expected2[name][..., :2] = np.nan
385
386 # set up the test data
387 datasets[0] = datasets[0].drop_vars(vars_to_drop_in_first)
388 datasets[1] = datasets[1].drop_vars(vars_to_drop_in_second)
389
390 actual = concat(datasets, dim="day")
391
392 assert list(actual.data_vars.keys()) == [
393 "temperature",
394 "pressure",
395 "humidity",
396 "precipitation",
397 "cloud_cover",
398 ]
399 assert_identical(actual, expected1)
400
401 actual = concat(datasets[::-1], dim="day")
402
403 assert list(actual.data_vars.keys()) == [
404 "temperature",
405 "pressure",
406 "precipitation",
407 "cloud_cover",
408 "humidity",
409 ]
410 assert_identical(actual, expected2)
411
412
413@pytest.fixture

Callers

nothing calls this directly

Calls 5

concatFunction · 0.90
assert_identicalFunction · 0.90
create_concat_datasetsFunction · 0.85
keysMethod · 0.80
drop_varsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…