Newer
Older
function error = preferencesForm(hTsgGUI)
%
% Input
% -----
% hTsgGUI ............ Handel to the main user interface
%
% Output
% ------
% error .............. 1: OK ; -1 : an error occured
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
error = -1;
% Get the data from the application GUI
% -------------------------------------
tsg = getappdata(hTsgGUI, 'tsg_data');
% set default uicontrol size
% --------------------------
height = 0.03;
length = .15;
% Define uicontrol start position
% -------------------------------
left = .01;
bottom = .95;
inc_x = 3 * length;
inc_y = 0.01;
% preferences Uicontrols in a new figure
% ---------------------------------
hPreferencesFig = figure(...
'BackingStore','off',...
'Name', 'TSGQC PREFERENCES', ...
'NumberTitle', 'off', ...
'Resize', 'on', ...
'Menubar','none', ...
'Toolbar', 'none', ...
'Tag', 'TSG_PREFERENCES', ...
'Visible','on',...
'WindowStyle', 'modal', ...
'Units', 'normalized',...
'Position',get(hTsgGUI,'Position'), ...
'Color', get(0, 'DefaultUIControlBackgroundColor'));
% display Climatology TITLE
% -------------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', ...
'Style', 'Text', 'Fontsize', tsg.fontSize, 'FontWeight', 'bold',...
'HorizontalAlignment', 'Left', ...
'Position',[left, bottom, 2*length, height],'String', 'Climatology');
bottom = bottom - inc_y - height;
if bottom < .1
bottom = 0.95;
left = left + inc_x;
end
% display climatology text
% -------------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', ...
'Style', 'Text', ...
'Fontsize', tsg.fontSize-1, ...
'HorizontalAlignment', 'left', ...
'Position',[left, bottom, length, height], ...
'TooltipString', 'select climatology origin', ...
'String', 'Climatology');
% display climatology uicontrol
% -----------------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', ...
'BackgroundColor', 'w', ...
'Style', 'popupmenu', ...
'Fontsize', tsg.fontSize-2, ...
'HorizontalAlignment', 'right', ...
'Position', [left + length, bottom, length, height], ...
'String', tsg.preference.levitus_version, ...
'Value', tsg.preference.levitus_value, ...
'callback', @update_climato_depth);
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
bottom = bottom - inc_y - height;
if bottom < .1
bottom = 0.95;
left = left + inc_x;
end
% display climatology depth text
% -------------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', ...
'Style', 'Text', ...
'Fontsize', tsg.fontSize-1, ...
'HorizontalAlignment', 'left', ...
'Position',[left, bottom, length, height], ...
'TooltipString', 'select climatology depth', ...
'String', 'Climatology depth');
% display climatology depth uicontrol
% ------------------------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', ...
'BackgroundColor', 'w', ...
'Style', 'popupmenu', ...
'Fontsize', tsg.fontSize-2, ...
'HorizontalAlignment', 'right', ...
'Position', [left + length, bottom, length, height], ...
'String', tsg.preference.levitus_depth_string, ...
'Value', tsg.preference.levitus_depth_value, ...
bottom = bottom - inc_y - height;
if bottom < .1
bottom = 0.95;
left = left + inc_x;
end
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
% display conventions field if exist
% ----------------------------------
% uicontrol(...
% 'Parent', hPreferencesFig, ...
% 'Units', 'normalized', ...
% 'Style', 'text', ...
% 'Fontsize', tsg.fontSize-2, ...
% 'HorizontalAlignment', 'left', ...
% 'Position', [left + 2*length, bottom, length, height], ...
% 'String', char(s.conventions));
% display Calibration TITLE
% --------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', ...
'Style', 'Text', 'Fontsize', tsg.fontSize, 'FontWeight', 'bold',...
'HorizontalAlignment', 'Left', ...
'Position',[left, bottom, 2*length, height], 'String', 'Calibration coefficient');
bottom = bottom - inc_y - height;
if bottom < .1
bottom = 0.95;
left = left + inc_x;
end
% display coefficient type text
% -----------------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', ...
'Style', 'Text', 'Fontsize', tsg.fontSize-1, ...
'HorizontalAlignment', 'left', 'Position',[left, bottom, length, height], ...
'TooltipString', 'select coefficients type', ...
'String', 'Coefficients type');
% display coefficient type uicontrol
% ----------------------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', ...
'BackgroundColor', 'w', 'Style', 'popupmenu', 'Fontsize', tsg.fontSize-2, ...
'HorizontalAlignment', 'right', ...
'Position', [left + length, bottom, length, height], ...
'String', tsg.preference.coeff_type_string , ...
'Value', tsg.preference.coeff_type_value , ...
'Tag', 'PREFERENCES_COEFF_TYPE');
bottom = bottom - inc_y - height;
if bottom < .1
bottom = 0.95;
left = left + inc_x;
end
% display Figure TITLE
% --------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', ...
'Style', 'Text', 'Fontsize', tsg.fontSize, 'FontWeight', 'bold',...
'HorizontalAlignment', 'Left', ...
'Position',[left, bottom, 2*length, height], 'String', 'Figure');
bottom = bottom - inc_y - height;
if bottom < .1
bottom = 0.95;
left = left + inc_x;
end
% display connected line text
% -------------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', ...
'Style', 'Text', ...
'Fontsize', tsg.fontSize-1, 'HorizontalAlignment', 'left', ...
'Position',[left, bottom, length, height], ...
'TooltipString', 'select plot with connected line', ...
% display connected line uicontrol
% --------------------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', 'BackgroundColor', 'w', ...
'Style', 'popupmenu', 'Fontsize', tsg.fontSize-2, ...
'HorizontalAlignment', 'right', ...
'Position', [left + length, bottom, length, height], ...
'String', tsg.preference.plot_connected_string , ...
'Value', tsg.preference.plot_connected_value , ...
'Tag', 'PREFERENCES_PLOT_CONNECTED_LINE');
bottom = bottom - inc_y - height;
if bottom < .1
bottom = 0.95;
left = left + inc_x;
end
% display map resolution text
% -----------------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', ...
'Style', 'Text', 'Fontsize', tsg.fontSize-1, ...
'HorizontalAlignment', 'left', 'Position',[left, bottom, length, height], ...
'TooltipString', 'select map resolution', ...
'String', 'Map Resolution');
% display map resolution uicontrol
% --------------------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', ...
'BackgroundColor', 'w', 'Style', 'popupmenu', 'Fontsize', tsg.fontSize-2, ...
'HorizontalAlignment', 'right', ...
'Position', [left + length, bottom, length, height], ...
'String', tsg.preference.map.resolution_string, ...
'Value', tsg.preference.map.resolution, ...
'Tag', 'PREFERENCES_MAP_RESOLUTION');
bottom = bottom - inc_y - height;
if bottom < .1
bottom = 0.95;
left = left + inc_x;
end
% display map with patch
% -----------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', ...
'Style', 'Text', 'Fontsize', tsg.fontSize-1, ...
'HorizontalAlignment', 'left', 'Position',[left, bottom, length, height], ...
'TooltipString', 'Much slower with high resolution', ...
'String', 'Map with patch (slower)');
% display map resolution uicontrol
% --------------------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', ...
'BackgroundColor', 'w', 'Style', 'popupmenu', 'Fontsize', tsg.fontSize-2, ...
'HorizontalAlignment', 'right', ...
'Position', [left + length, bottom, length, height], ...
'String', tsg.preference.map.patch_string, ...
'Value', tsg.preference.map.patch_value, ...
'Tag', 'PREFERENCES_MAP_PATCH');
bottom = bottom - inc_y - height;
if bottom < .1
bottom = 0.95;
left = left + inc_x;
end
% display map border
% ------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', ...
'Style', 'Text', 'Fontsize', tsg.fontSize-1, ...
'HorizontalAlignment', 'left', 'Position',[left, bottom, length, height], ...
'TooltipString', 'select map border in degrees', ...
'String', 'Map Border in degrees');
% display map resolution uicontrol
% --------------------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', ...
'BackgroundColor', 'w', 'Style', 'popupmenu', 'Fontsize', tsg.fontSize-2, ...
'HorizontalAlignment', 'right', ...
'Position', [left + length, bottom, length, height], ...
'String', tsg.preference.map.border_string, ...
'Value', tsg.preference.map.border_value, ...
'Tag', 'PREFERENCES_MAP_BORDER');
bottom = bottom - inc_y - height;
if bottom < .1
bottom = 0.95;
left = left + inc_x;
end
% display QC Automatic Test TITLE
% --------------------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', ...
'Style', 'Text', 'Fontsize', tsg.fontSize, 'FontWeight', 'bold',...
'HorizontalAlignment', 'Left', ...
'Position',[left, bottom, 2*length, height], ...
'String', 'Min/Max values for automatic QC');
bottom = bottom - inc_y - height;
if bottom < .1
bottom = 0.95;
left = left + inc_x;
end
% display ship speed min text
% -----------------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', ...
Yves Gouriou
committed
'Style', 'Text','Fontsize', tsg.fontSize-1,'HorizontalAlignment', 'left', ...
'Position',[left, bottom, length, height], ...
Yves Gouriou
committed
'TooltipString', 'Select ship speed min (knots)', ...
'String', 'Ship Speed Min (knots)');
% display ship speed min uicontrol
% --------------------------------
uicontrol(...
'Parent', hPreferencesFig, ...
Yves Gouriou
committed
'Units', 'normalized', 'Style', 'Edit', 'BackgroundColor', 'w', ...
'Fontsize', tsg.fontSize-2, 'HorizontalAlignment', 'right', ...
'Position', [left + length, bottom, length, height], ...
'String', tsg.preference.ship_speed_min_string, ...
Yves Gouriou
committed
'Tag', 'PREFERENCES_SHIP_SPEED_MIN');
bottom = bottom - inc_y - height;
if bottom < .1
bottom = 0.95;
left = left + inc_x;
end
% display FLOW min text
% ----------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', ...
'Style', 'Text', 'Fontsize', tsg.fontSize-1, 'HorizontalAlignment', 'left', ...
'TooltipString', 'Select min Flow (liter/min)', 'String', 'Flow Min (l/minute)');
% display FLOW min uicontrol
% -------------------------------
'Units', 'normalized', 'Style', 'Edit', ...
'Fontsize', tsg.fontSize-2, 'BackgroundColor', 'w', ...
'HorizontalAlignment', 'right', ...
'Position', [left + length, bottom, length, height], ...
'String', tsg.preference.flow_min_string, 'Tag', 'PREFERENCES_FLOW_MIN');
bottom = bottom - inc_y - height;
if bottom < .1
bottom = 0.95;
left = left + inc_x;
end
% display PRESS min text
% ----------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', ...
'Style', 'Text', 'Fontsize', tsg.fontSize-1, 'HorizontalAlignment', 'left', ...
'Position',[left, bottom, length, height], ...
'TooltipString', 'Select min pressure pump', 'String', 'Pressure Min (l/minute)');
% display PRESS min uicontrol
% -------------------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', 'Style', 'Edit', ...
'Fontsize', tsg.fontSize-2, 'BackgroundColor', 'w', ...
'HorizontalAlignment', 'right', ...
'Position', [left + length, bottom, length, height], ...
'String', tsg.preference.press_min_string, 'Tag', 'PREFERENCES_PRESS_MIN');
bottom = bottom - inc_y - height;
if bottom < .1
bottom = 0.95;
left = left + inc_x;
end
% display SSPS min text
% ----------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', ...
'Style', 'Text', 'Fontsize', tsg.fontSize-1, 'HorizontalAlignment', 'left', ...
'Position',[left, bottom, length, height], ...
'TooltipString', 'Select min SSPS', 'String', 'SSPS min');
% display SSPS min uicontrol
% -------------------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', 'Style', 'Edit', ...
'Fontsize', tsg.fontSize-2, 'BackgroundColor', 'w', ...
'HorizontalAlignment', 'right', ...
'Position', [left + length, bottom, length, height], ...
'String', tsg.preference.ssps_min_string, 'Tag', 'PREFERENCES_SSPS_MIN');
bottom = bottom - inc_y - height;
if bottom < .1
bottom = 0.95;
left = left + inc_x;
end
% display SSPS max text
% ----------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', ...
'Style', 'Text', 'Fontsize', tsg.fontSize-1, 'HorizontalAlignment', 'left', ...
'Position',[left, bottom, length, height], ...
'TooltipString', 'Select max SSPS', 'String', 'SSPS max');
% display SSPS max uicontrol
% -------------------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', 'Style', 'Edit', ...
'Fontsize', tsg.fontSize-2, 'BackgroundColor', 'w', ...
'HorizontalAlignment', 'right', ...
'Position', [left + length, bottom, length, height], ...
'String', tsg.preference.ssps_max_string, 'Tag', 'PREFERENCES_SSPS_MAX');
bottom = bottom - inc_y - height;
if bottom < .1
bottom = 0.95;
left = left + inc_x;
end
% display SSTP min text
% ----------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', ...
'Style', 'Text', 'Fontsize', tsg.fontSize-1, 'HorizontalAlignment', 'left', ...
'Position',[left, bottom, length, height], ...
'TooltipString', 'Select min SSTP', 'String', sprintf('SSTP min (%cC)', char(176)));
% display SSTP min uicontrol
% -------------------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', 'Style', 'Edit', ...
'Fontsize', tsg.fontSize-2, 'BackgroundColor', 'w', ...
'HorizontalAlignment', 'right', ...
'Position', [left + length, bottom, length, height], ...
'String', tsg.preference.sstp_min_string, 'Tag', 'PREFERENCES_SSTP_MIN');
bottom = bottom - inc_y - height;
if bottom < .1
bottom = 0.95;
left = left + inc_x;
end
% display SSTP max text
% ----------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', ...
'Style', 'Text', 'Fontsize', tsg.fontSize-1, 'HorizontalAlignment', 'left', ...
'Position',[left, bottom, length, height], ...
'TooltipString', 'Select max SSTP', 'String', sprintf('SSTP max (%cC)', char(176)));
% display SSTP max uicontrol
% -------------------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', 'Style', 'Edit', ...
'Fontsize', tsg.fontSize-2, 'BackgroundColor', 'w', ...
'HorizontalAlignment', 'right', ...
'Position', [left + length, bottom, length, height], ...
'String', tsg.preference.sstp_max_string, 'Tag', 'PREFERENCES_SSTP_MAX');
bottom = bottom - inc_y - height;
if bottom < .1
bottom = 0.95;
left = left + inc_x;
end
% display SSJT min text
% ----------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', ...
'Style', 'Text', 'Fontsize', tsg.fontSize-1, 'HorizontalAlignment', 'left', ...
'Position',[left, bottom, length, height], ...
'TooltipString', 'Select min SSJT', 'String', sprintf('SSJT min (%cC)', char(176)));
% display SSJT min uicontrol
% -------------------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', 'Style', 'Edit', ...
'Fontsize', tsg.fontSize-2, 'BackgroundColor', 'w', ...
'HorizontalAlignment', 'right', ...
'Position', [left + length, bottom, length, height], ...
'String', tsg.preference.ssjt_min_string, 'Tag', 'PREFERENCES_SSJT_MIN');
bottom = bottom - inc_y - height;
if bottom < .1
bottom = 0.95;
left = left + inc_x;
end
% display SSJT max text
% ----------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', ...
'Style', 'Text', 'Fontsize', tsg.fontSize-1, 'HorizontalAlignment', 'left', ...
'Position',[left, bottom, length, height], ...
'TooltipString', 'Select max SSTP', 'String', sprintf('SSJT max (%cC)', char(176)));
% display SSJT max uicontrol
% -------------------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', 'Style', 'Edit', ...
'Fontsize', tsg.fontSize-2, 'BackgroundColor', 'w', ...
'HorizontalAlignment', 'right', ...
'Position', [left + length, bottom, length, height], ...
'String', tsg.preference.ssjt_max_string, 'Tag', 'PREFERENCES_SSJT_MAX');
bottom = bottom - inc_y - height;
if bottom < .1
bottom = 0.95;
left = left + inc_x;
end
% goto next column
% ----------------
bottom = 0.95;
left = left + inc_x;

