This repository has been archived by the owner on Apr 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain_calibration.m
86 lines (75 loc) · 2.47 KB
/
main_calibration.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
a = 750e-6;
rho_s = 1330;
% range = linspace(1,39,39);
% C = []; dB = []; TKE = []; t = [];
% for i=range
% matfile = ['./adcpDataFiles/S100882A003_LakeK_Sig2_' num2str(i) '.mat'];
% [conc, amp_cor, dir] = ABS_Correction(matfile, a, rho_s, false);
% [tke, time] = Beam5_TKE(matfile);
%
% C = [C; conc];
% dB = [dB; amp_cor];
% TKE = [TKE; tke];
% t = [t; time];
% %fprintf('%4.2f; %4.2f\n', length(tke(:,1)), length(time));
% end
% two extra ensembles from sig 6 and 7 - not full hour data
% normal_factor = max(C,[],2); % set bottom conc = 1
% normal_conc = C./normal_factor; % normalize by bottom conc
%
% background_conc = max(mink(normal_conc,2,1));
% %x = find(diff(background_conc)./max(background_conc)>.3);
% %if numel(x)>1
% % x = min(x);
% %end
% x = 69;
% % setting background suspension = 0, i.e unknown C constant
% final_cal_conc = normal_conc - [background_conc(1:x) zeros(1,length(background_conc)-x)];
%
% % applying linear fix to corrected amplitude
% background_dB = max(mink(dB,2,1));
% final_cor_amp = dB - [background_dB(1:x) zeros(1,length(background_conc)-x)];
%
% save('./adcpDataFiles/S100882A004_LakeK_Sig2.mat', 'C', 'final_cal_conc', 'dB', 'final_cor_amp', 'TKE', 't');
%% Aug18-Nov 18 Surface plots of corrected amplitude and concentration
load('./adcpDataFiles/S100882A004_LakeK_Sig2.mat', 'C', 'final_cal_conc', 'dB', 'final_cor_amp', 'TKE', 't');
figure()
surface(flipud(final_cal_conc'),'EdgeColor','None');
colorbar
title('Final Normalized Concentration')
ylabel('Depth Bins');
xlabel('Time (hr)');
figure()
surface(flipud(final_cor_amp'),'EdgeColor','None');
colorbar
title('Final Corrected Amplitude (-C dB)')
ylabel('Depth Bins');
xlabel('Time (hr)');
figure()
surface(flipud(TKE'),'EdgeColor','None');
colorbar; caxis([0 .3e-4])
title('Vertical TKE (m^2/s^2)')
ylabel('Depth Bins');
xlabel('Time (hr)');
% Surface plots timeseries
figure()
bin = [60 64 68]; % depth bin to plot
subplot(3,1,1)
plot(t, final_cor_amp(:,bin));
xlabel('time, hr');
datetick('x');
ylabel('corrected amplitude, -C dB');
title('August-November');
legend('Bin 60','Bin 64','Bin 68');
subplot(3,1,2)
plot(t, final_cal_conc(:,bin));
xlabel('time, hr');
datetick('x');
ylabel("concentration, normalized");
legend('Bin 60','Bin 64','Bin 68');
subplot(3,1,3)
plot(t, TKE(:,bin));
xlabel('time');
datetick('x');
ylabel('TKE, m^2/s^2');
legend('Bin 60','Bin 64','Bin 68');