Esempio n. 1
0
def test_unitxy_ur():
    win, unitxy = point_window_unitxy(245318, 1000073, affine)
    assert win == ((30, 32), (39, 41))
    x, y = unitxy
    # should be in LL of new unit square
    assert x < 0.5
    assert y < 0.5

    win, unitxy = point_window_unitxy(245296, 1000073, affine)
    assert win == ((30, 32), (38, 40))
    x, y = unitxy
    # should be in LL of new unit square
    assert x < 0.5
    assert y < 0.5
Esempio n. 2
0
def test_unitxy_ll():
    win, unitxy = point_window_unitxy(245300, 1000056, affine)
    assert win == ((31, 33), (38, 40))
    x, y = unitxy
    # should be in UR of new unit square
    assert x > 0.5
    assert y > 0.5
Esempio n. 3
0
def test_unitxy_lr():
    win, unitxy = point_window_unitxy(245318, 1000056, affine)
    assert win == ((31, 33), (39, 41))
    x, y = unitxy
    # should be in UL of new unit square
    assert x < 0.5
    assert y > 0.5
Esempio n. 4
0
def test_unitxy_ul():
    win, unitxy = point_window_unitxy(245300, 1000073, affine)
    assert win == ((30, 32), (38, 40))
    x, y = unitxy
    # should be in LR of new unit square
    assert x > 0.5
    assert y < 0.5
Esempio n. 5
0
def test_xy_array_bilinear_window():
    """ integration test
    """
    x, y = (245309, 1000064)

    with rasterio.open(raster) as src:
        win, unitxy = point_window_unitxy(x, y, affine)
        arr = src.read(1, window=win)

    val = bilinear(arr, *unitxy)
    assert round(val) == 74