-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWaveSummary.m
More file actions
104 lines (90 loc) · 3.97 KB
/
WaveSummary.m
File metadata and controls
104 lines (90 loc) · 3.97 KB
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
94
95
96
97
98
99
100
101
102
103
104
%% WAVESUMMARY summarise wave data and produce wave rose for paper
%% Setup
% Add required directories (and subdirectories)
addpath(genpath('functions'))
addpath(genpath('inputs'))
% Read input parameters
Config = HurunuiAnalysisConfig;
%% Read model wave data
WaveModTS = readtable(fullfile(Config.DataFolder,Config.WaveModelOutput), ...
'HeaderLines',27,...
'ReadVariableNames',false ,...
'Format', '%f%d%d%d%d%d%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f');
WaveModTS.Var2 = datetime([WaveModTS{:,2:6}, zeros(height(WaveModTS),1)]);
WaveModTS(:,[1,3:6,24:25]) = [];
WaveModTS.Properties.VariableNames = {'DateTime', ...
'Hsig', ...
'Tm01', ...
'Tm02', ...
'RTpeak', ...
'Dir', ...
'Dspr', ...
'PkDir', ...
'XWindv', ...
'YWindv', ...
'Ubot', ...
'Urms', ...
'Wlen', ...
'Depth', ...
'XTransp', ...
'YTransp', ...
'XWForce', ...
'YWForce'};
%% Read compiled lagoon TS data
% Read lagoon time series (already processed)
LagoonTS = readtable('outputs\LagoonTS.csv');
LagoonTS.DateTime = datetime(LagoonTS.DateTime);
% Read in daily TS
DailyLagoonTS = readtable('outputs\DailyLagoonTS.csv');
DailyLagoonTS.Date = datetime(DailyLagoonTS.Date,'InputFormat','dd/MM/yyyy');
%% Calculate stats
% mean
fprintf('Mean significant wave height = %1.2f\n', mean(WaveModTS.Hsig))
% mean annual max
WaveModTS.Year = year(WaveModTS.DateTime);
YearList = unique(WaveModTS.Year);
YearList = YearList(2:end-1); %get rid of part years
YearlyMaxHs = NaN(size(YearList));
for ii = 1:size(YearList,1)
YearlyMaxHs(ii) = max(WaveModTS.Hsig(WaveModTS.Year==YearList(ii)));
end
fprintf('Mean annual maximum Hs = %1.2f\n\n', mean(YearlyMaxHs))
% Compare runup formulas
fprintf('No of days overtopping predicted:\n')
fprintf(' Stockdon et al = %i/%i=%.1f%%\n', ...
sum(DailyLagoonTS.MaxR_high1>Config.CrestHeight(1)), ...
height(DailyLagoonTS), ...
100*sum(DailyLagoonTS.MaxR_high1>Config.CrestHeight(1))/height(DailyLagoonTS))
fprintf(' Poate et al = %i/%i=%.1f%%\n\n', ...
sum(DailyLagoonTS.MaxR_high2>Config.CrestHeight(1)), ...
height(DailyLagoonTS), ...
100*sum(DailyLagoonTS.MaxR_high2>Config.CrestHeight(1))/height(DailyLagoonTS))
fprintf('No of days overwashing predicted:\n')
fprintf(' Stockdon et al = %i/%i=%.1f%%\n', ...
sum(DailyLagoonTS.MaxR_high1>Config.CrestHeight(1)), ...
height(DailyLagoonTS), ...
100*sum(DailyLagoonTS.MaxR_high1>Config.CrestHeight(1)+0.5)/height(DailyLagoonTS))
fprintf(' Poate et al = %i/%i=%.1f%%\n\n', ...
sum(DailyLagoonTS.MaxR_high2>Config.CrestHeight(1)), ...
height(DailyLagoonTS), ...
100*sum(DailyLagoonTS.MaxR_high2>Config.CrestHeight(1)+0.5)/height(DailyLagoonTS))
%% Produce plot for paper
figure
wind_rose(WaveModTS.Dir, WaveModTS.Hsig, ...
'di',0:5, ...
'dtype', 'meteo', ...
'lablegend', 'H_s (m)', ...
'percbg','none', ...
'quad',0, ...
'compass',false, ...
'bgcolor','none', ...
'cmap',parula, ...
'lwidth',0.1, ...
'lstyle','none', ...
'ci', 0, ...
'n', 72)
hold on
plot([0.37,12.5]*sind(Config.ShoreNormalDir), ...
[0.37,12.5]*cosd(Config.ShoreNormalDir), ...
'k-', 'LineWidth', 4)
export_fig 'outputs\ModelWaveRose.png' -transparent -m 5