def test_highest_position_some_data_vars(): result_arr = highest_position( raster_ds[['arr1', 'arr2', 'arr3']], ['arr1', 'arr3'], ) expected_arr = xr.DataArray([[np.nan, 1, 1, 1], [2, 1, np.nan, 1], [2, 1, 1, 2], [1, 1, 1, np.nan]]) assert result_arr.equals(expected_arr)
def test_highest_position_wrong_var_name(): with pytest.raises(ValueError): highest_position(raster_ds[['arr1', 'arr2', 'arr3']], data_vars=['arr1', 'arr9'])
def test_highest_position_data_vars_elem_type_error(): with pytest.raises(TypeError): highest_position(raster_ds[['arr1', 'arr2', 'arr3']], data_vars=[0])
def test_highest_position_raster_type_error(): with pytest.raises(TypeError): highest_position(arr1)