Skip to content

Commit

Permalink
Merge pull request #510 from aodn/2.5.39
Browse files Browse the repository at this point in the history
2.5.39
  • Loading branch information
ggalibert authored Jul 12, 2018
2 parents d8ad331 + edd49ad commit bde9388
Show file tree
Hide file tree
Showing 44 changed files with 13,479 additions and 116 deletions.
23 changes: 14 additions & 9 deletions FlowManager/displayManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ function displayManager(windowTitle, sample_data, callbacks)
mainWindow(windowTitle, sample_data, states, 3, @stateSelectCallback);

function state = stateSelectCallback(event,...
panel, updateCallback, state, sample_data, graphType, setIdx, vars, extraSetIdx)
panel, updateCallback, state, sample_data, graphType, setIdx, vars, extraSetIdx, isFlagVisible)
%STATESELECTCALLBACK Called when the user interacts with the main
% window, by changing the state, the selected data set, the selected
% variables or the selected graph type.
Expand All @@ -127,6 +127,7 @@ function displayManager(windowTitle, sample_data, callbacks)
% setIdx - currently selected sample_data struct (index)
% vars - currently selected variables (indices).
% extraSetIdx - currently selected extra sample_data struct (index)
% isFlagVisible - currently selected visibility of flags (boolean)
%
% Outputs:
% state - If a state change was forced, tells the main window
Expand Down Expand Up @@ -335,12 +336,14 @@ function qcDataCallback()

[graphs, lines, vars] = graphFunc(panel, sample_data{setIdx}, vars, extra_sample_data);

if isempty(flagFunc)
warning(['Cannot display QC flags using ' graphType ...
'. Try a different graph type.']);
return;
else
flags = flagFunc( panel, graphs, sample_data{setIdx}, vars);
if isFlagVisible
if isempty(flagFunc)
warning(['Cannot display QC flags using ' graphType ...
'. Try a different graph type.']);
return;
else
flags = flagFunc( panel, graphs, sample_data{setIdx}, vars);
end
end

catch e
Expand Down Expand Up @@ -477,8 +480,10 @@ function dataSelectCallback(ax, type, range)
updateCallback(sample_data{setIdx});

% update graph
if ~isempty(flags), delete(flags(flags ~= 0)); end
flags = flagFunc(panel, graphs, sample_data{setIdx}, vars);
if isFlagVisible
if ~isempty(flags), delete(flags(flags ~= 0)); end
flags = flagFunc(panel, graphs, sample_data{setIdx}, vars);
end

