May 31 code update

This commit is contained in:
Coastlines 2022-05-31 09:41:25 -04:00
parent 5dc6152e35
commit 5550b4ef71
5 changed files with 762 additions and 732 deletions

View File

@ -1719,6 +1719,10 @@ try
end
%% Import Model forecast
% modelWaterHist = qpread(qpfopen('D:\DUNEX_RT\Archive\2022-01-31_12_histOut7.dat'),1,'water level','data',0,0);
% modelCurHist = qpread(qpfopen('D:\DUNEX_RT\Archive\2022-01-31_12_histOut7.dat'),1,'depth averaged velocity','data',0,0);
modelWaterHist = qpread(qpfopen('trih-rt_run.dat'),1,'water level','data',0,0);
modelCurHist = qpread(qpfopen('trih-rt_run.dat'),1,'depth averaged velocity','data',0,0);
@ -1817,8 +1821,9 @@ try
end
%% Validate Import Hohonu
hohonuBase = 'https://dashboard.hohonu.io/api/stations/node-';
options = weboptions;
options.Timeout = 90;
hohonuStation(5:10) = [
10015; %Duck, Dare County, NC
@ -1840,10 +1845,15 @@ try
for Stat = 5:10
fname = ['D:\DUNEX_RT\Operation\Hohonu\' num2str(hohonuStation(Stat)) '.json'];
try
% websave(fname,...
% [hohonuBase num2str(hohonuStation(Stat)) '/statistic/?cleaned=false&format=json&from='...
% datestr(dateStartM,'yyyy-mm-dd') '+00%3A00&to=' datestr(dateEndM,'yyyy-mm-dd')...
% '+23%3A59']);
websave(fname,...
[hohonuBase num2str(hohonuStation(Stat)) '/statistic/?cleaned=true&format=json&from='...
datestr(dateStartM,'yyyy-mm-dd') '+00%3A00&to=' datestr(dateEndM,'yyyy-mm-dd')...
'+23%3A59']);
[hohonuBase num2str(hohonuStation(Stat)) '/statistic/?datum=NAVD&from='...
datestr(dateStartM,'yyyy-mm-dd') '%' datestr(dateStartM,'HHMM:SS') '&to='...
datestr(dateEndM,'yyyy-mm-dd') '%' datestr(dateEndM,'HHMM:SS')...
'&cleaned=false&format=json&station_type=Hohonu&tz=000000'], options);
fid = fopen(fname);
raw = fread(fid,inf);
@ -1853,12 +1863,31 @@ try
hohonuIN = jsondecode(str);
% Filter out data more than 1 standard deviation
hmean = mean((hohonuDatums(Stat) - hohonuIN.data{2}) * 0.001);
hstd = std((hohonuDatums(Stat) - hohonuIN.data{2}) * 0.001);
hohonuFilt = abs((hohonuDatums(Stat) - hohonuIN.data{2}) * 0.001)>(abs(hmean)+hstd);
% hmean = mean((hohonuDatums(Stat) - hohonuIN.data{2}) * 0.001);
% hstd = std((hohonuDatums(Stat) - hohonuIN.data{2}) * 0.001);
% hohonuFilt = abs((hohonuDatums(Stat) - hohonuIN.data{2}) * 0.001)>(abs(hmean)+hstd*1.5);
hmean = mean(hohonuIN.data{2} * 0.3048, 'omitnan');
hstd = std(hohonuIN.data{2} * 0.3048, 'omitnan');
% Standard deviation filter- greater than 1.5x the standard
% deviation
hohonuFilt1 = abs((hohonuIN.data{2} * 0.3048))>(abs(hmean)+hstd*1.5);
% Sharp jump filter- if a jump is greater than 10x the average
% jump
hohonuFilt2 = [0;abs(diff(hohonuIN.data{2} * 0.3048))>...
(mean(diff(hohonuIN.data{2} * 0.3048),'omitnan')*10)];
statWL(:,Stat) = interp1(datetime(hohonuIN.data{1}(~hohonuFilt),'InputFormat','yyyy-MM-dd''T''HH:mm:SS'),...
(hohonuDatums(Stat) - hohonuIN.data{2}(~hohonuFilt)) * 0.001,dateStartM:minutes(15):dateEndM);
dateStartMtz = datetime(dateStartM,'TimeZone','UTC');
dateEndMtz = datetime(dateEndM,'TimeZone','UTC');
% statWL(:,Stat) = interp1(...
% datetime(hohonuIN.data{1}(~hohonuFilt),'InputFormat','yyyy-MM-dd''T''HH:mm:SSZ','TimeZone','UTC'),...
% (hohonuDatums(Stat) - hohonuIN.data{2}(~hohonuFilt)) * 0.001,dateStartMtz:minutes(15):dateEndMtz);
statWL(:,Stat) = interp1(...
datetime(hohonuIN.data{1}(~hohonuFilt1 & hohonuFilt2),'InputFormat','yyyy-MM-dd''T''HH:mm:SSZ','TimeZone','UTC'),...
hohonuIN.data{2}(~hohonuFilt1 & hohonuFilt2) * 0.3048,dateStartMtz:minutes(15):dateEndMtz);
catch err
%open file
fid = fopen('errorFile.log','a+');
@ -1887,7 +1916,7 @@ try
% curVal = ncread(url,'currentSpeed');
try
if day(masterTime)<2
websave('statCNC.nc',['https://chlthredds.erdc.dren.mil/thredds/fileServer/frf/oceanography/currents/awac-11m/' datestr(masterTime-day(3),'YYYY') '/FRF-ocean_currents_awac-11m_' ...
websave('statCNC.nc',['https://chlthredds.erdc.dren.mil/thredds/fileServer/frf/oceanography/currents/awac-11m/' datestr(masterTime-days(3),'YYYY') '/FRF-ocean_currents_awac-11m_' ...
datestr(masterTime-days(3),'YYYYmm') '.nc'],options);
curTime = ncread('statCNC.nc','time');
curVal = ncread('statCNC.nc','currentSpeed');
@ -1913,7 +1942,7 @@ try
% write the error to file
% first line: message
fprintf(fid,'Line %d on %s : %s\n',err.stack.line,datestr(masterTime),err.message);
sendmail('alexander.rey@queensu.ca',['Ext-DUNEX-RT: ' datestr(masterTime) err.message]) ;
% sendmail('alexander.rey@queensu.ca',['Ext-DUNEX-RT: ' datestr(masterTime) err.message]) ;
% close file
fclose(fid)

3
MATLAB start.txt Normal file
View File

@ -0,0 +1,3 @@
runas /noprofile /user:APP_SCI\svc_geoserver "C:\Program Files\MATLAB\R2020b\bin\matlab.exe -c D:\DUNEX_RT\license.lic"
qoWzt03gGnN2

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -13,10 +13,10 @@ Commnt = no. dry points: 1068
Fildry = #NCShoreALLSquare2_100.dry#
Commnt = no. thin dams: 0
Commnt =
Itdate = #2021-09-29#
Itdate = #2022-05-31#
Tunit = #M#
Tstart = 3.6000000e+02
Tstop = 3.2400000e+03
Tstart = 0.0000000e+00
Tstop = 2.8800000e+03
Dt = 0.25
Tzone = 0
Commnt =
@ -93,9 +93,9 @@ PHhydr = #YYYYYY#
PHderv = #YYY#
PHproc = #YYYYYYYYYY#
PHflux = #YYYY#
Flmap = 3.6000000e+02 60 3.2400000e+03
Flhis = 3.6000000e+02 10 3.2400000e+03
Flpp = 3.6000000e+02 60 3.2400000e+03
Flmap = 0.0000000e+00 60 2.8800000e+03
Flhis = 0.0000000e+00 10 2.8800000e+03
Flpp = 0.0000000e+00 60 2.8800000e+03
Flrst = 60
Commnt =
Online = #N#