-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathMarkChannels.m
More file actions
40 lines (29 loc) · 932 Bytes
/
MarkChannels.m
File metadata and controls
40 lines (29 loc) · 932 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
function [p g] = MarkChannels(p,g)
% [p g] = MarkChannels(p,g)
%
% Identifies the locations of channels based on fluvial incision threshold,
% and records them in a matrix, g.Channels
if p.thetac > 0
% calculate drainage area
g = DrainageArea(p,g);
% calculate slope
S = UpwindSlope(p,g);
S(S<0) = 0; % This will only happen where we've routed flow uphill to flood depressions
% calculate A^m*S^w
if p.m ~= 1 % otherwise we don't need to raise area to a power, saving time
Am = g.A.^p.m;
else
Am = g.A;
end
if p.w ~= 1 % ditto for slope
Sw = S.^p.w;
else
Sw = S;
end
AmSw = Am.*Sw;
% record locations of channels (points that exceed threshold)
g.Channels = AmSw > p.thetac;
else
% If there is no fluvial incision threshold, channel incision can occur everywhere
g.Channels = ones(p.K,p.J);
end