ubarsc / rios

A raster processing layer on top of GDAL
https://www.rioshome.org
GNU General Public License v3.0
14 stars 7 forks source link

add missing FlushCache call to addPyramid() #66

Closed gillins closed 12 months ago

gillins commented 1 year ago

Before https://github.com/ubarsc/rios/commit/3bca2a5f02d2906f7ce02cb5158e94e1d76937c9 we used to calculate stats before pyramid layers. addStatistics had a ds.FlushCache() call at the beginning so we knew all the blocks were written before reading the file to work out the stats and make the pyramid layers. In this commit the order was changed so that the pyramid layers were calculated first so that they would be available for approximating statistics. However we never moved the ds.FlushCache call. It seems in certain situations with large files (only seen on Windows, but could in theory happen elsewhere) not all the blocks are written out before the pyramid layers are calculating resulting in a GDAL error.

This PR adds a ds.FlushCache to addPyramid also so all blocks are written whichever order the functions are called in.

Problem reported by and fix confirmed by @t-hackwood.

neilflood commented 1 year ago

This makes perfect sense. Many thanks to @gillins and @t-hackwood for tracking this down.