&args cover /* name of clean river coverage &type 'Based on flipper, but doesn't flip /* adds items and calculated jorder &if [show program] ne 'ARC' &then; &do &type This must be started from ARC &return &pause 'Exiting. Try again.' &end /* set up for processing build %cover% line build %cover% node indexitem %cover%.aat TNODE# /* This will speed things up indexitem %cover%.aat FNODE# &if ^ [iteminfo %cover% -arc JORDER -exists] &then additem %cover%.aat %cover%.aat JORDER 4 4 i &if ^ [iteminfo %cover% -arc SHREVE -exists] &then additem %cover%.aat %cover%.aat SHREVE 4 4 i &if ^ [iteminfo %cover% -arc STRAHLER -exists] &then additem %cover%.aat %cover%.aat STRAHLER 2 2 i &if ^ [iteminfo %cover% -arc TLENGTH -exists] &then additem %cover%.aat %cover%.aat TLENGTH 4 12 F 3 relate add down %cover%.aat INFO TNODE# FNODE# linear ro ~ /* calculate total length and order from mouth ARCEDIT ec %cover% ef node &if ^ [iteminfo %cover% -NODE flag -exists] &then ADDITEM flag 2 2 c ef arc sel all /* if you are not sure of unique IDs calc %cover%-id = %cover%# calc JORDER = 0 save sel DOWN//RIVERS-ID > 0 nsel /* these ar the outlets of a well-constructed system calc JORDER = 1 /* we have river outlets calc tlength = LENGTH &s order 1 /* here we number the arcs from the outlet &label beowulf sel JORDER = %order% &s num [show number select] &if %num% eq 0 &then; &goto done &s i = 1 &label startloop1 &s id%i% = [show arc [show select %i%] item %cover%-id] &s length%i% = [show arc [show select %i%] item tlength] &s i = [calc %i% + 1] &if %i% le %num% &then; &goto startloop1 &set order = [calc %order% + 1] &ty working on stream order %order% %length1% &s i = 1 &label startloop2 sel %cover%-id eq [value id%i%] sel connect resel JORDER = 0 &if [show number select] > 0 &then ; &do calc JORDER = %order% calc tlength = [value length%i%] + LENGTH &end &s i = [calc %i% + 1] &if %i% le %num% &then; &goto startloop2 &goto beowulf &label done &set order = [calc %order% - 1] &type The highest order is %order% /* 32 QUIT y y &RETURN