mirror of
https://github.com/rasterio/rasterio.git
synced 2025-12-08 17:36:12 +00:00
Indirectly, using MEM datasets as an intermediary. Closes #177. Also add --driver option to rio-stack for integration testing. Move CLI main to main.py
21 lines
630 B
Python
21 lines
630 B
Python
import logging
|
|
import subprocess
|
|
import sys
|
|
import re
|
|
import numpy
|
|
import rasterio
|
|
|
|
logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)
|
|
|
|
|
|
def test_write_ubyte(tmpdir):
|
|
name = str(tmpdir.mkdir("sub").join("test_write_ubyte.png"))
|
|
a = numpy.ones((100, 100), dtype=rasterio.ubyte) * 127
|
|
with rasterio.open(
|
|
name, 'w',
|
|
driver='PNG', width=100, height=100, count=1,
|
|
dtype=a.dtype) as s:
|
|
s.write_band(1, a)
|
|
info = subprocess.check_output(["gdalinfo", "-stats", name]).decode('utf-8')
|
|
assert "Minimum=127.000, Maximum=127.000, Mean=127.000, StdDev=0.000" in info
|