def test_union_error(): ds = xr.tutorial.open_dataset('rasm', decode_times=False) datasets = [ds, ds] with pytest.raises( AggregationError, match=r'Failed to merge multiple datasets in group with key' ): datasets[0] = datasets[0].rename({'time': 'times'}) union(datasets)
def test_union(datasets): from copy import deepcopy dsets = deepcopy(datasets) dsets[0] = dsets[0].rename({'Tair': 'air'}) ds = union(dsets) assert len(ds.data_vars) == 2 assert set(['Tair', 'air']) == set(ds.data_vars)
def test_union_error(): ds = xr.tutorial.open_dataset('rasm', decode_times=False) datasets = [ds, ds] with pytest.raises(xr.MergeError): datasets[0] = datasets[0].rename({'time': 'times'}) union(datasets)