示例#1
0
def test_create_mask_contains():

    # standard
    result = create_mask_contains(lon, lat, outlines)
    expected = expected_mask()
    assert np.allclose(result, expected, equal_nan=True)

    result = create_mask_contains(lon, lat, outlines, fill=5)
    expected = expected_mask(fill=5)
    assert np.allclose(result, expected, equal_nan=True)

    result = create_mask_contains(lon, lat, outlines, numbers=[5, 6])
    expected = expected_mask(a=5, b=6)
    assert np.allclose(result, expected, equal_nan=True)

    raises(AssertionError, create_mask_contains, lon, lat, outlines, fill=0)

    raises(AssertionError, create_mask_contains, lon, lat, outlines,
           numbers=[5])
示例#2
0
def test_create_mask_contains():

    # standard
    result = create_mask_contains(lon, lat, outlines)
    expected = expected_mask()
    assert np.allclose(result, expected, equal_nan=True)

    result = create_mask_contains(lon, lat, outlines, fill=5)
    expected = expected_mask(fill=5)
    assert np.allclose(result, expected, equal_nan=True)

    result = create_mask_contains(lon, lat, outlines, numbers=[5, 6])
    expected = expected_mask(a=5, b=6)
    assert np.allclose(result, expected, equal_nan=True)

    raises(AssertionError, create_mask_contains, lon, lat, outlines, fill=0)

    raises(AssertionError,
           create_mask_contains,
           lon,
           lat,
           outlines,
           numbers=[5])
示例#3
0
def test_create_mask_contains_warns():

    with pytest.warns(
            FutureWarning,
            match="The function `create_mask_contains` is deprecated"):
        create_mask_contains(lon, lat, outlines)
示例#4
0
def test_create_mask_function_2D():
    result = create_mask_contains(lon_2D, lat_2D, outlines)
    expected = expected_mask()
    assert np.allclose(result, expected, equal_nan=True)
示例#5
0
def test_create_mask_contains_2D():
    result = create_mask_contains(lon_2D, lat_2D, outlines)
    expected = expected_mask()
    assert np.allclose(result, expected, equal_nan=True)