rasterio/tests/test_reshape_image.py
Colin Talbert 2bd1bd9aed Refactored mpl.use('agg') from the tests __init__
replaced with a swap of
plt.show with an empty lambda
2016-06-07 08:45:03 -06:00

21 lines
541 B
Python

import numpy as np
import rasterio
try:
import matplotlib as mpl
mpl.use('agg')
except:
pass
def test_reshape():
with rasterio.open('tests/data/RGB.byte.tif') as src:
im_data = rasterio.plot.reshape_as_image(src.read())
assert im_data.shape == (718, 791, 3)
def test_roundtrip_reshape():
with rasterio.open('tests/data/RGB.byte.tif') as src:
data = src.read()
im_data = rasterio.plot.reshape_as_image(data)
assert np.array_equal(data, rasterio.plot.reshape_as_raster(im_data))