1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
""" Test gdal plugin functionality.
"""
import pytest
import imageio
pytest.importorskip("osgeo", reason="gdal is not installed")
def test_gdal_reading(test_images):
"""Test reading gdal"""
filename = test_images / "geotiff.tif"
im = imageio.imread(filename, "gdal")
assert im.shape == (929, 699)
R = imageio.read(filename, "gdal")
assert R.format.name == "GDAL"
meta_data = R.get_meta_data()
assert "TIFFTAG_XRESOLUTION" in meta_data
# Fail
with pytest.raises(IndexError):
R.get_data(-1)
with pytest.raises(IndexError):
R.get_data(3)
|