예제 #1
0
def test_combine_wrong_var_name():
    with pytest.raises(ValueError):
        combine(
            raster_ds[['arr1', 'arr2', 'arr3']],
            data_vars=['arr1', 'arr9'],
        )
예제 #2
0
def test_combine_data_vars_elem_type_error():
    with pytest.raises(TypeError):
        combine(raster_ds[['arr1', 'arr2', 'arr3']], data_vars=[0])
예제 #3
0
def test_combine_some_data_vars():
    result_arr = combine(raster_ds[['arr1', 'arr2', 'arr3']], ['arr1', 'arr3'])
    expected_arr = xr.DataArray([[np.nan, 1, 2, 3], [4, 5, np.nan, 6],
                                 [7, 6, 2, 8], [9, 10, 11, np.nan]])

    assert result_arr.equals(expected_arr)
예제 #4
0
def test_combine_raster_type_error():
    with pytest.raises(TypeError):
        combine(arr1)
예제 #5
0
def test_combine_all_data_vars():
    result_arr = combine(raster_ds[['arr1', 'arr2', 'arr3']])
    expected_arr = xr.DataArray([[np.nan, 1, 2, 3], [4, 5, np.nan, 6],
                                 [7, 8, 9, 10], [np.nan, 11, 12, np.nan]])

    assert result_arr.equals(expected_arr)