Exemplo n.º 1
0
def test_check_for_metadata_get_max_height():
    gebco = Gebco()
    data = gebco.get_max_height(51, 7, 52, 8)
    assert data['h_max'] != gebco.NODATA
    assert isinstance(data['h_max'], float)
    assert isinstance(data['location_max'], list)
    assert data['counter_max'] >= 0
    assert isinstance(data['source'], str)
    assert isinstance(data['attributions'], list)
Exemplo n.º 2
0
def test_check_bounds_get_max_height():
    gebco = Gebco()
    # in bounds
    assert gebco.get_max_height(52.5, 5, 53, 5.5)['h_max'] != gebco.NODATA
    # invalid coordinates
    with pytest.raises(ValueError):
        gebco.get_max_height(52.5, 5, 91, 5.5)
    with pytest.raises(ValueError):
        gebco.get_max_height(-91, 5, 53, 5.5)
    with pytest.raises(ValueError):
        gebco.get_max_height(52.5, -181, 53, 5.5)
    with pytest.raises(ValueError):
        gebco.get_max_height(52.5, 5, 53, 181)
    # incorrect rectangle
    assert gebco.get_max_height(54.886907, 15.570925, 47.240591,
                                6.093066)['h_max'] == gebco.NODATA
    # highest location in the bounding box of Germany
    assert math.isclose(gebco.get_max_height(47.240591, 6.093066, 54.886907,
                                             15.570925)['h_max'],
                        2818.2,
                        abs_tol=16)
    # highest location of the world
    assert math.isclose(gebco.get_max_height(-90, -180, 90, 180)['h_max'],
                        8613.2,
                        abs_tol=16)