Matlab code for MLLW calculation

Material Information

Title:
Matlab code for MLLW calculation
Physical Description:
.m file
Creator:
Li, Jin

Notes

Abstract:
The process of relating the measured sea level in Great Inagua and San Salvador to the tidal datum MLLW, using Matlab code.
Acquisition:
Collected for University of Florida's Institutional Repository by the UFIR Self-Submittal tool. Submitted by Jin Li.

Record Information

Source Institution:
University of Florida Institutional Repository
Holding Location:
University of Florida
Rights Management:
All rights reserved by the submitter.
System ID:
IR00003774:00001


This item is only available as the following downloads:


Full Text
Correlate LIG deposition features in the Bahamas to local MLLW
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outine:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}
html { min-height:100%; margin-bottom:1px; }
html body { height:100%; margin:0px; font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#000; line-height:140%; background:#fff none; overflow-y:scroll; }
html body td { vertical-align:top; text-align:left; }
h1 { padding:0px; margin:0px 0px 25px; font-family:Arial, Helvetica, sans-serif; font-size:1.5em; color:#d55000; line-height:100%; font-weight:normal; }
h2 { padding:0px; margin:0px 0px 8px; font-family:Arial, Helvetica, sans-serif; font-size:1.2em; color:#000; font-weight:bold; line-height:140%; border-bottom:1px solid #d6d4d4; display:block; }
h3 { padding:0px; margin:0px 0px 5px; font-family:Arial, Helvetica, sans-serif; font-size:1.1em; color:#000; font-weight:bold; line-height:140%; }
a { color:#005fce; text-decoration:none; }
a:hover { color:#005fce; text-decoration:underline; }
a:visited { color:#004aa0; text-decoration:none; }
p { padding:0px; margin:0px 0px 20px; }
img { padding:0px; margin:0px 0px 20px; border:none; }
p img, pre img, tt img, li img { margin-bottom:0px; }
ul { padding:0px; margin:0px 0px 20px 23px; list-style:square; }
ul li { padding:0px; margin:0px 0px 7px 0px; }
ul li ul { padding:5px 0px 0px; margin:0px 0px 7px 23px; }
ul li ol li { list-style:decimal; }
ol { padding:0px; margin:0px 0px 20px 0px; list-style:decimal; }
ol li { padding:0px; margin:0px 0px 7px 23px; list-style-type:decimal; }
ol li ol { padding:5px 0px 0px; margin:0px 0px 7px 0px; }
ol li ol li { list-style-type:lower-alpha; }
ol li ul { padding-top:7px; }
ol li ul li { list-style:square; }
.content { font-size:1.2em; line-height:140%; padding: 20px; }
pre, tt, code { font-size:12px; }
pre { margin:0px 0px 20px; }
pre.error { color:red; }
pre.codeinput { padding:10px; border:1px solid #d3d3d3; background:#f7f7f7; }
pre.codeoutput { padding:10px 11px; margin:0px 0px 20px; color:#4c4c4c; }
@media print { pre.codeinput, pre.codeoutput { word-wrap:break-word; width:100%; } }
span.keyword { color:#0000FF }
span.comment { color:#228B22 }
span.string { color:#A020F0 }
span.untermstring { color:#B20000 }
span.syscmd { color:#B28C00 }
.footer { width:auto; padding:10px 0px; margin:25px 0px 0px; border-top:1px dotted #878787; font-size:0.8em; line-height:140%; font-style:italic; color:#878787; text-align:left; float:none; }
.footer p { margin:0px; }
.footer a { color:#878787; }
.footer a:hover { color:#878787; text-decoration:underline; }
.footer a:visited { color:#878787; }
table th { padding:7px 5px; text-align:left; vertical-align:middle; border: 1px solid #d6d4d4; font-weight:bold; }
table td { padding:7px 5px; text-align:left; vertical-align:top; border:1px solid #d6d4d4; }
Correlate LIG deposition features in the Bahamas to local MLLWJin Li 11/14/2013-12/3/2013ContentsCalculate MLLW in Settlement Point (SP)Parameter(s) preparationSPVAVirginia Key record datacalculate MLLW at SP with the methodCalculate nontidal influence in San Salvador and Great InaguaRound the time in NOAA date to "integer time" for comparison with Hawaii dataPick out H/L water level observation data (Hawaii data)Calculate weather influence for high tide and low tideCalculate elevation of LIG deposition relative to MLLWLoad NOAA prediction for GI and SSRelate the reference to MLLWIn San Salvador, elevation reference is the local water level at 10:04 pm, April 2, 2013ResultsCalculate MLLW in Settlement Point (SP)Interpolate Import data SPfileID = fopen('SP_Mar_2013.txt');
SP = textscan(fileID,'%s %s %f','headerlines',1);
fclose(fileID);
d_SP=SP{1,1};
t_SP =SP{1,2};
wl_SP=SP{1,3};
dt_SP = datenum(d_SP,'mm/dd/yyyy')+ datenum(t_SP,'HH:MM')-datenum('00:00','HH:MM');
% Virginia Key, Florida (VA)
fileID = fopen('VA_Mar_2013.txt');
VA = textscan(fileID,'%s %s %f', 'headerlines', 1);
fclose(fileID);
d_VA = VA{1,1}; t_VA = VA{1,2}; w_VA = VA{1,3};
dt_VA = datenum(d_VA,'yyyy/mm/dd')+datenum(t_VA,'HH:MM')-datenum('00:00','HH:MM');
% Piecewise cubic spline interpolation
w_SP = spline(dt_SP, wl_SP, dt_VA);
Parameter(s) preparationSPmonthly mean higher high water (MMHHW) at Settlement Point (SP)for i=1:31
mhh_SP(i) = max(w_SP((1+(i-1)*240):(i*240), 1));
end
mmhhw_SP = mean(mhh_SP);
% monthly mean lower low water (MMLLW) at SP
for i =1:31
mll_SP(i) = min(w_SP((1+(i-1)*240):(i*240), 1));
end
mmllw_SP = mean(mll_SP);
% monthly mean range at SP
mmr_SP = mmhhw_SP-mmllw_SP;
% monthly mean tide level at SP
mmtl_SP =(mmhhw_SP+mmllw_SP)/2;
VAmonthly mean higher high water (MMHHW) at Virginia Keyfor i=1:31
mhh_VA(i) = max(w_VA((1+(i-1)*240):(i*240), 1));
end
mmhhw_VA = mean(mhh_VA);
% monthly mean lower low water (MMLLW) at VA
for i =1:31
mll_VA(i) = min(w_VA((1+(i-1)*240):(i*240), 1));
end
mmllw_VA = mean(mll_VA);
mmr_VA = mmhhw_VA mmllw_VA; % monthly mean range at VA
mmtl_VA = (mmhhw_VA + mmllw_VA)/2;% monthly mean tide level at VA
Virginia Key record datamhhw_VA =3.763; %mean higher high water (m) w.r.t. the station @ Virginia Key
mllw_VA =3.096; %mean lower low water (m) w.r.t. the station @ Virginia Key
mr_VA = mhhw_VA mllw_VA; % mean tide range (m) @ VA
mtl_VA = (mhhw_VA + mllw_VA)/2;
% MTL (m) (1983-2001 Mean tide level @ VA) = Average of MHHW and MLLW
calculate MLLW at SP with the methodprovided by website: http://web.vims.edu/physical/research/TCTutorial/tidaldatum.htmrr = mmr_SP/mmr_VA % range ratio between SP and VA
mr_SP = rr*mr_VA % mean range (m) @ SP
mtl_SP = mtl_VA mmtl_VA + mmtl_SP % mean tide range @ SP
mllw_SP = mtl_SP 0.5*mr_SP % mean lower low water @ SP
Calculate nontidal influence in San Salvador and Great InaguafileID = fopen('Hawaii.txt');
H = textscan(fileID,'%s %s %f','headerlines',2);
fclose(fileID);
date_H=H{1,1};
time_H =H{1,2};
wl_H=H{1,3};
dt_H = datenum(date_H,'yyyy/mm/dd') + datenum(time_H, 'HH:MM') datenum('00:00','HH:MM');
datestr(dt_H);
% Load NOAA prediction data
fileID = fopen('NOAA.txt');
N = textscan(fileID,'%s %s %s %f %s','headerlines',2);
fclose(fileID);
date_N=N{1,1};
day_N =N{1,2};
time_N=N{1,3};
wl_N =N{1,4};
tide=N{1,5};
dt_N = datenum(date_N,'yyyy/mm/dd') + datenum(time_N, 'HH:MM') datenum('00:00','HH:MM');
datestr(dt_N);
Round the time in NOAA date to "integer time" for comparison with Hawaii data[y,m,d,h,mn,s]=datevec(dt_N);
for i=1:length(dt_N)
if mn(i,1)>=30
h(i,1)=h(i,1)+1; mn(i,1)=0;
else
mn(i,1)=0;
end
end
dt_N=datenum(y,m,d,h,mn,s);
% !!!make the time exactly the same between Hawaii and NOAA!!!
[y,m,d,h,mn,s]=datevec(dt_H);
for i=1:length(dt_H)
mn(i,1)=0;
s(i,1)=0;
end
dt_H=datenum(y,m,d,h,mn,s);
Pick out H/L water level observation data (Hawaii data)for k=1:length(dt_N)
for j=1:length(dt_H)
if dt_N(k,1)==dt_H(j,1)
wl(k,1) = wl_H(j,1);
break
else
wl(k,1) = NaN;
end
end
end
Calculate weather influence for high tide and low tidewl=wl-0.629; % observation with respect to MLLW (0.629, calculated from MatLab before)
diff = wl_N-wl; % difference between prediction and observation of sea level
lsumM=0; hsumM=0; % low tide sum; high tide sum; in prepare to calculate average difference for low and high tide
for i=1:120 % March
if mod(i,2)==0
lsumM =lsumM + diff(i,1);
else hsumM = hsumM + diff(i,1);
end
end
ldiffM=lsumM/60; hdiffM=hsumM/60;
diffM = (lsumM+hsumM)/120;
str1 = sprintf('In March, the total weather influence on water level (m) is %f', diffM);
disp(str1);
str2 =sprintf('In March, the weather influence on high water level (m) is %f', hdiffM);
disp(str2);
str3 = sprintf('In March, the weather influence on low water level (m) is %f', ldiffM);
disp(str3);
lsumA=0; hsumA =0; % April
for j=121:236
if mod(j,2)==0
lsumA=lsumA +diff(j,1);
else hsumA = hsumA +diff(j,1);
end
end
ldiffA=lsumA/58; hdiffA=hsumA/58;diffA = (lsumA+hsumA)/116;
str4 = sprintf('In April, the total weather influence on water level (m) is %f', diffA);
disp(str4);
str5 =sprintf('In April, the weather influence on high water level (m) is %f', hdiffA);
disp(str5);
str6 = sprintf('In April, the weather influence on low water level (m) is %f', ldiffA);
disp(str6);
Calculate elevation of LIG deposition relative to MLLWclear all, close all
Load NOAA prediction for GI and SSfileID = fopen('GI_pred.txt');
GI = textscan(fileID,'%s %s %f %s','headerlines',20);
fclose(fileID);
date_GI=GI{1,1};
time_GI = GI{1,2};
pred_GI=GI{1,3};
tide_GI=GI{1,4};
dt_GI = datenum(date_GI,'yyyy/mm/dd') + datenum(time_GI, 'HH:MM') datenum('00:00','HH:MM');
% San Salvador
fileID = fopen('SS_pred.txt');
SS = textscan(fileID,'%s %s %f %s','headerlines',19);
fclose(fileID);
date_SS=SS{1,1};
time_SS = SS{1,2};
pred_SS=SS{1,3};
tide_SS=SS{1,4};
dt_SS = datenum(date_SS,'yyyy/mm/dd') + datenum(time_SS, 'HH:MM') datenum('00:00','HH:MM');
Relate the reference to MLLWIn Great Inagua, reference is the conch shell that can be reoccupiedldiffM=-0.237067; hdiffM=0.099483;% correction results (m) March and April
ldiffA=-0.238224; hdiffA=0.084345;
h1= pred_GI(103,1)-hdiffM*0.79; %Mar-27-2013 12:42 High with respect to MLLW
l1=pred_GI(104,1)-ldiffM*1.11; %Mar-27-2013 19:09 Low with respect to MLLW
h2=pred_GI(107,1)-hdiffM*0.79; %Mar-28-2013 12:42 High with respect to MLLW
l2=pred_GI(108,1)-ldiffM*1.11; %Mar-28-2013 12:42 Low with respect to MLLW
r1=-0.05; r2 = -0.758; r3= -0.085; r4 = -0.841; % elevation with respect to the reference (reloactable conch shell) in GI
sum=(h1-r1)+(l1-r2)+(h2-r3)+(l2-r4);
R_GI=sum/4; %elevation of reference w.r.t. local MLLW in Great Inagua
In San Salvador, elevation reference is the local water level at 10:04 pm, April 2, 2013for i=1:10
if strcmp('H',tide_SS(i))==1
obs(i,1)=pred_SS(i,1)-0.86*hdiffA;
else
obs(i,1)=pred_SS(i,1)-1.11*ldiffA;
end
end
% Comparison of "supposed observation" with measured sea level
fileID = fopen('SS_CTD.txt');
CTD = textscan(fileID,'%s %s %f','headerlines',2);
fclose(fileID);
ctd=CTD{1,3};
for i=1:10
ctdobs(i,1)=ctd(i,1)-obs(i,1);
end
mean_diff=mean(ctdobs); % mean difference between measured sea level and supposed Observation
wl_1=(0.381+0.335)/2; % Water level (m) recorded by the water depth recorder at 10:04 am, April. 2, 2013
R_SS=wl_1-mean_diff; % elevation of reference w.r.t. MLLW in San Salvador
Resultsstr1 = sprintf('Reference on Great Inagua is %f (m) above local MLLW', R_GI);
disp(str1);
str2 = sprintf('Reference on San Salvador is %f (m)above local MLLW', R_SS);
disp(str2);
Published with MATLAB® R2012b
=30
h(i,1)=h(i,1)+1; mn(i,1)=0;
else
mn(i,1)=0;
end
end
dt_N=datenum(y,m,d,h,mn,s);
% !!!make the time exactly the same between Hawaii and NOAA!!!
[y,m,d,h,mn,s]=datevec(dt_H);
for i=1:length(dt_H)
mn(i,1)=0;
s(i,1)=0;
end
dt_H=datenum(y,m,d,h,mn,s);
%% Pick out H/L water level observation data (Hawaii data)
for k=1:length(dt_N)
for j=1:length(dt_H)
if dt_N(k,1)==dt_H(j,1)
wl(k,1) = wl_H(j,1);
break
else
wl(k,1) = NaN;
end
end
end
%% Calculate weather influence for high tide and low tide
wl=wl-0.629; % observation with respect to MLLW (0.629, calculated from MatLab before)
diff = wl_N-wl; % difference between prediction and observation of sea level
%%
lsumM=0; hsumM=0; % low tide sum; high tide sum; in prepare to calculate average difference for low and high tide
for i=1:120 % March
if mod(i,2)==0
lsumM =lsumM + diff(i,1);
else hsumM = hsumM + diff(i,1);
end
end
ldiffM=lsumM/60; hdiffM=hsumM/60;
diffM = (lsumM+hsumM)/120;
str1 = sprintf('In March, the total weather influence on water level (m) is %f', diffM);
disp(str1);
str2 =sprintf('In March, the weather influence on high water level (m) is %f', hdiffM);
disp(str2);
str3 = sprintf('In March, the weather influence on low water level (m) is %f', ldiffM);
disp(str3);
lsumA=0; hsumA =0; % April
for j=121:236
if mod(j,2)==0
lsumA=lsumA +diff(j,1);
else hsumA = hsumA +diff(j,1);
end
end
ldiffA=lsumA/58; hdiffA=hsumA/58;diffA = (lsumA+hsumA)/116;
str4 = sprintf('In April, the total weather influence on water level (m) is %f', diffA);
disp(str4);
str5 =sprintf('In April, the weather influence on high water level (m) is %f', hdiffA);
disp(str5);
str6 = sprintf('In April, the weather influence on low water level (m) is %f', ldiffA);
disp(str6);
%% Calculate elevation of LIG deposition relative to MLLW
clear all, close all
%% Load NOAA prediction for GI and SS
fileID = fopen('GI_pred.txt');
GI = textscan(fileID,'%s %s %f %s','headerlines',20);
fclose(fileID);
date_GI=GI{1,1};
time_GI = GI{1,2};
pred_GI=GI{1,3};
tide_GI=GI{1,4};
dt_GI = datenum(date_GI,'yyyy/mm/dd') + datenum(time_GI, 'HH:MM') datenum('00:00','HH:MM');
% San Salvador
fileID = fopen('SS_pred.txt');
SS = textscan(fileID,'%s %s %f %s','headerlines',19);
fclose(fileID);
date_SS=SS{1,1};
time_SS = SS{1,2};
pred_SS=SS{1,3};
tide_SS=SS{1,4};
dt_SS = datenum(date_SS,'yyyy/mm/dd') + datenum(time_SS, 'HH:MM') datenum('00:00','HH:MM');
%% Relate the reference to MLLW
% In Great Inagua, reference is the conch shell that can be reoccupied
ldiffM=-0.237067; hdiffM=0.099483;% correction results (m) March and April
ldiffA=-0.238224; hdiffA=0.084345;
h1= pred_GI(103,1)-hdiffM*0.79; %Mar-27-2013 12:42 High with respect to MLLW
l1=pred_GI(104,1)-ldiffM*1.11; %Mar-27-2013 19:09 Low with respect to MLLW
h2=pred_GI(107,1)-hdiffM*0.79; %Mar-28-2013 12:42 High with respect to MLLW
l2=pred_GI(108,1)-ldiffM*1.11; %Mar-28-2013 12:42 Low with respect to MLLW
r1=-0.05; r2 = -0.758; r3= -0.085; r4 = -0.841; % elevation with respect to the reference (reloactable conch shell) in GI
sum=(h1-r1)+(l1-r2)+(h2-r3)+(l2-r4);
R_GI=sum/4; %elevation of reference w.r.t. local MLLW in Great Inagua
%% In San Salvador, elevation reference is the local water level at 10:04 pm, April 2, 2013
for i=1:10
if strcmp('H',tide_SS(i))==1
obs(i,1)=pred_SS(i,1)-0.86*hdiffA;
else
obs(i,1)=pred_SS(i,1)-1.11*ldiffA;
end
end
% Comparison of "supposed observation" with measured sea level
fileID = fopen('SS_CTD.txt');
CTD = textscan(fileID,'%s %s %f','headerlines',2);
fclose(fileID);
ctd=CTD{1,3};
for i=1:10
ctdobs(i,1)=ctd(i,1)-obs(i,1);
end
mean_diff=mean(ctdobs); % mean difference between measured sea level and supposed Observation
wl_1=(0.381+0.335)/2; % Water level (m) recorded by the water depth recorder at 10:04 am, April. 2, 2013
R_SS=wl_1-mean_diff; % elevation of reference w.r.t. MLLW in San Salvador
%% Results
str1 = sprintf('Reference on Great Inagua is %f (m) above local MLLW', R_GI);
disp(str1);
str2 = sprintf('Reference on San Salvador is %f (m)above local MLLW', R_SS);
disp(str2);
##### SOURCE END #####
--/body/html