Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def read(self, indexes=None, out=None, window=None, masked=False,
- boundless=False):
- """Read raster bands as a multidimensional array
- Parameters
- ----------
- window : a pair (tuple) of pairs of ints, optional
- The optional `window` argument is a 2 item tuple. The first
- item is a tuple containing the indexes of the rows at which
- the window starts and stops and the second is a tuple
- containing the indexes of the columns at which the window
- starts and stops. For example, ((0, 2), (0, 2)) defines
- a 2x2 window at the upper left of the raster dataset.
- """
- def block_windows(self, bidx=0):
- """Returns an iterator over a band's block windows and their
- indexes.
- [....]
- The primary use of this function is to obtain windows to pass to
- read_band() for highly efficient access to raster block data.
- """
- with rasterio.open("your/data/geo.tif") as src:
- for block_index, window in src.block_windows(1):
- block_array = src.read(window=window)
- result_block = some_calculation(block_array)
Add Comment
Please, Sign In to add comment