Open cmu002 opened 1 year ago
You should be able to do something like this:
# Load inputs
grid = Grid.from_raster(dem_input)
dem = grid.read_raster(dem_input)
rast = rasterio.open(dem_input)
# Set variables
prof = rast.profile
transform = rast.transform
#Detect the pits in the DEM
pits = grid.detect_pits(dem)
test = "C:/Users/TEMP/flats.tif"
with rasterio.open(test,
'w',
driver='GTiff',
height=prof['height'],
width=prof['width'],
count=1,
dtype=prof['dtype'],
crs=rast.crs,
transform=transform) as output_raster:
output_raster.write(pits, 1)
Is it possible to export the pits/depressions/flats raster as a geotiff? Or are they locked in memory? I haven't seen any mention of this process in the documentation or tutorials. I've provided some example for reference:
Any help or guidance would be much appreciated!