DRAINAGE PATH DELINEATION IN GRID

/* COMMANDS TO PREPARE FILLED GRIDS FOR DRAINAGEPATH DELINEATION
/* For each subwatershed within covshd where drainage path is desired,
/* the following set of 6 commands should be repeated:
/* Grid: mape >gridname<
/* use this "filled" grid created in watershed.aml
/* Grid: gridpaint >gridname< value linear nowrap gray
/* Grid: linecolor 2 /* change linecolor to red
/* Grid: arcs >watershed coverage</* overlay the subwatershed boundaries
/* created in watershed.aml
/* Grid: setwindow *
/* using the setwindow command with mouse/cursor, the user must
/* define a box that completely
/* encloses a subwatershed and has an edge that passes EXACTLY
/* through the pour (outlet) point of the subwatershed.
/* Grid: subfilX = >gridname<
/* where subfilX = subfil1, subfil2, etc. for each subwatershed
/*******************************************************************************
/* A GRID AML FOR DELINEATION OF DRAINAGE PATHS WITHIN SUB-WATERSHEDS
/* AML NAME: drainpaths.aml (run from the Grid prompt)
/* FUNCTION: Delineates drainage paths to outlet points within a watershed
/* INPUTS:
/* subfilX - each "filled" subwatershed grid (subfil1, subfil2, etc.)
/* The procedure to prepare the subfilX grids is described above.
/*****************************************************************************
/* BEGIN AML EXECUTION
/* the following 9 commands must be repeated for each subwatershed grid,
/* subfilX (X = 1, 2, etc.):
/* create a flow direction grid from the filled grid
subfdrX = flowdirection(subfilX)
/* calculate flowlength grids in both upstream and downstream directions
uplenX = flowlength(subfdrX,#,upstream)
downlenX = flowlength(subfdrX,#,downstream)
/* sum the two flowlength grids together
totalX = uplenX + downlenX
/* create a grid of integer truncated values from the summed grid
totintX = int(totalX)
/* create a Value Attribute Table (.vat) for the integer grid
buildvat totintX
/* Create a drainage path grid by comparing the values in each
/* cell of the summed grid with the max value in the integer grid and
/* storing a 1 in output grid cells that correspond to locations where the
/* summed value is greater than the integervalue. The remaining cells are stored
/* with NODATA
describe totintX
maxpathX = con(totalX > %GRD$zmax%,1)
/* create an arc coverage equivalent to the drainage path grid
covpathX = gridline(maxpathX)
/* insert additional sets of drainage path delineation commands here (X = 2, 3,...)
&return
/******************END OF AML*************************************************


Go to AML listings

Connect to Watershed Delineation AML