Exemplo n.º 1
0
def test_check_for_metadata_get_min_height():
    gebco = Gebco()
    data = gebco.get_min_height(51, 7, 52, 8)
    assert data['h_min'] != gebco.NODATA
    assert isinstance(data['h_min'], float)
    assert isinstance(data['location_min'], list)
    assert data['counter_min'] >= 0
    assert isinstance(data['source'], str)
    assert isinstance(data['attributions'], list)
Exemplo n.º 2
0
def test_check_bounds_get_min_height():
    gebco = Gebco()
    # in bounds
    assert gebco.get_min_height(52.5, 5, 53, 5.5)['h_min'] != gebco.NODATA
    # invalid coordinates
    with pytest.raises(ValueError):
        gebco.get_min_height(52.5, 5, 91, 5.5)
    with pytest.raises(ValueError):
        gebco.get_min_height(-91, 5, 53, 5.5)
    with pytest.raises(ValueError):
        gebco.get_min_height(52.5, -181, 53, 5.5)
    with pytest.raises(ValueError):
        gebco.get_min_height(52.5, 5, 53, 181)
    # incorrect rectangle
    assert gebco.get_min_height(54.886907, 15.570925, 47.240591,
                                6.093066)['h_min'] == gebco.NODATA
    # lowest location in the bounding box of Germany
    assert math.isclose(gebco.get_min_height(47.240591, 6.093066, 54.886907,
                                             15.570925)['h_min'],
                        -195.2,
                        abs_tol=16)
    # lowest location of the world
    assert math.isclose(gebco.get_min_height(-90, -180, 90, 180)['h_min'],
                        -10952,
                        abs_tol=16)