jacques.grelet_ird.fr
committed
% display format for dates TITLE
% -------------------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', ...
'Style', 'Text', 'Fontsize', tsg.fontSize, 'FontWeight', 'bold',...
'HorizontalAlignment', 'Left', ...
'Position',[left, bottom, 2*length, height], ...
'String', 'Formats used for date and positions');

jacques.grelet_ird.fr
committed
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
bottom = bottom - inc_y - height;
if bottom < .1
bottom = 0.95;
left = left + inc_x;
end
% display date format for variable text
% -------------------------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', ...
'Style', 'Text','Fontsize', tsg.fontSize-1,'HorizontalAlignment', 'left', ...
'Position',[left, bottom, length, height], ...
'TooltipString', 'Format is not available for change', ...
'String', 'Date format for variable:');
% display date format for variable uicontrol
% ------------------------------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', 'Style', 'Edit', 'BackgroundColor', 'w', ...
'Fontsize', tsg.fontSize-2, 'HorizontalAlignment', 'right', ...
'Position', [left + length, bottom, length, height], ...
'Enable', 'inactive',...
'TooltipString', 'Format is not available for change', ...
'String', tsg.preference.date_format_variable, ...
'Tag', 'PREFERENCE_DATE_FORMAT_VARIABLE');
bottom = bottom - inc_y - height;
if bottom < .1
bottom = 0.95;
left = left + inc_x;
end
% display date format for attribute min text
% ------------------------------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', ...
'Style', 'Text', 'Fontsize', tsg.fontSize-1, 'HorizontalAlignment', 'left', ...
'Position',[left, bottom, length, height], ...
'TooltipString', 'Format is not available for change', ...

jacques.grelet_ird.fr
committed
% display date format for attribute uicontrol
% -------------------------------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', 'Style', 'Edit', ...
'Fontsize', tsg.fontSize-2, 'BackgroundColor', 'w', ...
'HorizontalAlignment', 'right', ...
'Position', [left + length, bottom, length, height], ...
'Enable', 'inactive',...
'TooltipString', 'Format is not available for change', ...
'String', tsg.preference.date_format_attribute, ...
'Tag', 'PREFERENCES_DATE_FORMAT_ATTRIBUTE');
bottom = bottom - inc_y - height;
if bottom < .1
bottom = 0.95;
left = left + inc_x;
end
% display positions format
% ------------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', ...
'Style', 'Text', 'Fontsize', tsg.fontSize-1, 'HorizontalAlignment', 'left', ...
'Position',[left, bottom, length, height], ...
'TooltipString',sprintf('Formats used for positions, DD%cMM.SS or decimal',char(176)), ...
'String', 'Positions format');
% display positions format
% ------------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', 'Style', 'popupmenu', ...
'Fontsize', tsg.fontSize-2, 'BackgroundColor', 'w', ...
'HorizontalAlignment', 'right', ...
'Position', [left + length, bottom, length, height], ...
'TooltipString', 'Formats used for positions', ...
'String', tsg.preference.positions_format_string, ...
'Value', tsg.preference.positions_format_value, ...
'Tag', 'PREFERENCES_POSITIONS_FORMAT');
bottom = bottom - inc_y - height;
if bottom < .1
bottom = 0.95;
left = left + inc_x;
end
% display DT_SMOOTH TITLE
% -------------------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', ...
'Style', 'Text', 'Fontsize', tsg.fontSize, 'FontWeight', 'bold',...
'HorizontalAlignment', 'Left', ...
'Position',[left, bottom, 2*length, height], ...
'String', 'Smoothing of TSG time-series');
bottom = bottom - inc_y - height;
if bottom < .1
bottom = 0.95;
left = left + inc_x;
end
% display DT_SMOOTH in text
% ------------------------------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', ...
'Style', 'Text', 'Fontsize', tsg.fontSize-1, 'HorizontalAlignment', 'left', ...
'Position',[left, bottom, length, height], ...
'TooltipString', 'value in minutes, between 0 and 1339)', ...
'String', 'TSG DT SMOOTH (in min)');
% display date format for attribute uicontrol
% -------------------------------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', 'Style', 'Edit', ...
'Fontsize', tsg.fontSize-2, 'BackgroundColor', 'w', ...
'HorizontalAlignment', 'right', ...
'Position', [left + length, bottom, length, height], ...
'TooltipString', 'value in minutes, between 0 and 1339)', ...
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
'String', tsg.preference.dt_smooth , ...
'Tag', 'PREFERENCES_DT_SMOOTH');
bottom = bottom - 4 *inc_y - height;
if bottom < .1
bottom = 0.95;
left = left + inc_x;
end
% display MAXDIFF TITLE
% -------------------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', ...
'Style', 'Text', 'Fontsize', tsg.fontSize, 'FontWeight', 'bold',...
'HorizontalAlignment', 'Left', ...
'Position',[left, bottom, 2*length, 1.5 * height], ...
'String', 'Maximum time difference between tsg data and water sample used to compute the difference');
bottom = bottom - inc_y - height;
if bottom < .1
bottom = 0.95;
left = left + inc_x;
end
% display DT_SMOOTH in text
% ------------------------------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', ...
'Style', 'Text', 'Fontsize', tsg.fontSize-1, 'HorizontalAlignment', 'left', ...
'Position',[left, bottom, length, height], ...
'TooltipString', 'value in minutes, between 0 and 1339, default 5)', ...
'String', 'WS Time diff (in min)');
% display date format for attribute uicontrol
% -------------------------------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', 'Style', 'Edit', ...
'Fontsize', tsg.fontSize-2, 'BackgroundColor', 'w', ...
'HorizontalAlignment', 'right', ...
'Position', [left + length, bottom, length, height], ...
'TooltipString', 'value in minutes, between 0 and 1339, default 5)', ...
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
'String', tsg.preference.ws_timediff , ...
'Tag', 'PREFERENCES_WS_TIMEDIFF');
bottom = bottom - 4* inc_y - height;
if bottom < .1
bottom = 0.95;
left = left + inc_x;
end
% display STDMAX TITLE
% -------------------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', ...
'Style', 'Text', 'Fontsize', tsg.fontSize, 'FontWeight', 'bold',...
'HorizontalAlignment', 'Left', ...
'Position',[left, bottom, 2*length, 1.5*height], ...
'String', 'Salinity, in 1 hour interval, should not depart the average for more than SAL_STD_MAX standard deviation');
bottom = bottom - inc_y - height;
if bottom < .1
bottom = 0.95;
left = left + inc_x;
end
% display DT_SM in text
% ------------------------------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', ...
'Style', 'Text', 'Fontsize', tsg.fontSize-1, 'HorizontalAlignment', 'left', ...
'Position',[left, bottom, length, height], ...
'TooltipString', 'SSPS STD Max, default 0.1', ...
'String', 'SSPS STD Max');
% display date format for attribute uicontrol
% -------------------------------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', 'Style', 'Edit', ...
'Fontsize', tsg.fontSize-2, 'BackgroundColor', 'w', ...
'HorizontalAlignment', 'right', ...
'Position', [left + length, bottom, length, height], ...
'TooltipString', 'SSPS STD Max, default 0.1', ...
'String', tsg.preference.ssps_stdmax , ...
'Tag', 'PREFERENCES_SSPS_STDMAX');
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
bottom = bottom - 3*inc_y - height;
if bottom < .1
bottom = 0.95;
left = left + inc_x;
end
% display UNDO TITLE
% -------------------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', ...
'Style', 'Text', 'Fontsize', tsg.fontSize, 'FontWeight', 'bold',...
'HorizontalAlignment', 'Left', ...
'Position',[left, bottom, 2*length, 1.5*height], ...
'String', 'Number of QC history levels for UNDO function');
bottom = bottom - inc_y - height;
if bottom < .1
bottom = 0.95;
left = left + inc_x;
end
% display DT_SM in text
% ------------------------------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', ...
'Style', 'Text', 'Fontsize', tsg.fontSize-1, 'HorizontalAlignment', 'left', ...
'Position',[left, bottom, length, height], ...
'TooltipString', 'QC History Size, default 10', ...
'String', 'QC History Size');
% display date format for attribute uicontrol
% -------------------------------------------
uicontrol(...
'Parent', hPreferencesFig, ...
'Units', 'normalized', 'Style', 'Edit', ...
'Fontsize', tsg.fontSize-2, 'BackgroundColor', 'w', ...
'HorizontalAlignment', 'right', ...
'Position', [left + length, bottom, length, height], ...
'TooltipString', 'QC History Size, default 10', ...
'String', tsg.qc_history_size , ...
'Tag', 'PREFERENCES_QC_HISTORY_SIZE');
bottom = bottom - inc_y - height;
if bottom < .1
bottom = 0.95;
left = left + inc_x;
end
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
% CONTINUE PUSH BUTTON
% --------------------
% The Continue (valid) button
uicontrol( ...
'Parent', hPreferencesFig, ...
'Style','pushbutton',...
'Fontsize', tsg.fontSize,...
'Units', 'normalized', ...
'Position',[.01, .01, .1, .04],...
'String','Continue',...
'Interruptible','off',...
'BusyAction','cancel',...
'Tag','PREF_CONTINUE_BUTTON',...
'Callback', @continueCallback);
% CANCEL PUSH BUTTON
% ------------------
% The cancel button
uicontrol( ...
'Parent', hPreferencesFig, ...
'Style','pushbutton',...
'Fontsize', tsg.fontSize,...
'Units', 'normalized', ...
'Position',[.2, .01, .1, .04],...
'String','Cancel',...
'Interruptible','off',...
'BusyAction','cancel',...
'Tag','PREF_CANCEL_BUTTON',...
'Callback', @cancelCallback);
% Build structure container for graphic handles with tag property defined.
% ------------------------------------------------------------------------
prefs = guihandles(hPreferencesFig);
% record data struct in application data object
% ---------------------------------------------
% guidata(hHeaderFig, data);
% stop execution until push-button Continue was press
% ---------------------------------------------------
uiwait(hPreferencesFig);
%% Nested callback
% -----------------------------------------------------------------------
% Continue action, get uicontrol fields and populate tsg structure
% -----------------------------------------------------------------------
function continueCallback(obj, event)
% Save tsg structure
% ------------------
setappdata(hTsgGUI, 'tsg_data', tsg);
% get the corresponding string from uicontrol using guihandles
% and save value in tsg.preferences struct
% ------------------------------------------------------------
tsg.preference.levitus_value = ...
tsg.preference.coeff_type_value = ...
get(prefs.PREFERENCES_COEFF_TYPE, 'value');
% Figure
tsg.preference.plot_connected_value = ...
get(prefs.PREFERENCES_PLOT_CONNECTED_LINE, 'value');
get(prefs.PREFERENCES_MAP_RESOLUTION, 'value');
get(prefs.PREFERENCES_MAP_BORDER, 'value');
get(prefs.PREFERENCES_MAP_PATCH, 'value');
tsg.preference.positions_format_value = ...
get(prefs.PREFERENCES_POSITIONS_FORMAT, 'value');
% QC Tests
tsg.preference.flow_min_string = ...
get(prefs.PREFERENCES_FLOW_MIN, 'string');
tsg.preference.press_min_string = ...
get(prefs.PREFERENCES_PRESS_MIN, 'string');
Yves Gouriou
committed
tsg.preference.ship_speed_min_string = ...
get(prefs.PREFERENCES_SHIP_SPEED_MIN, 'string');
tsg.preference.ssps_min_string = ...
get(prefs.PREFERENCES_SSPS_MIN, 'string');
tsg.preference.ssps_max_string = ...
get(prefs.PREFERENCES_SSPS_MAX, 'string');
tsg.preference.ssjt_min_string = ...
get(prefs.PREFERENCES_SSJT_MIN, 'string');
tsg.preference.ssjt_max_string = ...
get(prefs.PREFERENCES_SSJT_MAX, 'string');
tsg.preference.sstp_min_string = ...
get(prefs.PREFERENCES_SSTP_MIN, 'string');
tsg.preference.sstp_max_string = ...
get(prefs.PREFERENCES_SSTP_MAX, 'string');
tsg.preference.dt_smooth = ...
get(prefs.PREFERENCES_DT_SMOOTH, 'string');
tsg.preference.ws_timediff = ...
get(prefs.PREFERENCES_WS_TIMEDIFF, 'string');
tsg.preference.ssps_stdmax = ...
get(prefs.PREFERENCES_SSPS_STDMAX, 'string');
tsg.preference.qc_history_size = ...
get(prefs.PREFERENCES_QC_HISTORY_SIZE, 'string');
% Save tsg structure
% ------------------
setappdata(hTsgGUI, 'tsg_data', tsg);
% update structure tsg with derived value
% ---------------------------------------
updateTsgStructWithSmoothVars(hTsgGUI);
updateTsgStructWithUndoLevels(hTsgGUI);
% fill tsg calibration variables
% ------------------------------
updateTsgStructWithCalCoeff(hTsgGUI);
% close windows (replace call to uiresume(hHeaderFig))
% ----------------------------------------------------
close(hPreferencesFig);
% flushes the event queue and updates the figure window
% -----------------------------------------------------
% refresh QC statistic panel
% --------------------------
display_QC( hTsgGUI );
% return with no error code (true)
% --------------------------------
error = 1;
return
end
% -----------------------------------------------------------------------
% Cancel button, no action
% -----------------------------------------------------------------------
function cancelCallback(obj, event)
% close windows
% -------------
close(hPreferencesFig);
% flushes the event queue and updates the figure window
% -----------------------------------------------------
drawnow;
% return error code (no change)
% -----------------------------
error = -1;
end % end of cancelCallback nested function
% The climatology level are not the same between WOA and ISAS
% -----------------------------------------------------------
function update_climato_depth(obj, event)
% disp(get(prefs.PREFERENCES_CLIMATOLOGY_VALUE, 'value'))
if get(prefs.PREFERENCES_CLIMATOLOGY_VALUE, 'value') == 1
set(prefs.PREFERENCES_CLIMATOLOGY_DEPTH, 'string', {'0', '10'});
set(prefs.PREFERENCES_CLIMATOLOGY_DEPTH, 'string', {'5', '10'});