-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTidalRange.m
More file actions
40 lines (32 loc) · 959 Bytes
/
TidalRange.m
File metadata and controls
40 lines (32 loc) · 959 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
%% Calc basic tidal stats
% Add required directories (and subdirectories)
addpath(genpath('functions'))
% Read lagoon time series (already processed)
LagoonTS = readtable('outputs\LagoonTS.csv');
LagoonTS.DateTime = datetime(LagoonTS.DateTime);
% Calculate tidal peaks and troughs
[HWTimes,HWLevels] = tidePeaks(LagoonTS.DateTime,LagoonTS.SeaLevel);
[LWTimes,LWLevels] = tidePeaks(LagoonTS.DateTime,-LagoonTS.SeaLevel);
LWLevels = -LWLevels;
% For simplicity make them the same length
MinLength = min(size(HWLevels,1),size(LWLevels,1));
HWTimes = HWTimes(1:MinLength);
HWLevels = HWLevels(1:MinLength);
LWTimes = LWTimes(1:MinLength);
LWLevels = LWLevels(1:MinLength);
clear MinLength
% Range
TideRange = HWLevels-LWLevels;
% Check
figure
plot(HWTimes,HWLevels)
hold on
plot(LWTimes,LWLevels)
% Summarise
MHW = mean(HWLevels)
MLW = mean(LWLevels)
MeanRange = MHW - MLW
MeanRange2 = mean(TideRange)
% Plot range distribution
figure
histogram(TideRange)