/usr/lib/python3/dist-packages/rasterio/sample.py is in python3-rasterio 0.31.0-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 | # Workaround for issue #378. A pure Python generator.
def sample_gen(dataset, xy, indexes=None):
index = dataset.index
read = dataset.read
for x, y in xy:
r, c = index(x, y)
window = ((r, r+1), (c, c+1))
data = read(indexes, window=window, masked=False, boundless=True)
yield data[:,0,0]
|