/* Name of AML: manypd.aml
/* Authors: Patrick Barabe and Gary
L. Christopherson
/* pbarabe@casa.arizona.edu
garych@casa.arizona.edu
/* Center for Applied Spatial
Analysis, The University
of Arizona
/* Date Created: May 1999
/* Module: GRID
/* Description:
/* This AML creates individual pathdistance grids for sites in
the
/* Umayri survey and determines the pathdistance to the closest
/* neighboring site. Output is a site grid with values for
nearest
/* neighbor path distances.
/*&watch %.watchfile%
&LABEL menu
/* kicking out to the menu
&menu manypd.menu &form &position &ur &stripe 'Pathdistance Nearest Neighbor Routine'
/* Deciding whether or not to continue
&LABEL DECIDE
&if %choice% = dontdoit &then
&goto END2
&LABEL BEGIN
&setvar .z = %.min%
&watch %.watchfile%
&LABEL SITESELECT
/* Selecting a point from umsit_unq
killmea = select (%.sitegrid%, "value < %.z%")
killmeb = con(%.sitegrid% eq %.z%,%.sitegrid%,0)
&if [exists killmeb -vat] &then
&goto CALCDIST
&else &goto plusone
&LABEL plusone
&type
&type A site number %.z% does not exist.
&type Adding one and trying again.
&type
kill killmea
kill killmeb
&setvar .z = [calc %.z% + 1]
&if %.z% gt %.max% &then &goto END1
&else &goto SITESELECT
&LABEL CALCDIST
/*Calculating pathdistance for killme grid
&type
&type
&type Now processing Site # %.z%
&type
&s .y = 1
killmec = pathdistance(killmea,%.fric%,%.elv%)
/*killmec = eucdistance(killmea) /* [used
for testing euclidean distance against pathdistance]
killmed = con(killmeb eq %.z%,killmec,0)
&if %.z% = %.min% &then
killme%.z% = killmed
&else &do &while %.y% = 1
&s .x = [calc %.z% - 1]
killme%.z% = killme%.x% + killmed
&s .y = 2
&end
&if %.z% gt %.min% &then kill killme%.x%
kill killmea
kill killmeb
kill killmec
kill killmed
&goto RECYCLE
&LABEL END1
/*Shutting Down
%.outgrid% = con(killme%.max% gt 0,killme%.max%)
kill killme%.max%
&type
&type
&type *************************************
&type * IF
YOU ARE READING THIS MESSAGE *
&type * THE
PROCESSES ARE DONE RUNNING *
&type * AND
YOU MAY GO HOME *
&type *************************************
&type
&watch &off
mape %.outgrid%
gridpaint %.outgrid%
&LABEL END2
&stop
&return
&LABEL RECYCLE
&s done = [calc %.z% - %.min% + 1]
&s tot = [calc %.max% - %.min%]
&type
&type
&lv
lg
&type
&type
&type
&type !!YIPPEE!!
&type
&type
&type
&setvar .z = [calc %.z% + 1]
&setvar .x = [calc %.z% - 1]
&if %.z% gt %.max% &then &goto END1
&else &goto SITESELECT