Beispiel #1
0
def test_holes_projection_errors2():
    holes = get_object()
    hole = holes[2]
    del hole.header.XY["X"]
    del hole.header.XY["Y"]
    with pytest.raises(Exception) as e_info:
        project_hole(hole, output_epsg="EPSG:4326")
    assert str(e_info.value) == "Hole has no coordinates"

    holes = get_object()
    del holes[0].header.XY["X"]
    del holes[0].header.XY["Y"]
    holes2 = project_holes(holes)
    assert len(holes) > len(holes2)

    holes = get_object()
    del holes[1].fileheader.KJ["Coordinate system"]  # del all pointers
    holes2 = project_holes(holes)  # holes2 is empty
    assert len(holes) > len(holes2)

    holes = get_object()
    holes[2].header.XY["X"] = np.nan
    holes[2].header.XY["Y"] = np.nan
    holes2 = project_holes(holes)
    assert len(holes) > len(holes2)
Beispiel #2
0
def test_holes_projection_errors():
    holes = get_object()
    with pytest.raises(Exception) as e_info:
        project_holes("Wrong input")
    assert str(e_info.value) == "holes -parameter is unknown input type"

    with pytest.raises(Exception) as e_info:
        project_hole(holes[0], output_epsg="EPSG:999999")
    assert str(
        e_info.value) == "Unknown or not implemented EPSG as output_epsg"

    hole = holes[0]
    hole.header.XY["X"], hole.header.XY["Y"] = np.nan, 0.1
    with pytest.raises(Exception) as e_info:
        project_hole(hole, output_epsg="EPSG:4326")
    assert str(e_info.value) == "Coordinates are not finite"
    with pytest.raises(Exception) as e_info:
        flip_xy("Wrong input")

    holes2 = get_object()
    holes_all = holes + holes2.project("Ykj")
    with pytest.raises(Exception) as e_info:
        check_hole_in_country(holes_all, "FI")
    assert "uniform" in str(e_info.value)

    check_hole_in_country(holes2.project("WGS84"), "FI")
Beispiel #3
0
def test_height_holes():
    holes = get_object()
    hole = holes[7]
    hole.fileheader.KJ["Height reference"] = "N43"  # pointer to all holes
    holes2 = project_holes(holes, output_height="N2000")
    hole2 = holes2[5]
    assert hole2.fileheader.KJ["Height reference"] == "N2000"
Beispiel #4
0
def test_holes_coordinate_projection():
    holes = get_object()
    holes = flip_xy(holes)
    holes = flip_xy(holes)
    hole = holes[0]
    hole = flip_xy(hole)
    hole = flip_xy(hole)
    holes2 = project_holes(holes, output="EPSG:4326", check="Finland")
    holes3 = project_holes(holes, output="EPSG:3879", check="Finland")
    holes4 = project_holes(holes, output="EPSG:4326",
                           check="Estonia")  # logger warning
    holes5 = holes.project("ykj")
    hole = project_holes(holes[0], output="EPSG:3879", check="Finland")
    hole = project_holes(hole, output="EPSG:3879", check="Finland")
    assert check_hole_in_country(holes2, country="FI")
    assert check_hole_in_country(holes3, country="FI")
    assert check_hole_in_country(holes3, country="EE") == False
Beispiel #5
0
def test_holes_projection_uniform():
    holes = get_object()
    holes = project_holes(holes)
    l = [hole.fileheader.KJ["Coordinate system"] for hole in holes]
    assert all([l[0] == i for i in l])