Beispiel #1
0
def test_polygon_area(square_verts):
    assert rclv.polygon_area(square_verts) == 1.0
    # try without the last vertex
    assert rclv.polygon_area(square_verts[:-1]) == 1.0

    cverts = circular_verts()
    np.testing.assert_allclose(rclv.polygon_area(cverts), np.pi, rtol=0.01)
Beispiel #2
0
def test_projection():
    verts = circular_verts()
    lat0, lon0 = (0, 0)
    dlon, dlat = (0.1, 0.1)
    verts_proj_equator = rclv.project_vertices(verts, lon0, lat0, 0.1, 0.1)

    # area of a circle of radius 0.1 degree at the equator
    area_equator_expected = 388.4e6
    np.testing.assert_allclose(rclv.polygon_area(verts_proj_equator),
                               area_equator_expected,
                               rtol=0.01)

    lat0 = 60
    verts_proj_60N = rclv.project_vertices(verts, lon0, lat0, 0.1, 0.1)
    np.testing.assert_allclose(rclv.polygon_area(verts_proj_60N),
                               area_equator_expected / 2,
                               rtol=0.01)

    lat0 = -60
    verts_proj_60S = rclv.project_vertices(verts, lon0, lat0, 0.1, 0.1)
    np.testing.assert_allclose(rclv.polygon_area(verts_proj_60S),
                               area_equator_expected / 2,
                               rtol=0.01)
Beispiel #3
0
def test_polygon_area(square_verts):
    assert rclv.polygon_area(square_verts) == 1.0
    # try without the last vertex
    assert rclv.polygon_area(square_verts[:-1]) == 1.0