diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6475c29 --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*~ +*.ini +*.py# +*.#* +*._* +.DS_Store +*.ipynb_checkpoints/ diff --git a/README.md b/README.md index d202570..c583822 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,19 @@ # sbeach_toolbox -Toolbox to assist in the use of the model SBEACH. \ No newline at end of file +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 diff --git a/example/input_data/fielddata/stormdates_narra.mat b/example/input_data/fielddata/stormdates_narra.mat deleted file mode 100644 index 8009d09..0000000 Binary files a/example/input_data/fielddata/stormdates_narra.mat and /dev/null differ diff --git a/example/input_data/fielddata/stormdates_other.mat b/example/input_data/fielddata/stormdates_other.mat deleted file mode 100644 index 3a7a562..0000000 Binary files a/example/input_data/fielddata/stormdates_other.mat and /dev/null differ diff --git a/example/input_data/fielddata/tide/code/tidedataget.m b/example/input_data/fielddata/tide/code/tidedataget.m deleted file mode 100644 index fba5416..0000000 --- a/example/input_data/fielddata/tide/code/tidedataget.m +++ /dev/null @@ -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 \ No newline at end of file diff --git a/example/input_data/fielddata/tide/code/tidedataget_other.m b/example/input_data/fielddata/tide/code/tidedataget_other.m deleted file mode 100644 index bc645a8..0000000 --- a/example/input_data/fielddata/tide/code/tidedataget_other.m +++ /dev/null @@ -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 \ No newline at end of file diff --git a/example/input_data/fielddata/tide/processed/tidedata_narrabeen_2015.mat b/example/input_data/fielddata/tide/processed/tidedata_narrabeen_2015.mat deleted file mode 100644 index 9e71718..0000000 Binary files a/example/input_data/fielddata/tide/processed/tidedata_narrabeen_2015.mat and /dev/null differ diff --git a/example/input_data/fielddata/wave/code/fmikeos2ns.m b/example/input_data/fielddata/wave/code/fmikeos2ns.m deleted file mode 100644 index bf1042f..0000000 --- a/example/input_data/fielddata/wave/code/fmikeos2ns.m +++ /dev/null @@ -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 \ No newline at end of file diff --git a/example/input_data/fielddata/wave/code/run_OS_to_NS_mike21.m b/example/input_data/fielddata/wave/code/run_OS_to_NS_mike21.m deleted file mode 100644 index 5540332..0000000 --- a/example/input_data/fielddata/wave/code/run_OS_to_NS_mike21.m +++ /dev/null @@ -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 \ No newline at end of file diff --git a/example/input_data/fielddata/wave/code/run_OS_to_NS_mike21_deewhy.m b/example/input_data/fielddata/wave/code/run_OS_to_NS_mike21_deewhy.m deleted file mode 100644 index 17ca5d3..0000000 --- a/example/input_data/fielddata/wave/code/run_OS_to_NS_mike21_deewhy.m +++ /dev/null @@ -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 \ No newline at end of file diff --git a/example/input_data/fielddata/wave/code/run_OS_to_NS_mike21_end_effects_check.m b/example/input_data/fielddata/wave/code/run_OS_to_NS_mike21_end_effects_check.m deleted file mode 100644 index 5dae8fa..0000000 --- a/example/input_data/fielddata/wave/code/run_OS_to_NS_mike21_end_effects_check.m +++ /dev/null @@ -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 \ No newline at end of file diff --git a/example/input_data/fielddata/wave/code/run_OS_to_NS_mike21_other.m b/example/input_data/fielddata/wave/code/run_OS_to_NS_mike21_other.m deleted file mode 100644 index f3927e1..0000000 --- a/example/input_data/fielddata/wave/code/run_OS_to_NS_mike21_other.m +++ /dev/null @@ -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 \ No newline at end of file diff --git a/example/input_data/fielddata/wave/processed/wavedata_narrabeen_2015.mat b/example/input_data/fielddata/wave/processed/wavedata_narrabeen_2015.mat deleted file mode 100644 index 15b3848..0000000 Binary files a/example/input_data/fielddata/wave/processed/wavedata_narrabeen_2015.mat and /dev/null differ diff --git a/example/input_data/fielddata/wave/~$2007_survey_to_survey_wave_data.xlsx b/example/input_data/fielddata/wave/~$2007_survey_to_survey_wave_data.xlsx deleted file mode 100644 index fd0b6a9..0000000 Binary files a/example/input_data/fielddata/wave/~$2007_survey_to_survey_wave_data.xlsx and /dev/null differ diff --git a/example/input_data/morphology/processed/morphology_narrabeen_2015.mat b/example/input_data/morphology/processed/morphology_narrabeen_2015.mat deleted file mode 100644 index 235d6a9..0000000 Binary files a/example/input_data/morphology/processed/morphology_narrabeen_2015.mat and /dev/null differ diff --git a/fsbeach_runsetup.asv b/fsbeach_runsetup.asv deleted file mode 100644 index 315765d..0000000 --- a/fsbeach_runsetup.asv +++ /dev/null @@ -1,6 +0,0 @@ -% SBEACH toolbox -% Written by Joshua Simmons - -function out = fsbeach_runsetup() - -end \ No newline at end of file diff --git a/sbeach_exe/final_exe/SBEACH.exe b/sbeach_exe/SBEACH.exe similarity index 100% rename from sbeach_exe/final_exe/SBEACH.exe rename to sbeach_exe/SBEACH.exe diff --git a/writetofileang.m b/writetofileang.m index d8323c4..bde5b4d 100644 --- a/writetofileang.m +++ b/writetofileang.m @@ -1,5 +1,5 @@ function writetofileang(angfile, outpath, pfstring) - fid = fopen([outpath '\' pfstring '.ANG'],'w'); + fid = fopen(fullfile(outpath,[pfstring '.ANG']),'w'); fprintf(fid,'C> *******************************************************\r\n'); fprintf(fid,'C> * SBEACH wave input file: %s.ANG *\r\n',pfstring); fprintf(fid,'C> *******************************************************\r\n'); diff --git a/writetofilecfg.m b/writetofilecfg.m index 620bda5..31347c7 100644 --- a/writetofilecfg.m +++ b/writetofilecfg.m @@ -1,5 +1,5 @@ function writetofilecfg(OPT, outpath, pfstring) - fid = fopen([outpath '\' pfstring '.CFG'],'w'); + fid = fopen(fullfile(outpath,[pfstring '.CFG']),'w'); fprintf(fid,' *******************************************************\r\n'); fprintf(fid,' * SBEACH model configuration file: %s.CFG *\r\n',pfstring); fprintf(fid,' *******************************************************\r\n'); diff --git a/writetofileelv.m b/writetofileelv.m index e03712d..26a8c1b 100644 --- a/writetofileelv.m +++ b/writetofileelv.m @@ -1,5 +1,5 @@ function writetofileelv(elvfile, outpath, pfstring) - fid = fopen([outpath '\' pfstring '.ELV'],'w'); + fid = fopen(fullfile(outpath,[pfstring '.ELV']),'w'); fprintf(fid,'C> *******************************************************\r\n'); fprintf(fid,'C> * SBEACH water elevation input file: %s.ELV *\r\n',pfstring); fprintf(fid,'C> *******************************************************\r\n'); diff --git a/writetofilehdb.m b/writetofilehdb.m index 304e1c9..82e0563 100644 --- a/writetofilehdb.m +++ b/writetofilehdb.m @@ -1,5 +1,5 @@ function writetofilehdb(hdbfile, outpath, namestr) - fid = fopen([outpath '\' namestr '.HDB'],'w'); + fid = fopen(fullfile(outpath,[namestr '.HDB']),'w'); fprintf(fid,'C> *******************************************************\r\n'); fprintf(fid,'C> * SBEACH hard bottom input file: %s.HDB *\r\n',namestr); fprintf(fid,'C> *******************************************************\r\n'); diff --git a/writetofilepri.m b/writetofilepri.m index 69dff44..9203b06 100644 --- a/writetofilepri.m +++ b/writetofilepri.m @@ -1,5 +1,5 @@ function writetofilepri(prifile, outpath, namestr) - fid = fopen([outpath '\' namestr '.PRI'],'w'); + fid = fopen(fullfile(outpath,[namestr '.PRI']),'w'); fprintf(fid,'C> *******************************************************\r\n'); fprintf(fid,'C> * SBEACH initial profile input file: %s.PRI *\r\n',namestr); fprintf(fid,'C> *******************************************************\r\n'); diff --git a/writetofileprm.m b/writetofileprm.m index a5661a2..cfa0d55 100644 --- a/writetofileprm.m +++ b/writetofileprm.m @@ -1,5 +1,5 @@ function writetofileprm(prmfile, outpath, pfstring, rundescription) - fid = fopen([outpath pfstring '\' pfstring '_' rundescription '.PRM'],'w'); + fid = fopen(fullfile(outpath,pfstring, [pfstring '_' rundescription '.PRM']),'w'); fprintf(fid,'C> *******************************************************\n'); fprintf(fid,'C> * SBEACH initial profile input file: %s.PRM *\n',[pfstring '_' rundescription]); fprintf(fid,'C> *******************************************************\n'); diff --git a/writetofilewav.m b/writetofilewav.m index f7fe3a1..5368407 100644 --- a/writetofilewav.m +++ b/writetofilewav.m @@ -1,5 +1,5 @@ function writetofilewav(wavfile, outpath, pfstring) - fid = fopen([outpath '\' pfstring '.WAV'],'w'); + fid = fopen(fullfile(outpath,[pfstring '.WAV']),'w'); fprintf(fid,'C> *******************************************************\r\n'); fprintf(fid,'C> * SBEACH wave input file: %s.WAV *\r\n',pfstring); fprintf(fid,'C> *******************************************************\r\n');