rasterio/tests/test_coords.py
Sean Gillies a807d1bd51 Closes #282.
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.
2015-03-11 15:11:52 -06:00

19 lines
696 B
Python

import rasterio
def test_bounds():
with rasterio.open('tests/data/RGB.byte.tif') as src:
assert src.bounds == (101985.0, 2611485.0, 339315.0, 2826915.0)
def test_ul():
with rasterio.open('tests/data/RGB.byte.tif') as src:
assert src.ul(0, 0) == (101985.0, 2826915.0)
assert src.ul(1, 0) == (101985.0, 2826614.95821727)
assert src.ul(src.height, src.width) == (339315.0, 2611485.0)
assert tuple(
round(v, 6) for v in src.ul(~0, ~0)
) == (339014.962073, 2611785.041783)
def test_res():
with rasterio.open('tests/data/RGB.byte.tif') as src:
assert tuple(round(v, 6) for v in src.res) == (300.037927, 300.041783)