-
Notifications
You must be signed in to change notification settings - Fork 0
/
drt_grid.m
34 lines (27 loc) · 1.7 KB
/
drt_grid.m
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
function scenario = drt_grid(scenario)
%drt_erosion: code to set up grids for input to the dune response tool
%Build Profile
%assumed geometric and gridding parameters for simplicity
scenario.grids.morphometrics.dunewidth = 10;
scenario.grids.morphometrics.dx = 0.1;
scenario.grids.morphometrics.smoothlev = 10;
scenario.grids.morphometrics.shore = 0;
%set up profile segments
numdune = round(scenario.grids.morphometrics.dunewidth/scenario.grids.morphometrics.dx);
Zbackdune = (scenario.grids.morphometrics.dhigh-2)*ones(ceil(20/scenario.grids.morphometrics.dx),1);
Zbackduneslope = (scenario.grids.morphometrics.dhigh-0.5):(scenario.grids.morphometrics.duneslope)*scenario.grids.morphometrics.dx:scenario.grids.morphometrics.dhigh;
Zdune1 = scenario.grids.morphometrics.dhigh*ones(numdune,1);
Zdune2 = scenario.grids.morphometrics.dhigh:-(scenario.grids.morphometrics.duneslope)*scenario.grids.morphometrics.dx:scenario.grids.morphometrics.dtoe;
Zbeach = scenario.grids.morphometrics.dtoe:-(scenario.grids.morphometrics.backshoreslope)*scenario.grids.morphometrics.dx:scenario.grids.morphometrics.shore;
%combine all segments
Zall = [ Zbackduneslope(:); Zdune1(:); Zdune2(:); Zbeach(:)];
Zall = flipud(Zall);
%Smooth Data
Zall = smoothdata(Zall, 'gaussian', scenario.grids.morphometrics.smoothlev);
%Grid Setup
XGrid = -[0:1:[numel(Zall)-1]]*abs(scenario.grids.morphometrics.dx);
XGrid = fliplr(XGrid)';
%Output Data
scenario.grids.XGrid = XGrid(:)';
scenario.grids.ZGrid = Zall(:)';
end