mirror of
https://github.com/rasterio/rasterio.git
synced 2025-12-08 17:36:12 +00:00
At the heart of this was a subtle indexing error due to calling round() instead of math.floor(). Fixing that needed a cascade of fixes to expectated values in various tests. Finally, core logic in the merge command was rewritten for correctness and clarity.
18 lines
573 B
Python
18 lines
573 B
Python
import rasterio
|
|
|
|
|
|
def test_sampling():
|
|
with rasterio.open('tests/data/RGB.byte.tif') as src:
|
|
data = next(src.sample([(220650.0, 2719200.0)]))
|
|
assert list(data) == [18, 25, 14]
|
|
|
|
def test_sampling_beyond_bounds():
|
|
with rasterio.open('tests/data/RGB.byte.tif') as src:
|
|
data = next(src.sample([(-10, 2719200.0)]))
|
|
assert list(data) == [0, 0, 0]
|
|
|
|
def test_sampling_indexes():
|
|
with rasterio.open('tests/data/RGB.byte.tif') as src:
|
|
data = next(src.sample([(220650.0, 2719200.0)], indexes=[2]))
|
|
assert list(data) == [25]
|