This file contains 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 | |
# load the geotiff (a DSM in this case) and read the data - only one index in this case | |
dsm = rasterio.open(dsm_fname) | |
dsm_data = dsm.read()[0] | |
# crop the data | |
dsm_crop = dsm_data[min_y:min_y+height, min_x:min_x+width] | |
# make a copy of the geotiff metadata |