-
Notifications
You must be signed in to change notification settings - Fork 0
/
Example_MatFlood.m
93 lines (49 loc) · 1.73 KB
/
Example_MatFlood.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
%%% Show MatFlood using spatially uniform and varying water level %%%
clear; close all; clc
% Change the path to where the script/ toolbox are
folder = pwd;
cd(folder)
% add the toolbox
addpath(genpath(folder))
%% Input parameters
% DEM
load('DEM.mat')
[rows,columns]= size(z);
% point to indicate water
wb= [-71.03 42.325];
% colormaps (for plotting)
terrain = load('TerrainColorMap','mycmap');
%% Plot topography
figure; pcolor(lon,lat,z); shading flat; colorbar
hold all;
h1 = plot(wb(1),wb(2),'.m','MarkerSize',20);
ax = gca;
colormap(ax,terrain.mycmap)
clim([0 10])
dz = 0:1:30;
[~, h11]= contour(lon,lat,z,dz,'color','k','LineWidth',.1,'showtext','off');
title('Elevation data (m), Boston city')
legend(h1,'Point to indicate water','Location','Best')
%% Scenario 1. Applying an univariate water level (spatially uniform flood water level)
% flood water level
wl_s1 = 1.4;
[SF_s1,fwl_s1] = MatFlood_StaticFlooding(lon, lat, z, wl_s1, wb);
% Plot results
figure;
pcolor(lon,lat,SF_s1.FloodDepth); shading flat; colorbar
ax = gca;
colormap(ax,'Spring')
title(['Flood depth using spatially uniform water level (' num2str(wl_s1) ' m)'])
%% Scenario 2. Applying a vector of water levels (spatially varying flood water level)
% flood water level [Lon Lat wl]
wl_s2 = [-71.0233 42.3470 1.7;
-71.0285 42.3317 1.25;
-71.0342 42.3128 1.25];
[SF_s2,fwl_s2] = MatFlood_StaticFlooding(lon, lat, z, wl_s2, wb);
% Plot results
figure; pcolor(lon,lat,SF_s2.FloodDepth); shading flat; colorbar
ax = gca;
colormap(ax,'Spring')
title('Flooding using spatially varying water level')
%% Save results
save Flood_depth_Boston.mat SF_s2 -mat