# Choose elevation map and threshold elevation = srtm threshold = 1E6 # [m**2], minimum catchment size = 1 km**2 # Build a map of cell areas: pick one of these # km2 is more intuitive, but 1 km2 is the threshold for the smallest # threshold catchment size r.mapcalc('cellArea_meters2 = '+str(reg.nsres)+' * '+str(reg.ewres), overwrite=True) r.mapcalc("cellArea_km2 = cellArea_meters2 / 10^6", overwrite=True) # Use r.watershed to build a drainage basin with units of length**2 # instead of arbitrary units (cells) r.watershed(elevation=elevation, flow='cellArea_meters2', accumulation='drainageArea_m2', drainage='drainageDirection', stream='streams', threshold=thresh, flags='s', overwrite=True) # Note that this will include areas of negative (i.e. offmap) flow accumulation # Build watershed network using r.stream.extract: single-flow-direction (SFD) print "Building drainage network" r.stream_extract(elevation=elevation, accumulation='drainageArea_m2', threshold=thresh, d8cut=0, mexp=0, stream_raster='streams', stream_vector='streams', direction='draindir', overwrite=True)
Last changed: $Date 2016-09-27$