/usr/lib/python2.7/dist-packages/rasterio/sample.py is in python-rasterio 0.36.0-2build5.
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]
|