/* script to calculate a bunch of landscape parameters with GRID /* to be run in grid &s zgrid = q2446 &type %zgrid% &s cellsize = 10 setcell %cellsize% &s maxcurv = 2 &if [exist slopeg -grid] &then kill slopeg all slopeg = slope(%zgrid%, percentrise) &if [exist fdir -grid] &then kill fdir all &if [exist fillg -grid] &then kill fillg all fill %zgrid% fillg sink # fdir &if [exist facc -grid] &then kill facc all facc = flowaccumulation(fdir) &s critical_area = 1000000 &s critical_cells = [calc %critical_area% / ( %cellsize% * %cellsize% ) ] &if [exist channels -grid] &then kill channels all channels = con(facc > %critical_cells%, 1, 0) &if [exist curv -grid] &then kill curv all curv = curvature(%zgrid%) &if [exist airtemp -grid] &then kill airtemp all airtemp = 28 - 0.01 * %zgrid% &if [exist solarheat -grid] &then kill solarheat all solarheat = hillshade(%zgrid%, 180, 45) * 25 / 255 &if [exist soiltemp -grid] &then kill soiltemp all soiltemp = airtemp + solarheat &if [exist goodg -grid] &then kill goodg all goodg = con(soiltemp > 33 and soiltemp < 43 and channels == 0 and slopeg <= 20 and curv < %maxcurv%, 1, 0) &return