Skip to content

Commit

Permalink
testing on Mac
Browse files Browse the repository at this point in the history
  • Loading branch information
jthomson-apluw committed Oct 11, 2024
1 parent b15446d commit d4b2d03
Show file tree
Hide file tree
Showing 12 changed files with 62 additions and 127 deletions.
Binary file modified .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion Aquadopp/reprocess_AQH.m
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
[time,vel,amp,cor,press,pitch,roll,heading] = ...
readSWIFTv3_AQH([bfiles(iburst).folder '\' bfiles(iburst).name]);
else
load([bfiles(iburst).folder '\' bfiles(iburst).name],...
load([bfiles(iburst).folder slash bfiles(iburst).name],...
'Vel','Cor','Amp','Pressure','pitch','roll','heading','time')
if exist('Vel','var')
vel = Vel;
Expand Down
Binary file modified GeneralTools/.DS_Store
Binary file not shown.
5 changes: 3 additions & 2 deletions GeneralTools/KZ_PostProcessing/L0_createSBD.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@
% 9/2017 add oxygen optode and sea owl fluorometer
% 9/2019 changed time convention to use start of the burst,rather than end
%
% K. Zeiden, 10/2024 overhaul to make PC compatible and catch all sensor payloads

%% Experiment directory

expdir = 'S:\SEAFAC\June2024';
expdir = '/Volumes/Data/SEAFAC/June2024';
SBDfold = 'ProcessedSBD';

%% Sampling Parameters
Expand Down Expand Up @@ -108,7 +109,7 @@
end
syscommand = [syscommand ' ' sbdfile];
else
syscommand = ['!cat ' payloadfile];
syscommand = ['cat ' payloadfile];
for iprc = 1:length(PRCburstfiles)
syscommand = [syscommand ' ' PRCburstfiles(iprc).folder slash PRCburstfiles(iprc).name];
end
Expand Down
6 changes: 3 additions & 3 deletions GeneralTools/KZ_PostProcessing/L1_compileSWIFT.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
% microSWIFT - Use the time embedded within the payload 50 or 51 or 52 of the
% SBD file, which is the time at the end of the burst of raw data.

% K. Zeiden 10/01/2024
% K. Zeiden 10/01/2024, based on orginal compileSWIFT_SBDservertelemetry.m

%% Experiment directory
expdir = 'S:\SEAFAC\June2024';
expdir = '/Volumes/Data/SEAFAC/June2024';

% SBD folder
SBDfold = 'ProcessedSBD';
Expand All @@ -30,7 +30,7 @@
end

% Processing parameters
plotflag = true; % binary flag for plotting (compiled plots, not individual plots... that flag is in the readSWIFT_SBD call)
plotflag = false; % binary flag for plotting (compiled plots, not individual plots... that flag is in the readSWIFT_SBD call)

% List missions
missions = dir([expdir slash 'SWIFT*']);
Expand Down
112 changes: 0 additions & 112 deletions GeneralTools/KZ_PostProcessing/L2_pruneSWIFT.asv

This file was deleted.

6 changes: 3 additions & 3 deletions GeneralTools/KZ_PostProcessing/L2_pruneSWIFT.m
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
% Find out-of-water bursts and prune them from the SWIFT structure

% K. Zeiden 10/10/2024
% K. Zeiden 10/10/2024... similar to SWIFT_QC.m

%% Experiment Directory
expdir = 'S:\SEAFAC\June2024';
expdir = '/Volumes/Data/SEAFAC/June2024';

%% Parameters for QC/out-of-water identification

Expand All @@ -14,7 +14,7 @@
end

% Processing parameters
plotflag = true; % binary flag for plotting (compiled plots, not individual plots... that flag is in the readSWIFT_SBD call)
plotflag = false; % binary flag for plotting (compiled plots, not individual plots... that flag is in the readSWIFT_SBD call)

% QC Parameters
minwaveheight = 0;% minimum wave height in data screening
Expand Down
8 changes: 4 additions & 4 deletions GeneralTools/KZ_PostProcessing/L3_postprocessSWIFT.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
% Master post-processing function, that calls sub-functions to reprocess
% each different type of raw SWIFT data and create an L3 product.
% L1 product must have been created prior to running this script,
% by running 'compileSWIFT.m', and L2 created by running 'qcSWIFT.m';
% by running 'compileSWIFT.m', and L2 created by running 'pruneSWIFT.m';

% K. Zeiden 07/2024
% K. Zeiden 07/2024, based on existing sensor-specific processing codes w

% Need to consider additional QC steps after processing...
% Airmar temp, NaN out if below/above -20/50 deg C
% Wind speed, NaN out above 30 m/s

%% Experiment Directory
expdir = ['S:' slash 'SEAFAC' slash 'June2024'];
expdir = ['/Volumes/Data/SEAFAC/June2024'];

%% Processing toggles

Expand All @@ -33,7 +33,7 @@
rpAQD = true; % TKE

% Plotting toggle
plotflag = true;
plotflag = false;

% List of missions
missions = dir([expdir slash 'SWIFT*']);
Expand Down
3 changes: 2 additions & 1 deletion GeneralTools/plotSWIFTV3.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
nt = length(swift.time);

fh = figure('color','w');
fullscreen(2)
%fullscreen(2)
h = tight_subplot(8,3,[0.035 0.05],[0.1 0.075],0.075);
h = tight_subplot(8,3,[0.035 0.05],[0.1 0.075],0.075);
% tight_subplot(Nh, Nw, [gap_h gap_w], [lower upper], [left right] )

Expand Down
Binary file modified Signature/.DS_Store
Binary file not shown.
45 changes: 45 additions & 0 deletions Signature/absorption.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
function alpha = absorption(S,T,D,f)

% seawater sound absorption coefficient (alpha), in dB/m
% Adapted from http://resource.npl.co.uk/acoustics/techguides/seaabsorption/

% f frequency (kHz)
% T Temperature (degC)
% S Salinity (ppt)
% D Depth (m)
% pH Acidity = 8(fixed here)

% Francois R. E., Garrison G. R., "Sound absorption based on ocean measurements: Part I:Pure water and magnesium sulfate contributions", Journal of the Acoustical Society of America, 72(3), 896-907, 1982.
% Francois R. E., Garrison G. R., "Sound absorption based on ocean measurements: Part II:Boric acid contribution and equation for total absorption", Journal of the Acoustical Society of America, 72(6), 1879-1890, 1982.

% Total absorption = Boric Acid Contrib. + Magnesium Sulphate Contrib. + Pure Water Contrib.

pH = 8;
T_kel = 273 + T;
% Calculate speed of sound (according to Francois & Garrison, JASA 72 (6) p1886)
% c = 1412 + 3.21*T + 1.19*S + 0.0167*D;
c = sw_svel(S,T,D);

% Boric acid contribution
A1 = (8.86 ./ c ) .* 10.^(0.78 * pH - 5);
P1 = 1;
f1 = 2.8 * sqrt(S / 35) .* 10.^(4 - 1245 ./ T_kel);
Boric = (A1 .* P1 .* f1 .* f.*f)./(f.*f + f1.*f1);

% MgSO4 contribution
A2 = 21.44 * (S ./ c) .* (1 + 0.025 * T);
P2 = 1 - 1.37e-4 * D + 6.2e-9* D.*D;
f2 = (8.17 .* 10.^(8 - 1990./T_kel))./(1 + 0.0018 * (S - 35));
MgSO4 = (A2 .* P2 .* f2 * f.*f)./(f.*f + f2.*f2);

% Pure water contribution
A3 = T*nan;
i1 = (T <= 20);
A3(i1) = 4.937e-4 - 2.59e-5 * T(i1) + 9.11e-7 * T(i1).*T(i1) - 1.50e-8*T(i1).*T(i1).*T(i1);
A3(~i1) = 3.964e-4 - 1.146e-5 * T(~i1) + 1.45e-7 * T(~i1).*T(~i1) - 6.50e-10*T(~i1).*T(~i1).*T(~i1);
P3 = 1 - 3.83e-5 * D + 4.9e-10* D.*D;
H2O = A3 .* P3 .* f.*f;

% Total absorption
alpha = Boric + MgSO4 + H2O;
alpha = alpha/1e3 ; % dB/m
2 changes: 1 addition & 1 deletion Winds/inertialdissipation.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
% Window length
twin = 256; % Window length in seconds (should make 2^N samples)
nwin = round(fs*twin); % Window length in data points
if isodd(nwin) % Enforce even number window length
if rem(nwin,2) ~= 0 % Enforce even number window length
nwin = nwin-1;
end

Expand Down

0 comments on commit d4b2d03

Please sign in to comment.