update to remove example material and improve file calling
parent
cbc72a4da4
commit
9d914ccf1c
@ -0,0 +1,10 @@
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*~
|
||||
*.ini
|
||||
*.py#
|
||||
*.#*
|
||||
*._*
|
||||
.DS_Store
|
||||
*.ipynb_checkpoints/
|
@ -1,3 +1,19 @@
|
||||
# sbeach_toolbox
|
||||
|
||||
Toolbox to assist in the use of the model SBEACH.
|
||||
|
||||
Note this code is specifically written to align with (and borrows code from) the XBeach matlab toolbox so as to make the use of both models streamlined.
|
||||
|
||||
Written by Joshua Simmons
|
||||
|
||||
## Main code
|
||||
* `RUN_sbeach_model.m`: this is an example function to call and use the SBEACH toolbox. It provides and
|
||||
|
||||
* `SBEACH_GLUE_setup.m` - REMOVE
|
||||
* `SBEACH_storm_setup.m` - REMOVE
|
||||
|
||||
## Functions
|
||||
|
||||
* `fsbeach_setupmodel`: used to construct the data files and config file needed for SBEACH to run in the folder specified
|
||||
|
||||
## Example
|
||||
|
Binary file not shown.
Binary file not shown.
@ -1,44 +0,0 @@
|
||||
% Written by Joshua Simmons 04/01/2016
|
||||
% Description: used to tranform offshore to nearshore mike21 using the code
|
||||
% OS2NS_MIKE21.m
|
||||
|
||||
clear
|
||||
clc
|
||||
|
||||
%% Settings
|
||||
%tide gauge data
|
||||
guagedataloc = 'J:\Coastal\Data\Tide\Sydney\Processed\SydTideData.mat';
|
||||
|
||||
site = 'Narrabeen'; %embayment of interest
|
||||
|
||||
%storm details
|
||||
stormdatesloc = 'D:\7 Erosion Models\a_nb_model_comparison\input_data\fielddata\stormdates_narra.mat';
|
||||
storm = {'2007', '2011', '2014', '2015'};
|
||||
|
||||
% save?
|
||||
savebool = 1;
|
||||
% datasave location
|
||||
saveloc = 'D:\7 Erosion Models\a_nb_model_comparison\input_data\fielddata\tide\processed\';
|
||||
|
||||
%% Code
|
||||
%load buoy data,profile data and lookup table
|
||||
guagedata = load(guagedataloc);
|
||||
|
||||
stormdates = load(stormdatesloc);
|
||||
|
||||
% narrow down to date range
|
||||
for ii = 1:length(storm)
|
||||
startdate = stormdates.(['storm_' storm{ii}]).startdate;
|
||||
enddate = stormdates.(['storm_' storm{ii}]).enddate;
|
||||
|
||||
validentries = find(guagedata.SydTideData.time>=startdate & guagedata.SydTideData.time<=enddate);
|
||||
|
||||
tidedata.tide = guagedata.SydTideData.tide(validentries);
|
||||
tidedata.time = guagedata.SydTideData.time(validentries);
|
||||
|
||||
if savebool
|
||||
save([saveloc 'tidedata_' lower(site) '_' storm{ii} '.mat'],'tidedata')
|
||||
end
|
||||
|
||||
clear tidedata startdate enddate validentries
|
||||
end
|
@ -1,44 +0,0 @@
|
||||
% Written by Joshua Simmons 04/01/2016
|
||||
% Description: used to tranform offshore to nearshore mike21 using the code
|
||||
% OS2NS_MIKE21.m
|
||||
|
||||
clear
|
||||
clc
|
||||
|
||||
%% Settings
|
||||
%tide gauge data
|
||||
guagedataloc = 'J:\Coastal\Data\Tide\Sydney\Processed\SydTideData.mat';
|
||||
|
||||
site = 'Monavale'; %embayment of interest
|
||||
|
||||
%storm details
|
||||
stormdatesloc = 'D:\7 Erosion Models\a_nb_model_comparison\input_data\fielddata\stormdates_other.mat';
|
||||
storm = {'2014', '2015'};
|
||||
|
||||
% save?
|
||||
savebool = 1;
|
||||
% datasave location
|
||||
saveloc = 'D:\7 Erosion Models\a_nb_model_comparison\input_data\fielddata\tide\processed\';
|
||||
|
||||
%% Code
|
||||
%load buoy data,profile data and lookup table
|
||||
guagedata = load(guagedataloc);
|
||||
|
||||
stormdates = load(stormdatesloc);
|
||||
|
||||
% narrow down to date range
|
||||
for ii = 1:length(storm)
|
||||
startdate = stormdates.(['storm_' storm{ii}]).startdate;
|
||||
enddate = stormdates.(['storm_' storm{ii}]).enddate;
|
||||
|
||||
validentries = find(guagedata.SydTideData.time>=startdate & guagedata.SydTideData.time<=enddate);
|
||||
|
||||
tidedata.tide = guagedata.SydTideData.tide(validentries);
|
||||
tidedata.time = guagedata.SydTideData.time(validentries);
|
||||
|
||||
if savebool
|
||||
save([saveloc 'tidedata_' lower(site) '_' storm{ii} '.mat'],'tidedata')
|
||||
end
|
||||
|
||||
clear tidedata startdate enddate validentries
|
||||
end
|
Binary file not shown.
@ -1,105 +0,0 @@
|
||||
function nswaves = fmikeos2ns(oswaves, LookUps, site, contour, location)
|
||||
% Written by Joshua Simmons (WRL) 03/11/2014
|
||||
% to transform waves from offshore (OS) to nearshore (NS) using MIKE21 model
|
||||
% oswaves - OS wave data - oswaves.Hsig(Significant wave height)/
|
||||
% oswaves.Tp1(Peak period)/oswaves.Wdir(Incident wave direction)
|
||||
% LookUps - MIKE21 wave model output in file "OEH_ARC_PointOutput.mat"
|
||||
% site - embayment of interest - i.e. 'Narrabeen'
|
||||
% contour - 10 or 15 (m) contour for NS output
|
||||
% location - either pure S co-ord (see Mitchell Harley's xyz2spz
|
||||
% transformation) or location.E and location.N - refers to output
|
||||
% location for NS waves (gets nearest MIKE21 point)
|
||||
%
|
||||
%V1.1 - updated by Joshua Simmons 21/01/2015 to patch Wamberal/Wanda
|
||||
%error.
|
||||
|
||||
%find site and contour indices
|
||||
siteidx = getnameidx(LookUps(:,2), site);
|
||||
|
||||
%apply fix for Wamberal and Wanda
|
||||
% from TM on 21/01/2015: "I've found an error in the .mat file for the
|
||||
% look-up tables; in the pdf I say that all output for all locations runs
|
||||
% north to south - for Wamberal and Wanda it seems I've output them south to north.
|
||||
% So if you are using output from these two sites, if you haven't realised already,
|
||||
% alongshore gradients will look inverted."
|
||||
for aa = 1:2;
|
||||
LookUps{6,1}{aa,1} = flipud(LookUps{6,1}{aa,1}); LookUps{6,1}{aa,1}(:,1) = flipud(LookUps{6,1}{aa,1}(:,1));
|
||||
LookUps{7,1}{aa,1} = flipud(LookUps{7,1}{aa,1}); LookUps{7,1}{aa,1}(:,1) = flipud(LookUps{7,1}{aa,1}(:,1));
|
||||
end
|
||||
|
||||
if contour == 10
|
||||
contouridx = 1;
|
||||
elseif contour == 15;
|
||||
contouridx = 2;
|
||||
else
|
||||
error('Contour information not available, select either 10 or 15m contour')
|
||||
end
|
||||
|
||||
%extract scenarios for easy lookup
|
||||
scenariosidx = getnameidx(LookUps(:,2), 'Offshore Wave Scenarios');
|
||||
scenarios = LookUps{scenariosidx,1};
|
||||
|
||||
%get nearest location available for output
|
||||
Eouts = LookUps{siteidx,1}{contouridx,1}(:,2);
|
||||
Nouts = LookUps{siteidx,1}{contouridx,1}(:,3);
|
||||
|
||||
if strcmp(site,'Narrabeen')
|
||||
%compares closes alongshore spacing (s) for log-spiral narrabeen
|
||||
xyz_data.x = cell2mat(Eouts);
|
||||
xyz_data.y = cell2mat(Nouts);
|
||||
xyz_data.z = zeros(size(Eouts));
|
||||
spz = xyz2spz(xyz_data,'NARRA');
|
||||
[~,locationidx] = min(abs(location-spz.s));
|
||||
else
|
||||
%gets nearest output point
|
||||
dists = sqrt((location.E-cell2mat(Eouts)).^2+(location.N-cell2mat(Nouts)).^2);
|
||||
[~,locationidx] = min(abs(dists));
|
||||
end
|
||||
|
||||
fcount = 1;
|
||||
%loop through oswaves and lookup nswaves
|
||||
for ii = 1:length(oswaves.Hsig)
|
||||
tmpHs = oswaves.Hsig(ii);
|
||||
tmpTp = oswaves.Tp1(ii);
|
||||
tmpWdir = oswaves.Wdir(ii);
|
||||
|
||||
%find closest scenario match
|
||||
[~,Hsidx] = min(abs(tmpHs-scenarios(:,1)));
|
||||
tmpHsround = scenarios(Hsidx,1);
|
||||
[~,Tpidx] = min(abs(tmpTp-scenarios(:,2)));
|
||||
tmpTpround = scenarios(Tpidx,2);
|
||||
[~,Wdiridx] = min(abs(tmpWdir-scenarios(:,3)));
|
||||
tmpWdirround = scenarios(Wdiridx,3);
|
||||
|
||||
iter1ind = find(scenarios(:,3) == tmpWdirround);
|
||||
iter2ind = find(scenarios(iter1ind,2) == tmpTpround);
|
||||
iter3ind = find(scenarios(iter1ind(iter2ind),1) == tmpHsround);
|
||||
|
||||
iter4ind = iter1ind(iter2ind(iter3ind));
|
||||
|
||||
%now get ns lookup information if available
|
||||
if isempty(iter4ind)
|
||||
%get the closest wave height to scenario chosen
|
||||
[~,iter3ind] = min(abs(tmpHs-scenarios(iter1ind(iter2ind),1)));
|
||||
iter4ind = iter1ind(iter2ind(iter3ind));
|
||||
diffHs = scenarios(iter4ind,1)-tmpHs;
|
||||
disp(['No match found for oswaves(' num2str(ii) ') wave height off by ' num2str(diffHs) 'm']);
|
||||
end
|
||||
|
||||
nstmp = LookUps{siteidx,1}{contouridx,1}{locationidx,4}(iter4ind,:);
|
||||
%store the values from the lookup table
|
||||
nswaves.Hsig(ii,1) = nstmp(1);
|
||||
nswaves.Hmax(ii,1) = nstmp(2);
|
||||
nswaves.Tp1(ii,1) = nstmp(3);
|
||||
nswaves.T01(ii,1) = nstmp(4);
|
||||
nswaves.Wdir(ii,1) = nstmp(5);
|
||||
nswaves.power(ii,1) = nstmp(6);
|
||||
end
|
||||
try
|
||||
nswaves.date = oswaves.date;
|
||||
nswaves.time = oswaves.time;
|
||||
nswaves.datenums = oswaves.datenums;
|
||||
catch
|
||||
nswaves.datenums = oswaves.datenums;
|
||||
end
|
||||
end
|
@ -1,95 +0,0 @@
|
||||
% Written by Joshua Simmons 04/01/2016
|
||||
% Description: used to tranform offshore to nearshore mike21 using the code
|
||||
% OS2NS_MIKE21.m
|
||||
|
||||
clear
|
||||
clc
|
||||
|
||||
%% Settings
|
||||
%buoy data
|
||||
buoydataloc = 'J:\Coastal\Data\Wave\Sydney\Processed\SydneyProcessed_CSIROGapFill.mat';
|
||||
% the non CSIRO filtered data is the only data available after 2014 so fill
|
||||
% from the recent data with gaps.
|
||||
backupbuoydata = 'J:\Coastal\Data\Wave\Sydney\Processed\SydneyProcessed.mat';
|
||||
|
||||
%location of mike21 runcode
|
||||
mike21loc = 'J:\Coastal\Tools\Nearshore Wave Transformations\MIKE21\';
|
||||
%location of MALT
|
||||
maltloc = 'J:\Coastal\Tools\MALT Logspiral Transformation\';
|
||||
%location of profiles for which wave data is required.
|
||||
profiledataloc = [437 850 1750 2606 3420]; % s co-ordinate
|
||||
|
||||
site = 'Narrabeen'; %embayment of interest
|
||||
contour = 10; %m - 10m or 15m contour?
|
||||
|
||||
%storm details
|
||||
stormdatesloc = 'D:\7 Erosion Models\a_nb_model_comparison\input_data\fielddata\stormdates_narra.mat';
|
||||
storm = {'2007', '2011', '2014', '2015'};
|
||||
|
||||
% save?
|
||||
savebool = 1;
|
||||
% datasave location
|
||||
saveloc = 'D:\7 Erosion Models\a_nb_model_comparison\input_data\fielddata\wave\processed\';
|
||||
|
||||
%% Code
|
||||
% for MIKE21 code and MALT
|
||||
addpath(mike21loc);
|
||||
addpath(maltloc);
|
||||
%load buoy data,profile data and lookup table
|
||||
buoydata = load(buoydataloc);
|
||||
backupbuoydata = load(backupbuoydata);
|
||||
load('OEH_ARC_PointOutput.mat');
|
||||
stormdates = load(stormdatesloc);
|
||||
|
||||
% narrow down to date range
|
||||
for ii = 1:length(storm)
|
||||
startdate = stormdates.(['storm_' storm{ii}]).startdate;
|
||||
enddate = stormdates.(['storm_' storm{ii}]).enddate;
|
||||
|
||||
validentries = find(buoydata.dates>=startdate & buoydata.dates<=enddate);
|
||||
% if nothing then revert to backup
|
||||
if isempty(validentries) || validentries(end) == length(buoydata.dates)
|
||||
validentries = find(backupbuoydata.dates>=startdate & backupbuoydata.dates<=enddate);
|
||||
oswaves.Hsig = backupbuoydata.Hsig(validentries);
|
||||
oswaves.Tp1 = backupbuoydata.Tp(validentries);
|
||||
oswaves.Wdir = backupbuoydata.Wdir(validentries);
|
||||
oswaves.datenums = backupbuoydata.dates(validentries);
|
||||
else
|
||||
oswaves.Hsig = buoydata.Hsig(validentries);
|
||||
oswaves.Tp1 = buoydata.Tp(validentries);
|
||||
oswaves.Wdir = buoydata.Wdir(validentries);
|
||||
oswaves.datenums = buoydata.dates(validentries);
|
||||
end
|
||||
|
||||
fns1 = fieldnames(oswaves);
|
||||
for kk = 1:length(fns1)
|
||||
if any(isnan(oswaves.(fns1{kk})))
|
||||
error('NaN values in wave data')
|
||||
end
|
||||
end
|
||||
|
||||
tic
|
||||
parfor jj = 1:length(profiledataloc)
|
||||
location = profiledataloc(jj);
|
||||
nswaves = OS2NS_MIKE21(oswaves, LookUps, site, contour, location);
|
||||
|
||||
% bug fix to ensure no inaccurate wave period estimates
|
||||
nswaves.Tp1 = oswaves.Tp1;
|
||||
|
||||
tmp(jj) = nswaves;
|
||||
end
|
||||
wavedata.ns.data = tmp;
|
||||
toc
|
||||
|
||||
wavedata.os = oswaves;
|
||||
|
||||
wavedata.ns.model = 'MIKE21';
|
||||
wavedata.ns.contour = [num2str(contour) 'm'];
|
||||
wavedata.ns.location = profiledataloc;
|
||||
|
||||
if savebool
|
||||
save([saveloc 'wavedata_' lower(site) '_' storm{ii} '.mat'],'wavedata')
|
||||
end
|
||||
|
||||
clear wavedata oswaves startdate enddate validentries tmp
|
||||
end
|
@ -1,99 +0,0 @@
|
||||
% Written by Joshua Simmons 04/01/2016
|
||||
% Description: used to tranform offshore to nearshore mike21 using the code
|
||||
% OS2NS_MIKE21.m
|
||||
|
||||
clear
|
||||
clc
|
||||
|
||||
%% Settings
|
||||
%buoy data
|
||||
buoydataloc = 'J:\Coastal\Data\Wave\Sydney\Processed\SydneyProcessed_CSIROGapFill.mat';
|
||||
% the non CSIRO filtered data is the only data available after 2014 so fill
|
||||
% from the recent data with gaps.
|
||||
backupbuoydata = 'J:\Coastal\Data\Wave\Sydney\Processed\SydneyProcessed.mat';
|
||||
|
||||
%location of mike21 runcode
|
||||
mike21loc = 'J:\Coastal\Tools\Nearshore Wave Transformations\MIKE21\';
|
||||
%location of MALT
|
||||
maltloc = 'J:\Coastal\Tools\MALT Logspiral Transformation\';
|
||||
%location of profiles for which wave data is required.
|
||||
% profiledataloc = [6275797.660794820 6275692.739810870 6275536.815570840]; % Northings co-ordinate - Bilgola (at 10m contour)
|
||||
% profiledataloc = [6272148.185 6272338.391 6272389.496 6271924.185 6271823.724]; % Northings co-ordinate - Mona Vale (at 10m contour)
|
||||
profiledataloc = [6264042.586 6264127.494 6263995.016 6263745.956 6263879.058]; % Northings co-ordinate - Dee Why (at 10m contour)
|
||||
profiledataloc2 = [343633.9263 343038.1544 342940.1201 342757.2994 342848.2807]; % Eastings co-ordinate - Dee Why (at 10m contour)
|
||||
|
||||
site = 'DeeWhy'; %embayment of interest
|
||||
contour = 10; %m - 10m or 15m contour?
|
||||
|
||||
%storm details
|
||||
stormdatesloc = 'D:\7 Erosion Models\a_nb_model_comparison\input_data\fielddata\stormdates_other.mat';
|
||||
storm = {'2014', '2015'};
|
||||
|
||||
% save?
|
||||
savebool = 1;
|
||||
% datasave location
|
||||
saveloc = 'D:\7 Erosion Models\a_nb_model_comparison\input_data\fielddata\wave\processed\';
|
||||
|
||||
%% Code
|
||||
% for MIKE21 code and MALT
|
||||
addpath(mike21loc);
|
||||
addpath(maltloc);
|
||||
%load buoy data,profile data and lookup table
|
||||
buoydata = load(buoydataloc);
|
||||
backupbuoydata = load(backupbuoydata);
|
||||
load('OEH_ARC_PointOutput.mat');
|
||||
stormdates = load(stormdatesloc);
|
||||
|
||||
% narrow down to date range
|
||||
for ii = 1:length(storm)
|
||||
startdate = stormdates.(['storm_' storm{ii}]).startdate;
|
||||
enddate = stormdates.(['storm_' storm{ii}]).enddate;
|
||||
|
||||
validentries = find(buoydata.dates>=startdate & buoydata.dates<=enddate);
|
||||
% if nothing then revert to backup
|
||||
if isempty(validentries) || validentries(end) == length(buoydata.dates)
|
||||
validentries = find(backupbuoydata.dates>=startdate & backupbuoydata.dates<=enddate);
|
||||
oswaves.Hsig = backupbuoydata.Hsig(validentries);
|
||||
oswaves.Tp1 = backupbuoydata.Tp(validentries);
|
||||
oswaves.Wdir = backupbuoydata.Wdir(validentries);
|
||||
oswaves.datenums = backupbuoydata.dates(validentries);
|
||||
else
|
||||
oswaves.Hsig = buoydata.Hsig(validentries);
|
||||
oswaves.Tp1 = buoydata.Tp(validentries);
|
||||
oswaves.Wdir = buoydata.Wdir(validentries);
|
||||
oswaves.datenums = buoydata.dates(validentries);
|
||||
end
|
||||
|
||||
fns1 = fieldnames(oswaves);
|
||||
for kk = 1:length(fns1)
|
||||
if any(isnan(oswaves.(fns1{kk})))
|
||||
error('NaN values in wave data')
|
||||
end
|
||||
end
|
||||
|
||||
tic
|
||||
for jj = 1:length(profiledataloc)
|
||||
location.N = profiledataloc(jj);
|
||||
location.E = profiledataloc2(jj);
|
||||
nswaves = fmikeos2ns(oswaves, LookUps, site, contour, location);
|
||||
|
||||
% bug fix to ensure no inaccurate wave period estimates
|
||||
nswaves.Tp1 = oswaves.Tp1;
|
||||
|
||||
tmp(jj) = nswaves;
|
||||
end
|
||||
wavedata.ns.data = tmp;
|
||||
toc
|
||||
|
||||
wavedata.os = oswaves;
|
||||
|
||||
wavedata.ns.model = 'MIKE21';
|
||||
wavedata.ns.contour = [num2str(contour) 'm'];
|
||||
wavedata.ns.location = profiledataloc;
|
||||
|
||||
if savebool
|
||||
save([saveloc 'wavedata_' lower(site) '_' storm{ii} '.mat'],'wavedata')
|
||||
end
|
||||
|
||||
clear wavedata oswaves startdate enddate validentries tmp
|
||||
end
|
@ -1,105 +0,0 @@
|
||||
% Written by Joshua Simmons 04/01/2016
|
||||
% Description: used to tranform offshore to nearshore mike21 using the code
|
||||
% OS2NS_MIKE21.m
|
||||
|
||||
clear
|
||||
clc
|
||||
|
||||
%% Settings
|
||||
%buoy data
|
||||
buoydataloc = 'J:\Coastal\Data\Wave\Sydney\Processed\SydneyProcessed_CSIROGapFill.mat';
|
||||
% the non CSIRO filtered data is the only data available after 2014 so fill
|
||||
% from the recent data with gaps.
|
||||
backupbuoydata = 'J:\Coastal\Data\Wave\Sydney\Processed\SydneyProcessed.mat';
|
||||
|
||||
%location of mike21 runcode
|
||||
mike21loc = 'J:\Coastal\Tools\Nearshore Wave Transformations\MIKE21\';
|
||||
%location of MALT
|
||||
maltloc = 'J:\Coastal\Tools\MALT Logspiral Transformation\';
|
||||
%location of profiles for which wave data is required.
|
||||
profiledataloc = [90:20:3870]; % s co-ordinate
|
||||
|
||||
site = 'Narrabeen'; %embayment of interest
|
||||
contour = 10; %m - 10m or 15m contour?
|
||||
|
||||
%storm details
|
||||
stormdatesloc = 'D:\7 Erosion Models\a_nb_model_comparison\input_data\fielddata\stormdates_narra.mat';
|
||||
storm = {'2007', '2011', '2014', '2015'};
|
||||
|
||||
% save?
|
||||
savebool = 0;
|
||||
% datasave location
|
||||
saveloc = 'D:\7 Erosion Models\a_nb_model_comparison\input_data\fielddata\wave\processed\';
|
||||
|
||||
%% Code
|
||||
% for MIKE21 code and MALT
|
||||
addpath(mike21loc);
|
||||
addpath(maltloc);
|
||||
%load buoy data,profile data and lookup table
|
||||
buoydata = load(buoydataloc);
|
||||
backupbuoydata = load(backupbuoydata);
|
||||
load('OEH_ARC_PointOutput.mat');
|
||||
stormdates = load(stormdatesloc);
|
||||
|
||||
% narrow down to date range
|
||||
for ii = 1:length(storm)
|
||||
startdate = stormdates.(['storm_' storm{ii}]).startdate;
|
||||
enddate = stormdates.(['storm_' storm{ii}]).enddate;
|
||||
|
||||
validentries = find(buoydata.dates>=startdate & buoydata.dates<=enddate);
|
||||
% if nothing then revert to backup
|
||||
if isempty(validentries) || validentries(end) == length(buoydata.dates)
|
||||
validentries = find(backupbuoydata.dates>=startdate & backupbuoydata.dates<=enddate);
|
||||
oswaves.Hsig = backupbuoydata.Hsig(validentries);
|
||||
oswaves.Tp1 = backupbuoydata.Tp(validentries);
|
||||
oswaves.Wdir = backupbuoydata.Wdir(validentries);
|
||||
oswaves.datenums = backupbuoydata.dates(validentries);
|
||||
else
|
||||
oswaves.Hsig = buoydata.Hsig(validentries);
|
||||
oswaves.Tp1 = buoydata.Tp(validentries);
|
||||
oswaves.Wdir = buoydata.Wdir(validentries);
|
||||
oswaves.datenums = buoydata.dates(validentries);
|
||||
end
|
||||
|
||||
fns1 = fieldnames(oswaves);
|
||||
for kk = 1:length(fns1)
|
||||
if any(isnan(oswaves.(fns1{kk})))
|
||||
error('NaN values in wave data')
|
||||
end
|
||||
end
|
||||
|
||||
tic
|
||||
parfor jj = 1:length(profiledataloc)
|
||||
location = profiledataloc(jj);
|
||||
nswaves = OS2NS_MIKE21(oswaves, LookUps, site, contour, location);
|
||||
|
||||
% bug fix to ensure no inaccurate wave period estimates
|
||||
nswaves.Tp1 = oswaves.Tp1;
|
||||
|
||||
% tmp(jj) = nswaves;
|
||||
Hsig(:,jj) = nswaves.Hsig(:,1);
|
||||
Wdir(:,jj) = nswaves.Wdir(:,1);
|
||||
power(:,jj) = nswaves.power(:,1);
|
||||
end
|
||||
dataout(ii).s = profiledataloc;
|
||||
dataout(ii).Hsig = Hsig;
|
||||
dataout(ii).Wdir = Wdir;
|
||||
dataout(ii).power = power;
|
||||
dataout(ii).osWdir = oswaves.Wdir;
|
||||
dataout(ii).osHsig = oswaves.Hsig;
|
||||
% wavedata.ns.data = tmp;
|
||||
toc
|
||||
|
||||
wavedata.os = oswaves;
|
||||
|
||||
wavedata.ns.model = 'MIKE21';
|
||||
wavedata.ns.contour = [num2str(contour) 'm'];
|
||||
wavedata.ns.location = profiledataloc;
|
||||
|
||||
if savebool
|
||||
save([saveloc 'wavedata_' lower(site) '_' storm{ii} '.mat'],'wavedata')
|
||||
end
|
||||
|
||||
clear wavedata oswaves startdate enddate validentries
|
||||
clear power s Hsig Wdir
|
||||
end
|
@ -1,99 +0,0 @@
|
||||
% Written by Joshua Simmons 04/01/2016
|
||||
% Description: used to tranform offshore to nearshore mike21 using the code
|
||||
% OS2NS_MIKE21.m
|
||||
|
||||
clear
|
||||
clc
|
||||
|
||||
%% Settings
|
||||
%buoy data
|
||||
buoydataloc = 'J:\Coastal\Data\Wave\Sydney\Processed\SydneyProcessed_CSIROGapFill.mat';
|
||||
% the non CSIRO filtered data is the only data available after 2014 so fill
|
||||
% from the recent data with gaps.
|
||||
backupbuoydata = 'J:\Coastal\Data\Wave\Sydney\Processed\SydneyProcessed.mat';
|
||||
|
||||
%location of mike21 runcode
|
||||
mike21loc = 'J:\Coastal\Tools\Nearshore Wave Transformations\MIKE21\';
|
||||
%location of MALT
|
||||
maltloc = 'J:\Coastal\Tools\MALT Logspiral Transformation\';
|
||||
%location of profiles for which wave data is required.
|
||||
% profiledataloc = [6275797.660794820 6275692.739810870 6275536.815570840]; % Northings co-ordinate - Bilgola (at 10m contour)
|
||||
% profiledataloc = [6272148.185 6272338.391 6272389.496 6271924.185 6271823.724]; % Northings co-ordinate - Mona Vale (at 10m contour)
|
||||
profiledataloc = [6264042.586 6264127.494 6263995.016 6263745.956 6263879.058]; % Northings co-ordinate - Dee Why (at 10m contour)
|
||||
|
||||
|
||||
|
||||
site = 'DeeWhy'; %embayment of interest
|
||||
contour = 10; %m - 10m or 15m contour?
|
||||
|
||||
%storm details
|
||||
stormdatesloc = 'D:\7 Erosion Models\a_nb_model_comparison\input_data\fielddata\stormdates_other.mat';
|
||||
storm = {'2014', '2015'};
|
||||
|
||||
% save?
|
||||
savebool = 1;
|
||||
% datasave location
|
||||
saveloc = 'D:\7 Erosion Models\a_nb_model_comparison\input_data\fielddata\wave\processed\';
|
||||
|
||||
%% Code
|
||||
% for MIKE21 code and MALT
|
||||
addpath(mike21loc);
|
||||
addpath(maltloc);
|
||||
%load buoy data,profile data and lookup table
|
||||
buoydata = load(buoydataloc);
|
||||
backupbuoydata = load(backupbuoydata);
|
||||
load('OEH_ARC_PointOutput.mat');
|
||||
stormdates = load(stormdatesloc);
|
||||
|
||||
% narrow down to date range
|
||||
for ii = 1:length(storm)
|
||||
startdate = stormdates.(['storm_' storm{ii}]).startdate;
|
||||
enddate = stormdates.(['storm_' storm{ii}]).enddate;
|
||||
|
||||
validentries = find(buoydata.dates>=startdate & buoydata.dates<=enddate);
|
||||
% if nothing then revert to backup
|
||||
if isempty(validentries) || validentries(end) == length(buoydata.dates)
|
||||
validentries = find(backupbuoydata.dates>=startdate & backupbuoydata.dates<=enddate);
|
||||
oswaves.Hsig = backupbuoydata.Hsig(validentries);
|
||||
oswaves.Tp1 = backupbuoydata.Tp(validentries);
|
||||
oswaves.Wdir = backupbuoydata.Wdir(validentries);
|
||||
oswaves.datenums = backupbuoydata.dates(validentries);
|
||||
else
|
||||
oswaves.Hsig = buoydata.Hsig(validentries);
|
||||
oswaves.Tp1 = buoydata.Tp(validentries);
|
||||
oswaves.Wdir = buoydata.Wdir(validentries);
|
||||
oswaves.datenums = buoydata.dates(validentries);
|
||||
end
|
||||
|
||||
fns1 = fieldnames(oswaves);
|
||||
for kk = 1:length(fns1)
|
||||
if any(isnan(oswaves.(fns1{kk})))
|
||||
error('NaN values in wave data')
|
||||
end
|
||||
end
|
||||
|
||||
tic
|
||||
for jj = 1:length(profiledataloc)
|
||||
location = profiledataloc(jj);
|
||||
nswaves = OS2NS_MIKE21(oswaves, LookUps, site, contour, location);
|
||||
|
||||
% bug fix to ensure no inaccurate wave period estimates
|
||||
nswaves.Tp1 = oswaves.Tp1;
|
||||
|
||||
tmp(jj) = nswaves;
|
||||
end
|
||||
wavedata.ns.data = tmp;
|
||||
toc
|
||||
|
||||
wavedata.os = oswaves;
|
||||
|
||||
wavedata.ns.model = 'MIKE21';
|
||||
wavedata.ns.contour = [num2str(contour) 'm'];
|
||||
wavedata.ns.location = profiledataloc;
|
||||
|
||||
if savebool
|
||||
save([saveloc 'wavedata_' lower(site) '_' storm{ii} '.mat'],'wavedata')
|
||||
end
|
||||
|
||||
clear wavedata oswaves startdate enddate validentries tmp
|
||||
end
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,6 +0,0 @@
|
||||
% SBEACH toolbox
|
||||
% Written by Joshua Simmons
|
||||
|
||||
function out = fsbeach_runsetup()
|
||||
|
||||
end
|
Loading…
Reference in New Issue