예제 #1
0
def test_band_interp(arr):
    arr[0, 0] = np.nan
    band = pymagery.Band(arr)
    interpd = band.interp()
    # preserve original?
    assert np.isnan(band[0, 0])
    # new value correct?
    neighbors = np.array([band[1, 0], band[0, 1], band[1, 1]])
    assert min(neighbors) <= interpd[0, 0] <= max(neighbors)
예제 #2
0
def test_band_fill_negs(arr, arr_wit_negs):
    band = pymagery.Band(arr_wit_negs)
    filled = band.fill_negs(9)
    # check on filled vals
    assert (filled[0, :3] == 9).all()
    # and check on the others
    assert (filled[1:] == arr[1:]).all()
    # check preservation
    assert (band == arr_wit_negs).all()
예제 #3
0
def test_band_fill_nans(arr, arr_wit_nans):
    band = pymagery.Band(arr_wit_nans)
    filled = band.fill_nans(9)
    # check on filled vals
    assert (filled[0, :3] == 9).all()
    # and check on the others
    assert (filled[1:] == arr[1:]).all()
    # check preservation
    np.testing.assert_equal(band, arr_wit_nans)
예제 #4
0
def rgb_bands():
    return pymagery.Bands({
        'r': pymagery.Band([[1, 0], [0, 1]]),
        'g': pymagery.Band([[0, 1], [1, 0]]),
        'b': pymagery.Band([[0, 0], [1, 1]])
    })
예제 #5
0
def mb_bands():
    return pymagery.Bands({
        1: pymagery.Band([[1, 0], [0, 1]]),
        2: pymagery.Band([[0, 1], [1, 0]])
    })
예제 #6
0
def band(arr):
    return pymagery.Band(arr)