Created
July 31, 2020 23:51
-
-
Save AndrewAnnex/b5da9cb02014238763830a04557cf2f6 to your computer and use it in GitHub Desktop.
rasterio read speed test helper function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import rasterio as rio | |
import concurrent.futures as cf | |
def fc(p,n=4): | |
with rio.open(p) as src: | |
blocks = [_[1] for _ in src.block_windows()] | |
def rf(w): | |
with rio.open(p) as src: | |
data=src.read(window=w) | |
return data | |
with cf.ThreadPoolExecutor(max_workers=n) as ex: | |
x = list(ex.map(rf, blocks)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment