Пример #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)