-
Notifications
You must be signed in to change notification settings - Fork 2
/
mainDI_InlineWorkshop.m
161 lines (126 loc) · 5.55 KB
/
mainDI_InlineWorkshop.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
% Main InLine Analysis Script
% author: Guillaume Bourdin
% created: May 05, 2021
% clear
% close all
% if feature('IsDebugMode'); dbquit all; end
%
% % cd('/Users/emmanuel.boss/Desktop/InLine analysis/InLineAnalysis-master/')
% cd('/Users/gui/Documents/MATLAB/InLineAnalysis/InLineAnalysis-master/')
%
% % Load InLineAnalysis and the configuration
% ila = InLineAnalysis('cfg/EXPORTS02_cfg.m');
%% Quick cfg update
ila.cfg.days2run = datenum(2022,8,1):datenum(2022,8,4);
%% 'FLOW', 'SBE4536073', 'ACS298', 'HBB', 'WSCD','SUVF','ACS91','LISST'
ila.cfg.instruments2run = {'FLOW','ACS298'};
ila.cfg.qcref.view = 'ACS298';
ila.cfg.parallel = Inf;
ila.cfg.calibrate.(ila.cfg.qcref.view).compute_dissolved = true;
%% 1. Read DI
% To get ag and cg from ACS can run DI day by day
% To get betag from BB3 need to run the entire dataset if select di method constant
ila.cfg.force_import = false;
ila.ReadRawDI();
ila.CheckDataStatus();
%% Load processed data from mat files: 'data' = Raw | 'bin' = Bin | 'qc' = QCed | 'prod' = product
% ila.Read('data');
ila.Read('bin');
ila.Read('qc');
% ila.Read('prod');
%% 1.1. Diagnostic Plot
% check raw spectrums AC or BB sensors
ila.DiagnosticPlot('AC',{'raw'}); % AC or BB
%% 2. Automatic QC of raw data for step in ACS spectrum, BB saturated and obvious bad PAR values
% fudge factor for auto QC ACS.
% Varies between ACS: 0.1 = maximum filtration and >> 10 = very small filtration (default = 3)
ila.cfg.qc.RawAutoQCLim.dissolved.a = 3;
ila.cfg.qc.RawAutoQCLim.dissolved.c = 6;
% fudge factor for auto QC BB.
% 0.1 = maximum filtration and >> 10 = very small filtration (default = 3)
ila.cfg.qc.RawAutoQCLim.dissolved.bb = 3;
ila.RawAutoQC('raw');
ila.CheckDataStatus();
%% 2.1. Diagnostic Plot
% check raw spectrums AC or BB sensors
ila.DiagnosticPlot('AC',{'raw'}); % AC or BB
%% 2.2. Run QC directly on spectra at any level
% ila.DiagnosticPlot inputs:
% 1) 'AC or BB'
% 2) 'level': 'raw' | 'bin' | 'qc' | 'prod'
% 3) save plot option: boolean
% 4) table and variable to QC as shown in examples below
% Examples:
% - to QC 'a' of 'tsw' table of 'qc' level of ACs: ila.DiagnosticPlot('AC',{'qc'}, false, {'tsw','a'})
% - to QC 'cp' of 'p' table of 'prod' level of ACs: ila.DiagnosticPlot('AC',{'prod'}, false, {'p','cp'})
% - to QC 'beta' of 'fsw' table of 'bin' level of HBB or BB3: ila.DiagnosticPlot('BB',{'bin'}, false, {'fsw','beta'})
% - to QC 'ag' of 'g' table of prod level of ACs: ila.DiagnosticPlot('AC',{'prod'}, false, {'g','ag'})
ila.DiagnosticPlot('AC',{'raw'}, false, {'diw','c'});
%% 3. QC DI
ila.cfg.di.qc.mode = 'ui';
ila.cfg.di.qc.remove_old = false; % remove old selection of this period
ila.cfg.di.qc.qc_once_for_all = false; % true = QC all variables | false = QC variables separately)
ila.QCDI();
%% 4. Second auto QC DI
ila.RawAutoQC('qc');
%% 4.1. Diagnostic Plot
% check QCed spectrums AC or BB sensors
% {'raw','bin','qc','prod'}
ila.DiagnosticPlot('BB',{'qc'}); % AC or BB
%% 4.2. Run QC directly on spectra at any level
% ila.DiagnosticPlot inputs:
% 1) 'AC or BB'
% 2) 'level': 'raw' | 'bin' | 'qc' | 'prod'
% 3) save plot option: boolean
% 4) table and variable to QC as shown in examples below
% Examples:
% - to QC 'a' of 'tsw' table of 'qc' level of ACs: ila.DiagnosticPlot('AC',{'qc'}, false, {'tsw','a'})
% - to QC 'cp' of 'p' table of 'prod' level of ACs: ila.DiagnosticPlot('AC',{'prod'}, false, {'p','cp'})
% - to QC 'beta' of 'fsw' table of 'bin' level of HBB or BB3: ila.DiagnosticPlot('BB',{'bin'}, false, {'fsw','beta'})
% - to QC 'ag' of 'g' table of prod level of ACs: ila.DiagnosticPlot('AC',{'prod'}, false, {'g','ag'})
ila.DiagnosticPlot('AC',{'qc'}, false, {'diw','c'});
%% 5. Write QC | write only 'part' or 'diw' or 'all'
ila.Write('qc', 'diw')
ila.CheckDataStatus();
%% 6. BIN DI
ila.BinDI();
%% 6.1. Diagnostic Plot
% check binned spectrums AC or BB sensors
ila.DiagnosticPlot('AC',{'bin'}); % AC or BB
%% 7. Write bin DI | write only 'part' or 'diw' or 'all'
ila.Write('bin', 'diw')
ila.CheckDataStatus();
%% 8. Calibrate
ila.cfg.calibrate.skip = {'FLOW', 'TSG'};
ila.Calibrate();
ila.CheckDataStatus();
%% 8.1. Normal and DI prod QC plots
save_figures = false;
%%% AC or BB 3D plots %%%
ila.DiagnosticPlot('AC', {'prod'}, save_figures); % AC or BB
%%% ACS BB3 TSG PAR WSCD final product visualisation %%%
ila.visProd_timeseries()
%% 9. Run QC directly on spectra at any level
% ila.DiagnosticPlot inputs:
% 1) 'AC or BB'
% 2) 'level': 'raw' | 'bin' | 'qc' | 'prod'
% 3) save plot option: boolean
% 4) table and variable to QC as shown in examples below
% Examples:
% - to QC 'a' of 'tsw' table of 'qc' level of ACs: ila.DiagnosticPlot('AC',{'qc'}, false, {'tsw','a'})
% - to QC 'cp' of 'p' table of 'prod' level of ACs: ila.DiagnosticPlot('AC',{'prod'}, false, {'p','cp'})
% - to QC 'beta' of 'fsw' table of 'bin' level of HBB or BB3: ila.DiagnosticPlot('BB',{'bin'}, false, {'fsw','beta'})
% - to QC 'ag' of 'g' table of prod level of ACs: ila.DiagnosticPlot('AC',{'prod'}, false, {'g','ag'})
ila.DiagnosticPlot('AC',{'prod'}, false, {'g','ag'});
%% 9.1. Load previous qc pick selection at prod level
ila.cfg.qc.mode='load'; % load or ui
ila.cfg.qc.specific.run = {ila.cfg.qcref.view}; % 'FLOW','ACS57','TSG', 'BB31502', 'WSCD859','PAR'
ila.QC();
%% 10. Save products | write only 'part' or 'diw' or 'all'
ila.Write('prod', 'diw')
% % Notify with a song that the job is done
% notif_sound = load('gong'); sound(notif_sound.y, notif_sound.Fs); % handel
% return
%% re-write last version of 'qc' and 'bin' | write only 'part' or 'diw' or 'all'
ila.Write('bin', 'diw')
ila.Write('qc', 'diw')