Add function to extract site orientations
This function takes the profiles.mat file and uses the spiral log transformation tool to calculate the orientation of each beach profile cross section. Orientations are needed to relate dune toes and crests (from shape files) to each of the profiles. Note there are some beaches which don't have the correct parameters in the log-spiral tool folder, so these should be followed up with Mitch.master
parent
7ece9e613c
commit
1d8a5f158d
@ -0,0 +1,73 @@
|
||||
% Calculate orientation the beach profile at each unique site and save to .mat file
|
||||
% Needs the following coastal tools:
|
||||
% J:\Coastal\Tools\MALT Logspiral Transformation
|
||||
% J:\Coastal\Tools\Coordinate Transformations
|
||||
|
||||
clear
|
||||
clc
|
||||
|
||||
% Load profile data, this is where we want to calculate orientations.
|
||||
warning('off','all')
|
||||
data = load('C:\Users\z5189959\Desktop\nsw_2016_storm_impact\data\raw\processed_shorelines\profiles.mat');
|
||||
data = data.data;
|
||||
|
||||
output = [];
|
||||
|
||||
for ii = 1:n
|
||||
disp(num2str(ii))
|
||||
lat = data(ii).lat;
|
||||
lon = data(ii).lon;
|
||||
beach = data(ii).site{1};
|
||||
[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
|
||||
% log spiral transformation file is out of date. Talk to Mitch
|
||||
continue
|
||||
end
|
||||
|
||||
if strcmp(beach, 'AVOCAs') == 1
|
||||
% negative solution. Talk to Mitch
|
||||
continue
|
||||
end
|
||||
|
||||
% Get the sp log spiral transformed coordinates
|
||||
xyz.x = x;
|
||||
xyz.y = y;
|
||||
xyz.z = 0;
|
||||
out = xyz2spz(xyz,beach);
|
||||
|
||||
% Define new bounds towards land and towards sea
|
||||
% Distance is the number of m in the section to go towards
|
||||
distance = 200;
|
||||
s = out.s;
|
||||
p_center = out.p;
|
||||
|
||||
% Convert landwards and seawrds point back to lat/lon
|
||||
spz_land.s = out.s;
|
||||
spz_land.p = out.p-distance;
|
||||
spz_land.z = 0;
|
||||
xyz_land = spz2xyz(spz_land,beach);
|
||||
[lat_land,lon_land] = utm2deg(xyz_land.x,xyz_land.y,utmzone);
|
||||
|
||||
spz_sea.s = out.s;
|
||||
spz_sea.p = out.p+distance;
|
||||
spz_sea.z = 0;
|
||||
xyz_sea = spz2xyz(spz_sea,beach);
|
||||
[lat_sea,lon_sea] = utm2deg(xyz_sea.x,xyz_sea.y,utmzone);
|
||||
|
||||
% Orientation in degrees anticlockwise from east, pointing towards land
|
||||
orientation = radtodeg(atan2((xyz_land.y - xyz_sea.y), (xyz_land.x - xyz_sea.x)));
|
||||
|
||||
row.lat_center = lat;
|
||||
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 = orientation;
|
||||
row.beach = beach;
|
||||
output = [output; row];
|
||||
end
|
||||
warning('on','all')
|
||||
|
||||
save('orientations.mat','output','-v7')
|
Loading…
Reference in New Issue