class stackstac.rio_reader.ThreadLocalRioDataset(env, ds, vrt=None)

Creates a copy of the dataset and VRT for every thread that reads from it.

In GDAL, nothing allows you to read from the same dataset from multiple threads. The best concurrency support available is that you can use the same driver, on separate dataset objects, from different threads (so long as those datasets don’t share a file descriptor). Also, the thread that reads from a dataset must be the one that creates it.

This wrapper transparently re-opens the dataset (with sharing=False, to use a separate file descriptor) for each new thread that accesses it. Subsequent reads by that thread will reuse that dataset.


When using a large number of threads, this could potentially use a lot of memory! GDAL datasets are not lightweight objects.

__init__(env, ds, vrt=None)

Initialize self. See help(type(self)) for accurate signature.


__init__(env, ds[, vrt])

Initialize self.


Release every thread’s reference to its dataset, allowing them to close.

read(window, **kwargs)

Read from the current thread’s dataset, opening a new copy of the dataset on first access from each thread.




Union[SelfCleaningDatasetReader, WarpedVRT]