% write/update manual QC file for this dataset
mqcFile = [sample_data{setIdx}.toolbox_input_file, '.mqc'];
Expand Down
31 changes: 27 additions & 4 deletions GUI/mainWindow.m
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ function mainWindow(windowTitle, sample_data, states, startState, selectionCallb
% extra instrument check box
extraSampleCb = uicontrol(...
'Style', 'checkbox',...
'String', 'Graph extra instrument (black)',...
'String', 'Graph extra instrument good data only (black)',...
'Value', 0,...
'Tag', 'extraSampleCheckBox');

Expand All @@ -139,6 +139,20 @@ function mainWindow(windowTitle, sample_data, states, startState, selectionCallb
'Enable', 'off',...
'Tag', 'extraSamplePopUpMenu');

% flag visibility check box
visiFlagCb = uicontrol(...
'Style', 'checkbox',...
'String', 'Show data flag if any',...
'Value', 1,...
'Tag', 'visiFlagCheckBox');

% bad data visibility check box
visiBadCb = uicontrol(...
'Style', 'checkbox',...
'String', 'Hide bad data',...
'Value', 0,...
'Tag', 'visiBadCheckBox');

% side panel
sidePanel = uipanel(...
'Parent', fig,...
Expand Down Expand Up @@ -181,6 +195,8 @@ function mainWindow(windowTitle, sample_data, states, startState, selectionCallb
set(graphMenu, 'Units', 'normalized');
set(extraSampleCb, 'Units', 'normalized');
set(extraSampleMenu, 'Units', 'normalized');
set(visiFlagCb, 'Units', 'normalized');
set(visiBadCb, 'Units', 'normalized');
set(stateButtons, 'Units', 'normalized');

% set window position
Expand All @@ -198,12 +214,14 @@ function mainWindow(windowTitle, sample_data, states, startState, selectionCallb
set(fig, 'Units', 'normalized');

% set widget positions
set(sidePanel, 'Position', posUi2(fig, 100, 100, 11:100, 1:10, 0));
set(mainPanel, 'Position', posUi2(fig, 100, 100, 11:100, 11:100, 0));
set(sidePanel, 'Position', posUi2(fig, 100, 100, 16:100, 1:10, 0));
set(mainPanel, 'Position', posUi2(fig, 100, 100, 16:100, 11:100, 0));
set(sampleMenu, 'Position', posUi2(fig, 100, 100, 1:5, 1:75, 0));
set(graphMenu, 'Position', posUi2(fig, 100, 100, 1:5, 76:100, 0));
set(extraSampleMenu, 'Position', posUi2(fig, 100, 100, 6:10, 1:75, 0));
set(extraSampleCb, 'Position', posUi2(fig, 100, 100, 6:10, 76:100, 0));
set(visiFlagCb, 'Position', posUi2(fig, 100, 100, 11:15, 76:100, 0));
set(visiBadCb, 'Position', posUi2(fig, 100, 100, 11:15, 51:75, 0));

% varPanel and butPanel are positioned relative to sidePanel
set(butPanel, 'Position', posUi2(sidePanel, 10, 1, 1:5, 1, 0));
Expand All @@ -221,6 +239,8 @@ function mainWindow(windowTitle, sample_data, states, startState, selectionCallb
set(graphMenu, 'Callback', @graphMenuCallback);
set(extraSampleCb, 'Callback', @sampleMenuCallback);
set(extraSampleMenu, 'Callback', @sampleMenuCallback);
set(visiFlagCb, 'Callback', @sampleMenuCallback);
set(visiBadCb, 'Callback', @sampleMenuCallback);
set(stateButtons, 'Callback', @stateButtonCallback);

set(fig, 'Visible', 'on');
Expand Down Expand Up @@ -342,6 +362,8 @@ function selectionChange(event)
extraSam.meta.index = 0;
end

isFlagVisible = get(visiFlagCb, 'value');

% clear main panel
children = get(mainPanel, 'Children');
delete(children);
Expand All @@ -362,7 +384,8 @@ function selectionChange(event)
graph, ... % currently selected graph type (string).
sam.meta.index, ... % currently selected sample_data struct (index)
vars, ... % currently selected variables (indices).
extraSam.meta.index); % currently selected extra sample_data struct (index)
extraSam.meta.index, ...% currently selected extra sample_data struct (index)
isFlagVisible); % currently selected visibility of flags (boolean)

% set data cursor mode custom display
dcm_obj = datacursormode(fig);
Expand Down
17 changes: 13 additions & 4 deletions Graph/DepthProfile/flagDepthProfileGeneric.m
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,16 @@
if ~isnumeric(var), error('var must be numeric'); end

qcSet = str2double(readProperty('toolbox.qc_set'));
rawFlag = imosQCFlag('raw', qcSet, 'flag');
noDisplayFlag = imosQCFlag('raw', qcSet, 'flag'); % raw flags are not displayed by default

visiBadCbh = findobj('Tag', 'visiBadCheckBox');
isBadHidden = get(visiBadCbh, 'value');
if isBadHidden
% we add bad flags to the list of flags not to be displayed
noDisplayFlag = [noDisplayFlag, ...
imosQCFlag('probablyBad', qcSet, 'flag'), ...
imosQCFlag('bad', qcSet, 'flag')];
end

% get the toolbox execution mode
mode = readProperty('toolbox.mode');
Expand Down Expand Up @@ -76,9 +85,9 @@
% get a list of the different flag types to be graphed
flagTypes = unique(fl);

% don't display raw data flags
iRawFlag = (flagTypes == rawFlag);
if any(iRawFlag), flagTypes(iRawFlag) = []; end
% don't display specific flags
iNoDisplayFlag = ismember(flagTypes, noDisplayFlag);
if any(iNoDisplayFlag), flagTypes(iNoDisplayFlag) = []; end

lenFlag = length(flagTypes);

Expand Down
14 changes: 14 additions & 0 deletions Graph/DepthProfile/graphDepthProfileGeneric.m
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,20 @@

var = sample_data.variables{var};

visiBadCbh = findobj('Tag', 'visiBadCheckBox');
isBadHidden = get(visiBadCbh, 'value');
if isBadHidden
% we replace values flagged as bad by NaN before plotting
qcSet = str2double(readProperty('toolbox.qc_set'));
rawFlag = imosQCFlag('raw', qcSet, 'flag');
goodFlag = imosQCFlag('good', qcSet, 'flag');
probGoodFlag = imosQCFlag('probablyGood', qcSet, 'flag');

iGood = ismember(var.flags, [rawFlag, goodFlag, probGoodFlag]);

var.data(~iGood) = NaN;
end

switch mode
case 'profile'
h = line(var.data(:, 1), depth.data(:, 1), 'Parent', ax, 'LineStyle', '-', 'Color', color); % downcast
Expand Down
17 changes: 13 additions & 4 deletions Graph/TimeSeries/flagTimeSeriesGeneric.m
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,16 @@
if ~isnumeric(var), error('var must be numeric'); end

qcSet = str2double(readProperty('toolbox.qc_set'));
rawFlag = imosQCFlag('raw', qcSet, 'flag');
noDisplayFlag = imosQCFlag('raw', qcSet, 'flag'); % raw flags are not displayed by default

visiBadCbh = findobj('Tag', 'visiBadCheckBox');
isBadHidden = get(visiBadCbh, 'value');
if isBadHidden
% we add bad flags to the list of flags not to be displayed
noDisplayFlag = [noDisplayFlag, ...
imosQCFlag('probablyBad', qcSet, 'flag'), ...
imosQCFlag('bad', qcSet, 'flag')];
end

iTimeDim = getVar(sample_data.dimensions, 'TIME');
time = sample_data.dimensions{iTimeDim};
Expand All @@ -55,9 +64,9 @@
% get a list of the different flag types to be graphed
flagTypes = unique(fl);

% don't display raw data flags
iRawFlag = (flagTypes == rawFlag);
if any(iRawFlag), flagTypes(iRawFlag) = []; end
% don't display specific flags
iNoDisplayFlag = ismember(flagTypes, noDisplayFlag);
if any(iNoDisplayFlag), flagTypes(iNoDisplayFlag) = []; end

lenFlag = length(flagTypes);

Expand Down
17 changes: 13 additions & 4 deletions Graph/TimeSeries/flagTimeSeriesTimeDepth.m
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,16 @@
if ~isnumeric(var), error('var must be numeric'); end

qcSet = str2double(readProperty('toolbox.qc_set'));
rawFlag = imosQCFlag('raw', qcSet, 'flag');
noDisplayFlag = imosQCFlag('raw', qcSet, 'flag'); % raw flags are not displayed by default

visiBadCbh = findobj('Tag', 'visiBadCheckBox');
isBadHidden = get(visiBadCbh, 'value');
if isBadHidden
% we add bad flags to the list of flags not to be displayed
noDisplayFlag = [noDisplayFlag, ...
imosQCFlag('probablyBad', qcSet, 'flag'), ...
imosQCFlag('bad', qcSet, 'flag')];
end

iTimeDim = getVar(sample_data.dimensions, 'TIME');
depth = sample_data.variables{var}.dimensions(2);
Expand All @@ -55,9 +64,9 @@
% get a list of the different flag types to be graphed
flagTypes = unique(fl);

% don't display raw data flags
iRawFlag = (flagTypes == rawFlag);
if any(iRawFlag), flagTypes(iRawFlag) = []; end
% don't display specific flags
iNoDisplayFlag = ismember(flagTypes, noDisplayFlag);
if any(iNoDisplayFlag), flagTypes(iNoDisplayFlag) = []; end

lenFlag = length(flagTypes);

Expand Down
17 changes: 13 additions & 4 deletions Graph/TimeSeries/flagTimeSeriesTimeFrequency.m
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,16 @@
if ~isnumeric(var), error('var must be numeric'); end

qcSet = str2double(readProperty('toolbox.qc_set'));
rawFlag = imosQCFlag('raw', qcSet, 'flag');
noDisplayFlag = imosQCFlag('raw', qcSet, 'flag'); % raw flags are not displayed by default

visiBadCbh = findobj('Tag', 'visiBadCheckBox');
isBadHidden = get(visiBadCbh, 'value');
if isBadHidden
% we add bad flags to the list of flags not to be displayed
noDisplayFlag = [noDisplayFlag, ...
imosQCFlag('probablyBad', qcSet, 'flag'), ...
imosQCFlag('bad', qcSet, 'flag')];
end

iTimeDim = getVar(sample_data.dimensions, 'TIME');
freq = sample_data.variables{var}.dimensions(2);
Expand All @@ -55,9 +64,9 @@
% get a list of the different flag types to be graphed
flagTypes = unique(fl);

% don't display raw data flags
iRawFlag = (flagTypes == rawFlag);
if any(iRawFlag), flagTypes(iRawFlag) = []; end
% don't display specific flags
iNoDisplayFlag = ismember(flagTypes, noDisplayFlag);
if any(iNoDisplayFlag), flagTypes(iNoDisplayFlag) = []; end

lenFlag = length(flagTypes);

Expand Down
17 changes: 13 additions & 4 deletions Graph/TimeSeries/flagTimeSeriesTimeFrequencyDirection.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,16 @@
if ~isnumeric(var), error('var must be numeric'); end

qcSet = str2double(readProperty('toolbox.qc_set'));
rawFlag = imosQCFlag('raw', qcSet, 'flag');
noDisplayFlag = imosQCFlag('raw', qcSet, 'flag'); % raw flags are not displayed by default

visiBadCbh = findobj('Tag', 'visiBadCheckBox');
isBadHidden = get(visiBadCbh, 'value');
if isBadHidden
% we add bad flags to the list of flags not to be displayed
noDisplayFlag = [noDisplayFlag, ...
imosQCFlag('probablyBad', qcSet, 'flag'), ...
imosQCFlag('bad', qcSet, 'flag')];
end

freq = sample_data.variables{var}.dimensions(2);
dir = sample_data.variables{var}.dimensions(3);
Expand All @@ -67,9 +76,9 @@
% get a list of the different flag types to be graphed
flagTypes = unique(sswvFlags);

% don't display raw data flags
iRawFlag = (flagTypes == rawFlag);
if any(iRawFlag), flagTypes(iRawFlag) = []; end
% don't display specific flags
iNoDisplayFlag = ismember(flagTypes, noDisplayFlag);
if any(iNoDisplayFlag), flagTypes(iNoDisplayFlag) = []; end

lenFlag = length(flagTypes);

Expand Down
14 changes: 14 additions & 0 deletions Graph/TimeSeries/graphTimeSeriesGeneric.m
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,20 @@

if ischar(var.data), var.data = str2num(var.data); end % we assume data is an array of one single character

visiBadCbh = findobj('Tag', 'visiBadCheckBox');
isBadHidden = get(visiBadCbh, 'value');
if isBadHidden
% we replace values flagged as bad by NaN before plotting
qcSet = str2double(readProperty('toolbox.qc_set'));
rawFlag = imosQCFlag('raw', qcSet, 'flag');
goodFlag = imosQCFlag('good', qcSet, 'flag');
probGoodFlag = imosQCFlag('probablyGood', qcSet, 'flag');

iGood = ismember(var.flags, [rawFlag, goodFlag, probGoodFlag]);

var.data(~iGood) = NaN;
end

h = line(time.data, var.data, 'Parent', ax, 'Color', color);
set(ax, 'Tag', 'axis1D');

Expand Down
14 changes: 14 additions & 0 deletions Graph/TimeSeries/graphTimeSeriesTimeDepth.m
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,20 @@
depth = sample_data.dimensions{depth};
var = sample_data.variables {var};

visiBadCbh = findobj('Tag', 'visiBadCheckBox');
isBadHidden = get(visiBadCbh, 'value');
if isBadHidden
% we replace values flagged as bad by NaN before plotting
qcSet = str2double(readProperty('toolbox.qc_set'));
rawFlag = imosQCFlag('raw', qcSet, 'flag');
goodFlag = imosQCFlag('good', qcSet, 'flag');
probGoodFlag = imosQCFlag('probablyGood', qcSet, 'flag');

iGood = ismember(var.flags, [rawFlag, goodFlag, probGoodFlag]);

var.data(~iGood) = NaN;
end

xPcolor = time.data;
yPcolor = depth.data;

Expand Down
14 changes: 14 additions & 0 deletions Graph/TimeSeries/graphTimeSeriesTimeFrequency.m
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,20 @@
freq = sample_data.dimensions{freq};
var = sample_data.variables {var};

visiBadCbh = findobj('Tag', 'visiBadCheckBox');
isBadHidden = get(visiBadCbh, 'value');
if isBadHidden
% we replace values flagged as bad by NaN before plotting
qcSet = str2double(readProperty('toolbox.qc_set'));
rawFlag = imosQCFlag('raw', qcSet, 'flag');
goodFlag = imosQCFlag('good', qcSet, 'flag');
probGoodFlag = imosQCFlag('probablyGood', qcSet, 'flag');

iGood = ismember(var.flags, [rawFlag, goodFlag, probGoodFlag]);

var.data(~iGood) = NaN;
end

xPcolor = time.data;
yPcolor = freq.data;

Expand Down
Loading

0 comments on commit bde9388

Please sign in to comment.