def test_gtiff_profile_compress(): assert DefaultGTiffProfile()()['compress'] == 'lzw'
def test_gtiff_profile_nodata(): assert DefaultGTiffProfile()()['nodata'] == 0
def test_gtiff_profile_tiled(): assert DefaultGTiffProfile()()['tiled'] == True
def test_gtiff_profile_blockysize(): assert DefaultGTiffProfile()()['blockysize'] == 256
def test_gtiff_profile_format(): assert DefaultGTiffProfile()()['driver'] == 'GTiff'
def test_gtiff_profile_interleave(): assert DefaultGTiffProfile()()['interleave'] == 'band'
import numpy as np import rasterio from rasterio.profiles import DefaultGTiffProfile BANDS = 3 WIDTH = 17 HEIGHT = 11 array = np.arange(0, BANDS * WIDTH * HEIGHT, dtype='uint16') array.shape = (BANDS, WIDTH, HEIGHT) with rasterio.Env(): profile = DefaultGTiffProfile(width=WIDTH, height=HEIGHT, dtype=rasterio.uint16, count=3) with rasterio.open('example.tif', 'w', **profile) as dst: dst.write(array)
def test_gtiff_profile_dtype_override(): assert DefaultGTiffProfile(dtype='uint16')['dtype'] == rasterio.uint16
def test_gtiff_profile_other(): assert DefaultGTiffProfile(count=3)['count'] == 3
def test_gtiff_profile_dtype(): assert DefaultGTiffProfile()['dtype'] == rasterio.uint8
def test_gtiff_profile_format(): assert DefaultGTiffProfile()['driver'] == 'GTiff' with pytest.warns(RasterioDeprecationWarning): assert DefaultGTiffProfile()()['driver'] == 'GTiff'