Commit a2444934 authored by Frisinghelli Daniel's avatar Frisinghelli Daniel
Browse files

Found bug in clip raster: FlushCache() required to save to disk.

parent e322d8a0
......@@ -2826,15 +2826,14 @@ def clip_raster(src_ds, mask_ds, trg_ds, fmt=None, overwrite=False,
LOGGER.info('Clipping: {}, Extent: (x_tl={:.2f}, y_br={:.2f}, x_br={:.2f},'
' y_tl={:.2f})'.format(src_path.name, *extent))
ds = gdal.Warp(str(tmp_path), str(src_path),
srcSRS=src_sr,
outputBounds=extent,
outputBoundsSRS=src_sr,
dstSRS=src_sr,
xRes=src_ds.GetGeoTransform()[1],
yRes=src_ds.GetGeoTransform()[5],
yRes=src_ds.GetGeoTransform()[-1],
srcNodata=src_no_data,
dstNodata=trg_no_data,
format=fmt)
ds.FlushCache() # REQUIRED: writes dataset to disk!
# compress raster dataset
compress_raster(tmp_path, trg_path, compress=compress)
......
Supports Markdown
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