/* riparian module Shade part author Flo damian
-
-
/*first compute the flowdir(flow),flowaccumulation(flowacc),streams,
tree hight(hight)
-
/* and canopy grids
-
/* d is the drain area in acres above each stream cell; computing stream
width and depth
-
d
= streams * flowacc * 0.024
-
width
= con(d < 64, 7, d < 128, 8, d < 192, 10, d < 256, 12, d <
320, 13,~
-
d
< 384, 14, d < 448, 15, d < 512, 16, d < 576, 16.5, d <
640, 17, d < 1280, 20,~
-
d
< 1920, 25, d < 2560, 28)
-
depth
= con(d < 64, 0.8, d < 128, 1.1, d < 192, 1.3, d < 256, 1.4,
d < 320~
-
,
1.5, d < 384, 1.55, d < 448, 1.6, d < 512, 1.65, d < 576, 1.7,
d < 640, 1.8, d~
-
<
1280, 1.95, d < 1920, 2.2, d < 2560, 2.5)
-
minshade
= con(dem < 120, 80, dem < 440, 70, dem < 680, 60, dem < 1000,
50, dem < 1320, 40,~
-
dem
< 1640, 30, dem < 1960, 20, dem < 2360, 10, 0)
-
sensitive
= con(width < 100, 1)
-
/*the flowdir converted to orientation from north clockwise
-
strangle
= con(flow == 1, 90, flow == 2, 135, flow == 4, 180, flow == 8,~
-
225,
flow == 16, 270, flow == 32, 315, flow == 64, 360, 45)
-
/* the engine; eliminate kill lines
-
&sv
i := 0
-
&do
&while %i% < 4
-
&sv
a = [response 'the sun altitude is']
-
&sv
o = [response 'the sun azimuth is']
-
&sv
h = [response 'the hour of the day is']
-
pshade%h%
= hight * (abs(sin((strangle - %o%)div deg))) / tan(%a% div deg)
-
tshade%h%
= streams * con(hillshade(dem) <= 62, 1,0)
-
pc_shade%h%
= sensitive * con(tshade%h%, 100, pshade%h% * canopy2 / width)
-
exposed%h%2
= con((pc_shade%h% - minshade) < 0, (pc_shade%h% - minshade))
-
kill
pshade%h%
-
kill
tshade%h%
-
kill
pc_shade%h%
-
&sv
i := %i% + 1
-
&end
-
&return
-
-
-
/*LWD near term recruitment Author Flo Damian
-
/*data required:Streams(1,null), Grad - stream gradient, Dem, check below
-
&sv
streams = [response 'Stream layer =']
-
&sv
grad = [response 'stream gradient =']
-
&sv
dem = [response 'dem grid =']
-
&sv
species = [response 'grid of primary species, check the code for modifications
=']
-
&sv
diam = [response 'grid of DBH = ']
-
&sv
canopy = [response 'grid of canopy percent']
-
/*compute channel sensitivity ratings; consider grad the stream gradient
-
smgrd
= %streams% * focalmean(%grad% * %streams%)
-
curv
= %streams% * curvature(%dem%)
-
col
= con(smgrd <= 1, 1, smgrd <= 2, 2, smgrd <= 4, 3, smgrd <=
8, 4)
-
row
= con(curv < -2.5, 30, curv < -1.3, 20, 10)
-
matrix
= row + col
-
/*let s be the sensitvity ratings 1= low, 3=high
-
s
= con(matrix == 11 or matrix == 14 or matrix == 34, 1, matrix == 14 or~
-
matrix
== 31 or matrix == 32 or matrix == 22 or matrix == 23, 3, 2)
-
/*lwd recruitment
-
/*consider spec a grid of species classified numerically with a certain
scheme.
-
mixture
= con(%species% == 1, 100, %species% == 2, 200, %species% == 3, 300)
-
/*d2 size class
-
size
= con(%diam% < 12, 10, %diam% < 20, 20,30)
-
/*d3 density
-
dens
= con(%canopy% < 60, 1, 2)
-
sum
= mixture + size + dens
-
/*let r be the potential ratings with 1=low, 3= high
-
r
= con(sum == 122 or sum == 322 or sum == 332 or sum == 132, 3, sum == 222
~
-
or
sum == 121 or sum == 131 or sum == 232 or sum == 331, 2, 1)
-
/*near term recruting hazard
-
/*1 LWD on;
-
rec_haz1
= con(s == 1, 1, s == 2, 2, s == 3 and r == 1, 3, s == 3 and r == 2, 2,
s == 3 ~
-
and
r == 3,2)
-
/*2 LWD off
-
rec_haz2
= con(s == 1, 1,3)
-
/*clean up mess
-
kill
dens
-
kill
size
-
kill
mixture
-
kill
matrix
-
kill
row
-
kill
col
-
kill
curv
-
kill
smgrd
-
&return
-