/*------------------------------------------------------------- /* /* Command name: NEDPROCESSING.AML /* Language: AML /* /*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: /* /* Purpose: This aml, and the aml it calls (agree) do much of the preprocessing /* that is required to prepare a HUCs datasets for use in NHDWatershed. /* See the 'Preprocessing Instructions Document' on the applications /* page under 'NHDWatershed' which can be found on the NHD website: /* http://nhd.usgs.gov/ /* NHDWatershed is a tool that allows users to delineate a drainage basin /* from any point on an NHD reach. /* /*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: /* /* Calls: /* This aml calls 'agree.aml' which should be located in the same workspace /* /*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: /* /* History: /* Author/Site, Date, Event /* -------------------------------------------------------- /* cmjohnston 7/99 initial development of the 'ridge exaggeration' aspects /* psteeves 8/2001 aml expansion to include many other preprocessing functions /* psteeves 7/2003 updated the first fill to 10000 to account for the zunits /* being in centimeters. The sink grid will likely be used /* in ArcHydro, and the earlier fill process was practically /* useless, since it only performed a 1 meter fill. /*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: /* /* Notes: /* 1. Requires users to follow the steps leading up to this aml. These steps are /* described in a preprocessing instructions document (see 'Purpose' above) /* 2. Three coverages (huc8, huc12, and nhdrch) and one grid (topogr_gr) need /* to be located in the workspace that this aml is run from: 'huc8' is the outer /* watershed boundary of the selected HUC; 'huc12' is a further breakdown of the /* 8-digit HUC (which can include more subbasin boundaries than those represented /* in 12-digit HUCs); 'nhdrch' is a modified version of the hi-res nhd layer; /* 'topogr_gr' is the preprocessed NED data up to this point in the preprocessing. /* See the preprocessing instructions document for more details on all these layers. /* 3. This aml is run with the assumption that the topogr_gr zunits are in centimeters. /* /* /* /*------------------------------------------------------------- /* &if ( not [ exists huc8 -cover ] ) &then &do &type NEDPROCESSING: &type NEDPROCESSING: INPUT ERROR - Coverage 'huc8' does not exist &return &end &if ( not [ exists huc12 -cover ] ) &then &do &type NEDPROCESSING: &type NEDPROCESSING: INPUT ERROR - Coverage 'huc12' does not exist &return &end &if ( not [ exists nhdrch -cover ] ) &then &do &type NEDPROCESSING: &type NEDPROCESSING: INPUT ERROR - Coverage 'nhdrch' does not exist &return &end &if ( not [ exists topogr_gr -grid ] ) &then &do &type NEDPROCESSING: &type NEDPROCESSING: INPUT ERROR - Grid 'topogr_gr' does not exist &return &end buffer huc8 huc8_50 # # 50 .003 poly build nhdrch node build nhdrch line &delvar .I,.ans,.del grid disp 9999 mape huc8_50 setwindow huc8_50 topogr_gr fill topogr_gr topo_fill sink 10000 nhdgrd = linegrid(nhdrch, com_id, #, #, 10) gridshades nhdgrd value ridge_tmp = linegrid (huc12, #, #, #, 10) clear gridshades ridge_tmp value ridge_tmp2 = (ridge_tmp * 0) + 2 clear gridshades ridge_tmp2 value str_tmp = (nhdgrd * 0) + 1 clear gridshade str_tmp value str_grd = con (isnull(str_tmp), 0, str_tmp) clear gridshade str_grd value ridge_grd = con (isnull (ridge_tmp2), 0, ridge_tmp2) clear gridshade ridge_grd value work1 = str_grd + ridge_grd clear gridshade work1 value work2 = setnull (work1 == 3, work1) work3 = setnull (work1 == 1, work2) work4 = con (isnull (work2), 0, work3) /* for units centimeters work5 = work4 * 5000 /* for units meters /*work5 = work4 * 50 new_ridge_grd = con (isnull (work5), 0, work5) clear gridshade new_ridge_grd value identity wrap clear /*&r agree topo_fill nhdrch -30 6 -100 /* the variables used in Massachusetts are below /* using units of centimeters &r agree topo_fill nhdrch 30 -200 -50000 mape huc8_50 combo_grd = new_ridge_grd + elevgrid setwindow huc8_50 topogr_gr huc8_50g = polygrid (huc8_50,#,#,#,10) setmask huc8_50g combo_grd2 = combo_grd clear gridshades combo_grd2 value fill combo_grd2 fill_grd sink 10000 dir_grd = flowdirection (fill_grd) accum = flowaccumulation(dir_grd) clear gridshades dir_grd value shed_grd = watershed (dir_grd, nhdgrd) shed_cov = gridpoly (shed_grd) /* shed_cov is used to relate rch_code to com_id /* and it is subsequently loaded into the support layers directory clear gridshades shed_grd value IDENTITY WRAP setwindow huc8 topogr_gr huc8g = polygrid (huc8,#,#,#,10) setmask huc8g accum2 = accum dir2 = dir_grd /* these grids (dir2 and accum2) are the grids that get loaded /* into the support layers directory for watershed tools. /* rename them in the watershed tools directory to the recommended names /* (dir_grd and accum) kill NHDGRD all kill RIDGE_TMP all kill RIDGE_TMP2 all kill STR_TMP all kill WORK1 all kill WORK2 all kill WORK3 all kill WORK4 all kill WORK5 all kill COMBO_GRD2 all kill NEW_RIDGE_GRD all kill STR_GRD all kill RIDGE_GRD all kill ELEVGRID all &RETURN