Commit a62a2317 authored by David Youssefi's avatar David Youssefi

BUG: depends on rasterio version

parent d060ce41
......@@ -73,12 +73,23 @@ def write_quicklook(raster, filename, downfactor=4):
# update size in profile
newwidth = int(raster.width/downfactor)
newheight = int(raster.height/downfactor)
aff = raster.affine
newaffine = rasterio.Affine(aff.a/downfactor, aff.b, aff.c,
aff.d, aff.e/downfactor, aff.f)
profile.update(dtype=rasterio.uint8, count=3, compress='lzw', driver='JPEG',
width=newwidth, height=newheight, transform=newaffine, affine=newaffine)
try:
aff = raster.affine
newaffine = rasterio.Affine(aff.a/downfactor, aff.b, aff.c,
aff.d, aff.e/downfactor, aff.f)
profile.update(dtype=rasterio.uint8, count=3, compress='lzw', driver='JPEG',
width=newwidth, height=newheight, transform=newaffine, affine=newaffine)
# depend on rasterio version
except AttributeError:
aff = raster.transform
newaffine = rasterio.Affine(aff.a/downfactor, aff.b, aff.c,
aff.d, aff.e/downfactor, aff.f)
profile.update(dtype=rasterio.uint8, count=3, compress='lzw', driver='JPEG',
width=newwidth, height=newheight, transform=newaffine)
# write raster
with rasterio.open(filename, 'w', **profile) as dst:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment