diff --git a/tsg_util/automaticQC.m b/tsg_util/automaticQC.m index 09a0cd21c70202aa92f1e6c75dd39f7b1320f75b..19e505375f155fa603c58bf3f925082a34c00d9a 100644 --- a/tsg_util/automaticQC.m +++ b/tsg_util/automaticQC.m @@ -95,50 +95,6 @@ if ~isempty( ind ) tsg.SSTP_QC(ind) = MISSING_VALUE; end - -% ************************** TEST 3 *********************************** -% -% Get BAD code value -% ------------------ -badCode = tsg.qc.hash.BAD.code; - -% Set salinity QC to BAD for SSS > 50 -% ----------------------------------- -ind = find(tsg.SSPS > 50); -if ~isempty( ind ) - tsg.SSPS_QC(ind) = castByteQC( badCode, ind ); -end - -% Set salinity QC to BAD for SSS < 0 -% ----------------------------------- -ind = find(tsg.SSPS < 0); -if ~isempty( ind ) - tsg.SSPS_QC(ind) = castByteQC( badCode, ind ); -end - -% Set salinity QC to BAD for FLOW < 0.1 -% ------------------------------------- -if isfield( tsg, 'FLOW' ) - ind = find(tsg.FLOW < 1); - if ~isempty( ind ) - tsg.SSPS_QC(ind) = castByteQC( badCode, ind ); - end -end - -% Set temperature QC to BAD for SSTP > 40 -% --------------------------------------- -ind = find(tsg.SSTP > 40); -if ~isempty( ind ) - tsg.SSTP_QC(ind) = castByteQC( badCode, ind ); -end - -% Set temperature QC to BAD for SSTP < -3 -% -------------------------------------- -ind = find(tsg.SSTP < -3); -if ~isempty( ind ) - tsg.SSTP_QC(ind) = castByteQC( badCode, ind ); -end - % Save the data in the application GUI % ------------------------------------ setappdata( hMainFig, 'tsg_data', tsg ); diff --git a/tsg_util/maxSSPSQC.m b/tsg_util/maxSSPSQC.m new file mode 100644 index 0000000000000000000000000000000000000000..bec0927143b123f2ba8f86f2e71643977eb1e89a --- /dev/null +++ b/tsg_util/maxSSPSQC.m @@ -0,0 +1,49 @@ +function maxSSPSQC(hMainFig) +% +% This function is called after option/preferences menu has been activated +% and flag salinity data where SSPS > max as BAD if test is on +% +% Input +% ----- +% hMainFig ............ Handle to the main user interface +% + +% Get the data from the application GUI +% ------------------------------------- +tsg = getappdata( hMainFig, 'tsg_data'); + +% Get BAD code value +% ---------------------- +badCode = tsg.qc.hash.BAD.code; + +ssps_max = tsg.preference.ssps_max_string; + +% If necessary replace a comma by a point +% --------------------------------------- +ssps_max = regexprep(ssps_max, ',', '.'); + +% If bias not a numeric, str2double return a NaN +% ---------------------------------------------- +ssps_max = str2double( ssps_max ); + +if isnumeric( ssps_max ) && ~isnan( ssps_max ) + + % Set salinity QC to BAD for ssps < ssps_max + % ----------------------------------------------------- + ind = find(tsg.SSPS > ssps_max); + if ~isempty( ind ) + tsg.SSPS_QC(ind) = castByteQC( badCode, ind ); + end + + % Save tsg structure + % ------------------ + setappdata( hMainFig, 'tsg_data', tsg); + +else + + msgbox('Enter a numeric value in the REFERENCE menu', 'ssps QC',... + 'error', 'modal'); + +end + +end diff --git a/tsg_util/maxSSTPQC.m b/tsg_util/maxSSTPQC.m new file mode 100644 index 0000000000000000000000000000000000000000..55a7c1e626a1f40977c5a958c4330ccca188db31 --- /dev/null +++ b/tsg_util/maxSSTPQC.m @@ -0,0 +1,49 @@ +function maxSSTPQC(hMainFig) +% +% This function is called after option/preferences menu has been activated +% and flag salinity data where SSTP > max as BAD if test is on +% +% Input +% ----- +% hMainFig ............ Handle to the main user interface +% + +% Get the data from the application GUI +% ------------------------------------- +tsg = getappdata( hMainFig, 'tsg_data'); + +% Get BAD code value +% ---------------------- +badCode = tsg.qc.hash.BAD.code; + +sstp_max = tsg.preference.sstp_max_string; + +% If necessary replace a comma by a point +% --------------------------------------- +sstp_max = regexprep(sstp_max, ',', '.'); + +% If bias not a numeric, str2double return a NaN +% ---------------------------------------------- +sstp_max = str2double( sstp_max ); + +if isnumeric( sstp_max ) && ~isnan( sstp_max ) + + % Set salinity QC to BAD for ssps < ssps_max + % ----------------------------------------------------- + ind = find(tsg.SSTP > sstp_max); + if ~isempty( ind ) + tsg.SSTP_QC(ind) = castByteQC( badCode, ind ); + end + + % Save tsg structure + % ------------------ + setappdata( hMainFig, 'tsg_data', tsg); + +else + + msgbox('Enter a numeric value in the REFERENCE menu', 'sstp QC',... + 'error', 'modal'); + +end + +end diff --git a/tsg_util/minFlowQC.m b/tsg_util/minFlowQC.m new file mode 100644 index 0000000000000000000000000000000000000000..f42d88ae5425f2e9ff9c628c23974e69bf1eec11 --- /dev/null +++ b/tsg_util/minFlowQC.m @@ -0,0 +1,49 @@ +function minFlowQC(hMainFig) +% +% This function is called after option/preferences menu has been activated +% and flag salinity data where FLOW < min as BAD if test is on +% +% Input +% ----- +% hMainFig ............ Handle to the main user interface +% + +% Get the data from the application GUI +% ------------------------------------- +tsg = getappdata( hMainFig, 'tsg_data'); + +% Get BAD code value +% ---------------------- +badCode = tsg.qc.hash.BAD.code; + +flow_min = tsg.preference.flow_min_string; + +% If necessary replace a comma by a point +% --------------------------------------- +flow_min = regexprep(flow_min, ',', '.'); + +% If bias not a numeric, str2double return a NaN +% ---------------------------------------------- +flow_min = str2double( flow_min ); + +if isnumeric( flow_min ) && ~isnan( flow_min ) + + % Set salinity QC to BAD for flow < flow_min + % ----------------------------------------------------- + ind = find(tsg.FLOW < flow_min); + if ~isempty( ind ) + tsg.SSPS_QC(ind) = castByteQC( badCode, ind ); + end + + % Save tsg structure + % ------------------ + setappdata( hMainFig, 'tsg_data', tsg); + +else + + msgbox('Enter a numeric value in the REFERENCE menu', 'Flow QC',... + 'error', 'modal'); + +end + +end diff --git a/tsg_util/minPressQC.m b/tsg_util/minPressQC.m new file mode 100644 index 0000000000000000000000000000000000000000..a3df1f32815bed8c5955adb83b9df984774c5b4f --- /dev/null +++ b/tsg_util/minPressQC.m @@ -0,0 +1,49 @@ +function minPressQC(hMainFig) +% +% This function is called after option/preferences menu has been activated +% and flag salinity data where PRESS < min as BAD if test is on +% +% Input +% ----- +% hMainFig ............ Handle to the main user interface +% + +% Get the data from the application GUI +% ------------------------------------- +tsg = getappdata( hMainFig, 'tsg_data'); + +% Get BAD code value +% ---------------------- +badCode = tsg.qc.hash.BAD.code; + +press_min = tsg.preference.press_min_string; + +% If necessary replace a comma by a point +% --------------------------------------- +press_min = regexprep(press_min, ',', '.'); + +% If bias not a numeric, str2double return a NaN +% ---------------------------------------------- +press_min = str2double( press_min ); + +if isnumeric( press_min ) && ~isnan( press_min ) + + % Set salinity QC to BAD for flow < flow_min + % ----------------------------------------------------- + ind = find(tsg.PRESS < press_min); + if ~isempty( ind ) + tsg.PRESS_QC(ind) = castByteQC( badCode, ind ); + end + + % Save tsg structure + % ------------------ + setappdata( hMainFig, 'tsg_data', tsg); + +else + + msgbox('Enter a numeric value in the REFERENCE menu', 'Press QC',... + 'error', 'modal'); + +end + +end diff --git a/tsg_util/minSSPSQC.m b/tsg_util/minSSPSQC.m new file mode 100644 index 0000000000000000000000000000000000000000..a6b2de20bd0eb63a19ea72b0ce7f42d2dc73c901 --- /dev/null +++ b/tsg_util/minSSPSQC.m @@ -0,0 +1,49 @@ +function minSSTPQC(hMainFig) +% +% This function is called after option/preferences menu has been activated +% and flag salinity data where SSTP < min as BAD if test is on +% +% Input +% ----- +% hMainFig ............ Handle to the main user interface +% + +% Get the data from the application GUI +% ------------------------------------- +tsg = getappdata( hMainFig, 'tsg_data'); + +% Get BAD code value +% ---------------------- +badCode = tsg.qc.hash.BAD.code; + +sstp_min = tsg.preference.sstp_min_string; + +% If necessary replace a comma by a point +% --------------------------------------- +sstp_min = regexprep(sstp_min, ',', '.'); + +% If bias not a numeric, str2double return a NaN +% ---------------------------------------------- +sstp_min = str2double( sstp_min ); + +if isnumeric( sstp_min ) && ~isnan( sstp_min ) + + % Set salinity QC to BAD for sstp < ssps_min + % ----------------------------------------------------- + ind = find(tsg.SSTP < sstp_min); + if ~isempty( ind ) + tsg.SSTP_QC(ind) = castByteQC( badCode, ind ); + end + + % Save tsg structure + % ------------------ + setappdata( hMainFig, 'tsg_data', tsg); + +else + + msgbox('Enter a numeric value in the REFERENCE menu', 'sstp QC',... + 'error', 'modal'); + +end + +end diff --git a/tsg_util/minSSTPQC.m b/tsg_util/minSSTPQC.m new file mode 100644 index 0000000000000000000000000000000000000000..77ea3f4443e07d40593af9bbc452e0a7bedaab7c --- /dev/null +++ b/tsg_util/minSSTPQC.m @@ -0,0 +1,49 @@ +function minSSTPQC(hMainFig) +% +% This function is called after option/preferences menu has been activated +% and flag salinity data where SSTP < min as BAD if test is on +% +% Input +% ----- +% hMainFig ............ Handle to the main user interface +% + +% Get the data from the application GUI +% ------------------------------------- +tsg = getappdata( hMainFig, 'tsg_data'); + +% Get BAD code value +% ---------------------- +badCode = tsg.qc.hash.BAD.code; + +sstp_min = tsg.preference.sstp_min_string; + +% If necessary replace a comma by a point +% --------------------------------------- +sstp_min = regexprep(sstp_min, ',', '.'); + +% If bias not a numeric, str2double return a NaN +% ---------------------------------------------- +sstp_min = str2double( sstp_min ); + +if isnumeric( sstp_min ) && ~isnan( sstp_min ) + + % Set salinity QC to BAD for ssps < ssps_max + % ----------------------------------------------------- + ind = find(tsg.SSTP < sstp_min); + if ~isempty( ind ) + tsg.SSTP_QC(ind) = castByteQC( badCode, ind ); + end + + % Save tsg structure + % ------------------ + setappdata( hMainFig, 'tsg_data', tsg); + +else + + msgbox('Enter a numeric value in the REFERENCE menu', 'sstp QC',... + 'error', 'modal'); + +end + +end diff --git a/tsg_util/preferencesForm.m b/tsg_util/preferencesForm.m index 7332bdf907449f30d2c47e114343eaa8831c126d..92a7021423c0280e546047df9474fa61b8985c3b 100644 --- a/tsg_util/preferencesForm.m +++ b/tsg_util/preferencesForm.m @@ -16,10 +16,6 @@ error = -1; % ------------------------------------- tsg = getappdata(hTsgGUI, 'tsg_data'); -% disable ship speed test -% ----------------------- -tsg.preference.ship_speed_test=1; - % set default uicontrol size % -------------------------- height = 0.03; @@ -48,6 +44,21 @@ hPreferencesFig = figure(... '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(... @@ -112,31 +123,142 @@ if bottom < .1 left = left + inc_x; end -% display ship speed test text -% ---------------------------- +% 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 uicontrol +% -------------------------------- + +% display connected line text +% ------------------------- uicontrol(... 'Parent', hPreferencesFig, ... 'Units', 'normalized', ... 'Style', 'Text', ... - 'Fontsize', tsg.fontSize-1, ... - 'HorizontalAlignment', 'left', ... + 'Fontsize', tsg.fontSize-1, 'HorizontalAlignment', 'left', ... 'Position',[left, bottom, length, height], ... - 'TooltipString', 'enable/disable ship speed test', ... - 'String', 'Ship Speed Test'); + 'TooltipString', 'select plot with connected line', ... + 'String', 'Plot with connectd line'); -% display ship speed test 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', ... - 'BackgroundColor', 'w', ... - 'Style', 'popupmenu', ... - 'Fontsize', tsg.fontSize-2, ... + '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.ship_speed_test_string, ... - 'Value', tsg.preference.ship_speed_test, ... - 'Tag', 'PREFERENCES_SHIP_SPEED_TEST'); + '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 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 @@ -154,7 +276,7 @@ uicontrol(... 'HorizontalAlignment', 'left', ... 'Position',[left, bottom, length, height], ... 'TooltipString', 'select ship speed min (knots)', ... - 'String', 'Ship Speed Min'); + 'String', 'Ship Speed Min (knots)'); % display ship speed min uicontrol % -------------------------------- @@ -166,9 +288,8 @@ uicontrol(... 'Fontsize', tsg.fontSize-2, ... 'HorizontalAlignment', 'right', ... 'Position', [left + length, bottom, length, height], ... - 'String', tsg.preference.ship_speed_min_string, ... - 'Value', tsg.preference.ship_speed_min, ... - 'Tag', 'PREFERENCES_SHIP_SPEED_MIN'); + 'String', tsg.preference.ship_speed_min_string, ... + 'Value', tsg.preference.ship_speed_min, 'Tag', 'PREFERENCES_SHIP_SPEED_MIN'); bottom = bottom - inc_y - height; if bottom < .1 @@ -176,43 +297,49 @@ if bottom < .1 left = left + inc_x; end -% display connected line text -% ------------------------- +% display FLOW min text +% ---------------------- uicontrol(... 'Parent', hPreferencesFig, ... 'Units', 'normalized', ... - 'Style', 'Text', ... - 'Fontsize', tsg.fontSize-1, ... - 'HorizontalAlignment', 'left', ... + 'Style', 'Text', 'Fontsize', tsg.fontSize-1, 'HorizontalAlignment', 'left', ... 'Position',[left, bottom, length, height], ... - 'TooltipString', 'select plot with connected line', ... - 'String', 'Plot with connectd line'); + 'TooltipString', 'Select min Flow (liter/min)', 'String', 'Flow Min (l/minute)'); -% display connected line uicontrol -% -------------------------------- +% display FLOW min uicontrol +% ------------------------------- uicontrol(... 'Parent', hPreferencesFig, ... - 'Units', 'normalized', ... - 'BackgroundColor', 'w', ... - 'Style', 'popupmenu', ... - 'Fontsize', tsg.fontSize-2, ... + 'Units', 'normalized', 'Style', 'Edit', ... + 'Fontsize', tsg.fontSize-2, 'BackgroundColor', 'w', ... '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'); + '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 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 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 @@ -220,31 +347,49 @@ if bottom < .1 left = left + inc_x; end -% display coefficient type text -% ----------------------------- +% display SSPS min text +% ---------------------- uicontrol(... 'Parent', hPreferencesFig, ... 'Units', 'normalized', ... - 'Style', 'Text', ... - 'Fontsize', tsg.fontSize-1, ... - 'HorizontalAlignment', 'left', ... + 'Style', 'Text', 'Fontsize', tsg.fontSize-1, 'HorizontalAlignment', 'left', ... 'Position',[left, bottom, length, height], ... - 'TooltipString', 'select coefficients type', ... - 'String', 'Coefficients type'); + 'TooltipString', 'Select min SSPS', 'String', 'SSPS min'); -% display coefficient type uicontrol -% ---------------------------------- +% 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', ... - 'BackgroundColor', 'w', ... - 'Style', 'popupmenu', ... - 'Fontsize', tsg.fontSize-2, ... + '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.coeff_type_string , ... - 'Value', tsg.preference.coeff_type_value , ... - 'Tag', 'PREFERENCES_COEFF_TYPE'); + 'String', tsg.preference.ssps_max_string, 'Tag', 'PREFERENCES_SSPS_MAX'); bottom = bottom - inc_y - height; if bottom < .1 @@ -252,31 +397,49 @@ if bottom < .1 left = left + inc_x; end -% display map resolution text -% ----------------------------- +% display SSTP min text +% ---------------------- uicontrol(... 'Parent', hPreferencesFig, ... 'Units', 'normalized', ... - 'Style', 'Text', ... - 'Fontsize', tsg.fontSize-1, ... - 'HorizontalAlignment', 'left', ... + 'Style', 'Text', 'Fontsize', tsg.fontSize-1, 'HorizontalAlignment', 'left', ... 'Position',[left, bottom, length, height], ... - 'TooltipString', 'select map resolution', ... - 'String', 'Map Resolution'); + 'TooltipString', 'Select min SSTP', 'String', 'SSTP min (°C)'); -% display map resolution uicontrol -% -------------------------------- +% 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', ... - 'BackgroundColor', 'w', ... - 'Style', 'popupmenu', ... - 'Fontsize', tsg.fontSize-2, ... + 'Style', 'Text', 'Fontsize', tsg.fontSize-1, 'HorizontalAlignment', 'left', ... + 'Position',[left, bottom, length, height], ... + 'TooltipString', 'Select max SSTP', 'String', 'SSTP max (°C)'); + +% 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.map_resolution_string, ... - 'Value', tsg.preference.map_resolution, ... - 'Tag', 'PREFERENCES_MAP_RESOLUTION'); + 'String', tsg.preference.sstp_max_string, 'Tag', 'PREFERENCES_SSTP_MAX'); bottom = bottom - inc_y - height; if bottom < .1 @@ -344,17 +507,29 @@ uiwait(hPreferencesFig); get(prefs.PREFERENCES_LEVITUS_VALUE, 'value'); tsg.preference.levitus_depth_value = ... get(prefs.PREFERENCES_LEVITUS_DEPTH, 'value'); - tsg.preference.ship_speed_test = ... - get(prefs.PREFERENCES_SHIP_SPEED_TEST, 'value'); - tsg.preference.ship_speed_min = ... - get(prefs.PREFERENCES_SHIP_SPEED_MIN, 'value'); - tsg.preference.plot_connected_value = ... - get(prefs.PREFERENCES_PLOT_CONNECTED_LINE, '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'); tsg.preference.map_resolution = ... get(prefs.PREFERENCES_MAP_RESOLUTION, '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'); + tsg.preference.ship_speed_min = ... + get(prefs.PREFERENCES_SHIP_SPEED_MIN, 'value'); + tsg.preference.ssps_min_string = ... + get(prefs.PREFERENCES_SSPS_MIN, 'string'); + tsg.preference.ssps_max_string = ... + get(prefs.PREFERENCES_SSPS_MAX, 'string'); + tsg.preference.sstp_min_string = ... + get(prefs.PREFERENCES_SSTP_MIN, 'string'); + tsg.preference.sstp_max_string = ... + get(prefs.PREFERENCES_SSTP_MAX, 'string'); + % Save tsg structure % ------------------ setappdata(hTsgGUI, 'tsg_data', tsg); @@ -363,10 +538,6 @@ uiwait(hPreferencesFig); % ------------------------------ updateTsgStructWithCalCoeff(hTsgGUI); - % apply ship speed QC - % ------------------- - minSpeedQC(hTsgGUI); - % close windows (replace call to uiresume(hHeaderFig)) % ---------------------------------------------------- close(hPreferencesFig); diff --git a/tsg_util/tsg_preferences.m b/tsg_util/tsg_preferences.m index 61c320a8059ec36078edb4497d1a43e4e535ddad..c8b65bebec4be2c155d891a1a61db85d203b3345 100644 --- a/tsg_util/tsg_preferences.m +++ b/tsg_util/tsg_preferences.m @@ -131,20 +131,27 @@ end preference.version = VERSION; preference.char_version = CHAR_VERSION; preference.autoload = 'off'; + % Climatology preference.levitus_version = {'WOA01','WOA05'}; preference.levitus_value = 2; % WOA05 preference.levitus_depth_string = {'0','10'}; preference.levitus_depth_value = 1; - preference.ship_speed_test_string= {'none','automatic'}; - preference.ship_speed_test = 1; % no test on ship speed - preference.ship_speed_min_string = {'1','3','5'}; - preference.ship_speed_min = 1; - preference.plot_connected_string = {'none', '-', '--', ':', '-.'}; - preference.plot_connected_value = 1; % 0, line not connected preference.coeff_type_string = {'use A-D', 'use G-J'}; preference.coeff_type_value = 2; + % Plot preference.map_resolution_string = {'low','medium','high'}; preference.map_resolution = 1; + preference.plot_connected_string = {'none', '-', '--', ':', '-.'}; + preference.plot_connected_value = 1; % 0, line not connected + % QC test + preference.flow_min_string = {'1'}; + preference.press_min_string = {'1'}; + preference.ship_speed_min_string = {'1','3','5'}; + preference.ship_speed_min = 1; + preference.ssps_min_string = {'0'}; + preference.ssps_max_string = {'50'}; + preference.sstp_min_string = {'-3'}; + preference.sstp_max_string = {'40'}; % save preference struct to 'prefdir.mat' file % --------------------------------------------- diff --git a/tsgqc.m b/tsgqc.m index f84ff996725eb47113f213e024d7cce4e82f4790..df9af8484eaf38fb95112fa91c509793848dd1b9 100644 --- a/tsgqc.m +++ b/tsgqc.m @@ -36,8 +36,8 @@ global NETCDF_FORMAT_VERSION % version number, may be used to initialize some files when it change % 0.90x -> 1.0RCx % ------------------------------------------------------------------- -VERSION = 1.01; % -> 1.01 -CHAR_VERSION = '1.01'; +VERSION = 1.02; % -> 1.02 +CHAR_VERSION = '1.02'; % netcdf file version, see DATA FORMAT TSG document: % CORTSG_format_gosud_1.5.doc @@ -267,6 +267,35 @@ uimenu(hOptionMenu,'Label','Preferences',... 'Enable', 'on',... 'Callback', {@PreferencesMenuCallback}); +%% Menu QC automatic +% Dependent functions : preferenceForm.m; tsg_preference.m, +% @QCMenuCallback +% ---------------------------------------------------------- +hQCMenu = uimenu(... + 'Parent', hMainFig, 'Enable', 'off', 'HandleVisibility', handleVisibility,... + 'Label', 'QCauto'); +hFlowMenu = uimenu(... + 'Parent', hQCMenu, 'Label','Flow', 'HandleVisibility', handleVisibility,... + 'UserData', 'off','Enable', 'off','Callback', {@QCMenuCallback,'Flow'}); +hPressMenu = uimenu(... + 'Parent', hQCMenu, 'Label','Press', 'HandleVisibility', handleVisibility,... + 'UserData', 'off', 'Callback', {@QCMenuCallback,'Press'}); +hSpeedMenu = uimenu(... + 'Parent', hQCMenu, 'Label','Ship Speed', 'HandleVisibility', handleVisibility,... + 'UserData', 'off', 'Callback', {@QCMenuCallback,'Speed'}); +hSSPSminMenu = uimenu(... + 'Parent', hQCMenu, 'Label','SSPS min', 'HandleVisibility', handleVisibility,... + 'UserData', 'off', 'Callback', {@QCMenuCallback,'SSPSmin'}); +hSSPSmaxMenu = uimenu(... + 'Parent', hQCMenu, 'Label','SSPS max', 'HandleVisibility', handleVisibility,... + 'UserData', 'off', 'Callback', {@QCMenuCallback,'SSPSmax'}); +hSSTPminMenu = uimenu(... + 'Parent', hQCMenu, 'Label','SSTP min', 'HandleVisibility', handleVisibility,... + 'UserData', 'off', 'Callback', {@QCMenuCallback,'SSTPmin'}); +hSSTPmaxMenu = uimenu(... + 'Parent', hQCMenu, 'Label','SSTP max', 'HandleVisibility', handleVisibility,... + 'UserData', 'off', 'Callback', {@QCMenuCallback,'SSTPmax'}); + %% Menu Help with F1 Help and About submenu % -------------------------------------------------------- hOptionMenu = uimenu(hMainFig,'Label','Help'); @@ -1097,6 +1126,61 @@ hrbInterpCancel = uicontrol( ... %% *************************** CALLBACKS ********************************** +%% QCMenuCallback +%---------------------------------------------------------------------- +% Callback function run when the Automatic QC menu item is selected +% +% Si vous modiifer ce CallBack verifier les modifications a apporter a +% 1 - preferenceForm.m +% 2 - tsg_preference.m +%---------------------------------------------------------------------- + function QCMenuCallback(hObject, eventdata, test) + + switch test + case 'Speed' + minSpeedQC(hMainFig) + case 'Flow' + minFlowQC(hMainFig) + case 'Press' + minPressQC(hMainFig) + case 'SSPSmin' + minSSPSQC(hMainFig) + case 'SSPSmax' + maxSSPSQC(hMainFig) + case 'SSTPmin' + minSSTPQC(hMainFig) + case 'SSTPmax' + maxSSTPQC(hMainFig) + otherwise + msgbox('QCMenuCallback : erreur', 'QCMenuCallback','error', 'modal'); + end + + % -------------------------- + % refresh QC statistic panel + % -------------------------- + display_QC( hMainFig ); + + % ------------------ + % Refresh the plots + %------------------- + + % Get the parameter displayed on plot number 1 : figure at the top + % ----------------------------------------------------------------- + PARA = getParaCorModule( hMainFig ); + + % Draw plot 1 + % ----------- + plot_Validation( hMainFig, hPlotAxes, 1, PARA{1} ); + + % Update the map if already displayed + % ----------------------------------- + if strcmp( get(hMapFig,'visible'), 'on') == 1 + erase_Line( hPlotAxes, 4 ); + plot_map( hMainFig, hPlotAxes); + end + + end + %% OpenMenuCallback %---------------------------------------------------------------------- % Callback function run when the Open menu item is selected @@ -1238,6 +1322,7 @@ hrbInterpCancel = uicontrol( ... % --------------------------- set(hSaveMenu, 'Enable', 'on'); set(hExportMenu, 'Enable', 'on'); + set(hQCMenu, 'Enable', 'on'); % update some fields in tsg structure and restore tsg % ---------------------------------------------------