|
|
@ -1,19 +1,39 @@
|
|
|
|
% Calculate orientation the beach profile at each unique site and save to .mat file
|
|
|
|
% Calculate orientation the beach profile at each unique site and save to .mat file. Orientation is
|
|
|
|
|
|
|
|
% the number of degrees, anticlockwise from east, perpendicular to the shoreline (pointing towards
|
|
|
|
|
|
|
|
% land).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%% Setup
|
|
|
|
% Needs the following coastal tools:
|
|
|
|
% Needs the following coastal tools:
|
|
|
|
% J:\Coastal\Tools\MALT Logspiral Transformation
|
|
|
|
addpath('J:\Coastal\Tools\MALT Logspiral Transformation')
|
|
|
|
% J:\Coastal\Tools\Coordinate Transformations
|
|
|
|
addpath('J:\Coastal\Tools\Coordinate Transformations')
|
|
|
|
|
|
|
|
|
|
|
|
clear
|
|
|
|
clear
|
|
|
|
clc
|
|
|
|
clc
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%% Options
|
|
|
|
|
|
|
|
% Where is the profiles file located? This should contain a structure including the .lat and .lon
|
|
|
|
|
|
|
|
% for each analysed cross section
|
|
|
|
|
|
|
|
profilesFile = '..\..\data\raw\processed_shorelines\profiles.mat';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
% Where should we store the processed beach orientations?
|
|
|
|
|
|
|
|
outputFile = '..\..\data\raw\processed_shorelines\orientations.mat';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
% How far in meters does the profile extend towards land and sea? Used to provide end points of the
|
|
|
|
|
|
|
|
% cross section
|
|
|
|
|
|
|
|
distance = 200;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%% Script
|
|
|
|
|
|
|
|
|
|
|
|
% Load profile data, this is where we want to calculate orientations.
|
|
|
|
% Load profile data, this is where we want to calculate orientations.
|
|
|
|
warning('off','all')
|
|
|
|
warning('off','all')
|
|
|
|
data = load('C:\Users\z5189959\Desktop\nsw_2016_storm_impact\data\raw\processed_shorelines\profiles.mat');
|
|
|
|
data = load(profilesFile);
|
|
|
|
data = data.data;
|
|
|
|
data = data.data;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
% Save results to variable
|
|
|
|
output = [];
|
|
|
|
output = [];
|
|
|
|
|
|
|
|
|
|
|
|
for ii = 1:n
|
|
|
|
for ii = 1:length(data)
|
|
|
|
disp(num2str(ii))
|
|
|
|
disp(num2str(ii))
|
|
|
|
lat = data(ii).lat;
|
|
|
|
lat = data(ii).lat;
|
|
|
|
lon = data(ii).lon;
|
|
|
|
lon = data(ii).lon;
|
|
|
@ -21,15 +41,42 @@ for ii = 1:n
|
|
|
|
[x,y,utmzone] = deg2utm(lat,lon);
|
|
|
|
[x,y,utmzone] = deg2utm(lat,lon);
|
|
|
|
|
|
|
|
|
|
|
|
if strcmp(beach, 'BOOM') == 1 || strcmp(beach, 'HARGn') == 1 || strcmp(beach, 'BILG') == 1 || strcmp(beach, 'HARGs') == 1 || strcmp(beach, 'DEEWHYn') == 1
|
|
|
|
if strcmp(beach, 'BOOM') == 1 || strcmp(beach, 'HARGn') == 1 || strcmp(beach, 'BILG') == 1 || strcmp(beach, 'HARGs') == 1 || strcmp(beach, 'DEEWHYn') == 1
|
|
|
|
% log spiral transformation file is out of date. Talk to Mitch
|
|
|
|
% These are straight beaches, load the transformation file directly and read the rotation angle.
|
|
|
|
continue
|
|
|
|
parameterDir = 'J:\Coastal\Tools\MALT Logspiral Transformation';
|
|
|
|
end
|
|
|
|
parameterFile = [parameterDir, filesep, beach, '.mat'];
|
|
|
|
|
|
|
|
parameterMat = load(parameterFile);
|
|
|
|
|
|
|
|
fields = fieldnames(parameterMat);
|
|
|
|
|
|
|
|
field = fields(1,1);
|
|
|
|
|
|
|
|
site = getfield(parameterMat, field{1});
|
|
|
|
|
|
|
|
rot_angle = site.rot_angle; % Angle of the shoreline counter clockwise from east
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
% Figure out end points in utm coordinates
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
x_land = x - distance * cos(deg2rad(rot_angle));
|
|
|
|
|
|
|
|
y_land = y + distance * sin(deg2rad(rot_angle));
|
|
|
|
|
|
|
|
x_sea = x + distance * cos(deg2rad(rot_angle));
|
|
|
|
|
|
|
|
y_sea = y - distance * sin(deg2rad(rot_angle));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[lat_land,lon_land] = utm2deg(x_land,y_land,utmzone);
|
|
|
|
|
|
|
|
[lat_sea,lon_sea] = utm2deg(x_land,y_land,utmzone);
|
|
|
|
|
|
|
|
|
|
|
|
if strcmp(beach, 'AVOCAs') == 1
|
|
|
|
row.lat_center = lat;
|
|
|
|
% negative solution. Talk to Mitch
|
|
|
|
row.lon_center = lon;
|
|
|
|
|
|
|
|
row.lat_land = lat_land;
|
|
|
|
|
|
|
|
row.lon_land = lat_land;
|
|
|
|
|
|
|
|
row.lat_sea = lat_sea;
|
|
|
|
|
|
|
|
row.lon_sea = lon_sea;
|
|
|
|
|
|
|
|
row.orientation = rot_angle + 90; % Tangent to shoreline towards line
|
|
|
|
|
|
|
|
row.beach = beach;
|
|
|
|
|
|
|
|
output = [output; row];
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
% if strcmp(beach, 'AVOCAs') == 1
|
|
|
|
|
|
|
|
% % negative solution. Talk to Mitch
|
|
|
|
|
|
|
|
% continue
|
|
|
|
|
|
|
|
% end
|
|
|
|
|
|
|
|
|
|
|
|
% Get the sp log spiral transformed coordinates
|
|
|
|
% Get the sp log spiral transformed coordinates
|
|
|
|
xyz.x = x;
|
|
|
|
xyz.x = x;
|
|
|
|
xyz.y = y;
|
|
|
|
xyz.y = y;
|
|
|
@ -56,7 +103,12 @@ for ii = 1:n
|
|
|
|
[lat_sea,lon_sea] = utm2deg(xyz_sea.x,xyz_sea.y,utmzone);
|
|
|
|
[lat_sea,lon_sea] = utm2deg(xyz_sea.x,xyz_sea.y,utmzone);
|
|
|
|
|
|
|
|
|
|
|
|
% Orientation in degrees anticlockwise from east, pointing towards land
|
|
|
|
% Orientation in degrees anticlockwise from east, pointing towards land
|
|
|
|
|
|
|
|
try
|
|
|
|
orientation = radtodeg(atan2((xyz_land.y - xyz_sea.y), (xyz_land.x - xyz_sea.x)));
|
|
|
|
orientation = radtodeg(atan2((xyz_land.y - xyz_sea.y), (xyz_land.x - xyz_sea.x)));
|
|
|
|
|
|
|
|
catch
|
|
|
|
|
|
|
|
disp(['Cannot calculate orientation: ' beach])
|
|
|
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
row.lat_center = lat;
|
|
|
|
row.lat_center = lat;
|
|
|
|
row.lon_center = lon;
|
|
|
|
row.lon_center = lon;
|
|
|
@ -70,4 +122,4 @@ for ii = 1:n
|
|
|
|
end
|
|
|
|
end
|
|
|
|
warning('on','all')
|
|
|
|
warning('on','all')
|
|
|
|
|
|
|
|
|
|
|
|
save('orientations.mat','output','-v7')
|
|
|
|
save(outputFile','output','-v7')
|
|
|
|