diff --git a/.DS_Store b/.DS_Store index ed4cc25..33d99bb 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/Aquadopp/reprocess_AQH.m b/Aquadopp/reprocess_AQH.m index be0652e..c29caa8 100644 --- a/Aquadopp/reprocess_AQH.m +++ b/Aquadopp/reprocess_AQH.m @@ -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; diff --git a/GeneralTools/.DS_Store b/GeneralTools/.DS_Store index 97336dc..94c8f56 100644 Binary files a/GeneralTools/.DS_Store and b/GeneralTools/.DS_Store differ diff --git a/GeneralTools/KZ_PostProcessing/L0_createSBD.m b/GeneralTools/KZ_PostProcessing/L0_createSBD.m index 5aa1b18..6129b80 100644 --- a/GeneralTools/KZ_PostProcessing/L0_createSBD.m +++ b/GeneralTools/KZ_PostProcessing/L0_createSBD.m @@ -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 @@ -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 diff --git a/GeneralTools/KZ_PostProcessing/L1_compileSWIFT.m b/GeneralTools/KZ_PostProcessing/L1_compileSWIFT.m index 8b575a4..dca34e1 100644 --- a/GeneralTools/KZ_PostProcessing/L1_compileSWIFT.m +++ b/GeneralTools/KZ_PostProcessing/L1_compileSWIFT.m @@ -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'; @@ -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*']); diff --git a/GeneralTools/KZ_PostProcessing/L2_pruneSWIFT.asv b/GeneralTools/KZ_PostProcessing/L2_pruneSWIFT.asv deleted file mode 100644 index 1f1b1a4..0000000 --- a/GeneralTools/KZ_PostProcessing/L2_pruneSWIFT.asv +++ /dev/null @@ -1,112 +0,0 @@ -% Find out-of-water bursts and prune them from the SWIFT structure - -% K. Zeiden 10/10/2024 - -%% Experiment Directory -expdir = 'S:\SEAFAC\June2024'; - -%% Parameters for QC/out-of-water identification - -if ispc - slash = '\'; -else - slash = '/'; -end - -% Processing parameters -plotflag = true; % 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 -minsalinity = 1;% PSU, for use in screen points when buoy is out of the water (unless testing on Lake WA) -maxdriftspd = 3;% m/s, this is applied to telemetry drift speed, but reported drift is calculated after that - -disp('-------------------------------------') -disp('Out-of-water parameters:') -disp(['Minimum wave height: ' num2str(minwaveheight) ' m']) -disp(['Minimum salinity: ' num2str(minsalinity) ' PSU']) -disp(['Maximum drift speed: ' num2str(maxdriftspd) ' ms^{-1}']) -disp('-------------------------------------') - -%% List missions -missions = dir([expdir slash 'SWIFT*']); -missions = missions([missions.isdir]); - -%% Loop through missions and remove burst identified as out-of-water -for im = 1%:length(missions) - - missiondir = [missions(im).folder slash missions(im).name]; - cd(missiondir) - sname = missions(im).name; - - % Load L1 file - l1file = dir([missiondir slash '*SWIFT*L1.mat']); - if ~isempty(l1file) - load([l1file.folder slash l1file.name],'SWIFT','sinfo'); - else % Exit reprocessing if no L1 product exists - warning(['No L1 product found for ' missiondir(end-16:end) '. Skipping...']) - return - end - - % Create diary file - diaryfile = ['L2_' missions(im).name '_pruneSWIFT.txt']; - if exist(diaryfile,'file') - delete(diaryfile); - end - diary(diaryfile) - disp(['Pruning ' sname]) - - % Loop through and identify out-of-water bursts - nburst = length(SWIFT); - outofwater = false(1,nburst); - - for iburst = 1:nburst - oneSWIFT = SWIFT(iburst); - - % Waves too small (probably out of water) - if isfield(oneSWIFT,'sigwaveheight') - if oneSWIFT.sigwaveheight < minwaveheight || oneSWIFT.sigwaveheight >= 999 - outofwater(iburst) = true; - disp('Waves too small, removing burst.') - end - end - - % Salinity too small (probably out of water) - if isfield(oneSWIFT,'salinity') - if all(oneSWIFT.salinity < minsalinity) - outofwater(iburst) = true; - disp('Salinity too low, removing burst.') - end - end - - % Drift speed limit (if too fast, probably out of water) - if isfield(oneSWIFT,'driftspd') - if oneSWIFT.driftspd > maxdriftspd - outofwater(iburst) = true; - disp('Speed too fast, removing burst.') - end - end - - end - - % Remove out-of-water bursts - SWIFT(outofwater) = []; - - % Plot - if plotflag - if strcmp(sinfo.type,'V3') - fh = plotSWIFTV3(SWIFT); - else - fh = plotSWIFTV4(SWIFT); - end - set(fh,'Name',l2file.name(1:end-4)) - print(fh,[l3file.folder slash l3file.name(1:end-4)],'-dpng') - end - - % Save L2 file - save([missiondir slash sname '_L2.mat'],'SWIFT','sinfo') - - % Turn off diary - diary off - -end % End mission loop \ No newline at end of file diff --git a/GeneralTools/KZ_PostProcessing/L2_pruneSWIFT.m b/GeneralTools/KZ_PostProcessing/L2_pruneSWIFT.m index 2cc9314..8dc770c 100644 --- a/GeneralTools/KZ_PostProcessing/L2_pruneSWIFT.m +++ b/GeneralTools/KZ_PostProcessing/L2_pruneSWIFT.m @@ -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 @@ -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 diff --git a/GeneralTools/KZ_PostProcessing/L3_postprocessSWIFT.m b/GeneralTools/KZ_PostProcessing/L3_postprocessSWIFT.m index 72e069c..6851b52 100644 --- a/GeneralTools/KZ_PostProcessing/L3_postprocessSWIFT.m +++ b/GeneralTools/KZ_PostProcessing/L3_postprocessSWIFT.m @@ -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 @@ -33,7 +33,7 @@ rpAQD = true; % TKE % Plotting toggle -plotflag = true; +plotflag = false; % List of missions missions = dir([expdir slash 'SWIFT*']); diff --git a/GeneralTools/plotSWIFTV3.m b/GeneralTools/plotSWIFTV3.m index 2169a37..3a72e95 100644 --- a/GeneralTools/plotSWIFTV3.m +++ b/GeneralTools/plotSWIFTV3.m @@ -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] ) diff --git a/Signature/.DS_Store b/Signature/.DS_Store index 0030a9b..305d62b 100644 Binary files a/Signature/.DS_Store and b/Signature/.DS_Store differ diff --git a/Signature/absorption.m b/Signature/absorption.m new file mode 100644 index 0000000..052f496 --- /dev/null +++ b/Signature/absorption.m @@ -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 diff --git a/Winds/inertialdissipation.m b/Winds/inertialdissipation.m index 0ddfaab..eaac09b 100644 --- a/Winds/inertialdissipation.m +++ b/Winds/inertialdissipation.m @@ -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