Guest User

Untitled

a guest
Oct 22nd, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. def read(self, indexes=None, out=None, window=None, masked=False,
  2. boundless=False):
  3. """Read raster bands as a multidimensional array
  4. Parameters
  5. ----------
  6. window : a pair (tuple) of pairs of ints, optional
  7. The optional `window` argument is a 2 item tuple. The first
  8. item is a tuple containing the indexes of the rows at which
  9. the window starts and stops and the second is a tuple
  10. containing the indexes of the columns at which the window
  11. starts and stops. For example, ((0, 2), (0, 2)) defines
  12. a 2x2 window at the upper left of the raster dataset.
  13. """
  14.  
  15. def block_windows(self, bidx=0):
  16. """Returns an iterator over a band's block windows and their
  17. indexes.
  18. [....]
  19. The primary use of this function is to obtain windows to pass to
  20. read_band() for highly efficient access to raster block data.
  21. """
  22.  
  23. with rasterio.open("your/data/geo.tif") as src:
  24. for block_index, window in src.block_windows(1):
  25. block_array = src.read(window=window)
  26. result_block = some_calculation(block_array)
Add Comment
Please, Sign In to add comment