Can't read in a Landsat geotiff and use multiple threads to write out different windows at the same time
I moved this github issue over here since it seems like more of a usage/help question. Below is the issue with a reproducible example if you have a Landsat tif. The program fails at different windows when writing out windows with threads. This issue is related to this issue https://github.com/mapnik/node-mapnik/issues/437#issuecomment-103806098
|
|
Sean Gillies
The VRT_SHARED_SOURCE option only affects the connection pool within the VRT driver code and that's not relevant to your code as far as I can see. A single opened rasterio dataset cannot be safely used by multiple threads, concurrently. There is more about this limitation at https://trac.osgeo.org/gdal/wiki/FAQMiscellaneous#IstheGDALlibrarythread-safe. Each of your threads will need exclusive use of a dataset object. The simplest way to achieve this is to call rasterio.open(..., sharing=False) in new threads to get a new dataset and then close it before the thread is joined. Another way is to create a suitably-sized pool of dataset objects (also using the sharing=False option) within your application and then assign these to your threads on a as-needed basis. I hope this helps,
On Mon, May 6, 2019 at 7:02 PM <ravery@...> wrote:
-- Sean Gillies
|
|
Thanks Sean, very helpful and makes sense.
On Tue, May 7, 2019 at 9:30 AM Sean Gillies <sean.gillies@...> wrote:
--
Ryan Avery Graduate Student, WAVES Lab Department of Geography University of California, Santa Barbara
|
|