Skip to content

Commit

Permalink
Merge pull request #501 from aodn/2.5.38
Browse files Browse the repository at this point in the history
2.5.38
  • Loading branch information
ggalibert authored Apr 19, 2018
2 parents a0eb1a5 + e29ac0d commit d8ad331
Show file tree
Hide file tree
Showing 25 changed files with 86 additions and 103 deletions.
3 changes: 1 addition & 2 deletions AutomaticQC/imosDensityInversionSetQC.m
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
% read dataset QC parameters if exist and override previous parameters file
currentQCtest = mfilename;
threshold = readDatasetParameter(sample_data.toolbox_input_file, currentQCtest, 'threshold', 0.03); % default threshold value of 0.03kg/m3
threshold = threshold(1); % fix for compatibility with previous version 2.5.37 and older that used to unnecessarily store an array of thresholds

qcSet = str2double(readProperty('toolbox.qc_set'));
rawFlag = imosQCFlag('raw', qcSet, 'flag');
Expand Down Expand Up @@ -142,8 +143,6 @@
deltaUpBottom = [rhoPotI - rhoPotIp1; NaN];
deltaBottomUp = [NaN; rhoPotIp1 - rhoPotI];

threshold = ones(lenDataTested, 1) .* threshold;

iDensInv = deltaUpBottom >= threshold | deltaBottomUp <= -threshold;

flagsTested(iDensInv) = badFlag;
Expand Down
5 changes: 1 addition & 4 deletions AutomaticQC/imosImpossibleDateQC.m
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,7 @@
end

if any(~iGoodTime)
disp(['Warning : ' num2str(sum(~iGoodTime)) ' points failed Impossible date QC test in file ' sample_data.toolbox_input_file]);
end
if all(~iGoodTime)
error('All points failed');
error([num2str(sum(~iGoodTime)) ' points failed Impossible date QC test in file ' sample_data.toolbox_input_file '. Try to re-play and fix this dataset when possible using the manufacturer''s software before processing it with the toolbox.']);
end

% write/update dataset QC parameters
Expand Down
4 changes: 3 additions & 1 deletion FlowManager/exportManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,9 @@ function exportQCPlots(sample_data, exportDir, mode, auto, progress)

case 'profile'
% profile specific plots
lineCastVar(sample_data, paramsName, true, true, exportDir);
for i=1:length(sample_data) % we only want one figure per profile for better readability
lineCastVar(sample_data(i), paramsName, true, true, exportDir);
end

end
catch e
Expand Down
32 changes: 19 additions & 13 deletions GUI/mainWindow.m
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,12 @@ function mainWindow(windowTitle, sample_data, states, startState, selectionCallb
sampleDataDescs{k} = genSampleDataDesc(sample_data{k});
end

backgroundPlotColor = [1 1 1]; % white

% window figure
fig = figure(...
'Name', windowTitle, ...
'Visible', 'off',...
'Color', [0.75 0.75 0.75],...
'MenuBar', 'none',...
'ToolBar', 'figure',...
'Resize', 'on',...
Expand Down Expand Up @@ -165,9 +166,10 @@ function mainWindow(windowTitle, sample_data, states, startState, selectionCallb

% main display
mainPanel = uipanel(...
'Parent', fig,...
'BorderType', 'none',...
'Tag', 'mainPanel');
'BackgroundColor', backgroundPlotColor,...
'BorderType', 'none',...
'Parent', fig,...
'Tag', 'mainPanel');

% use normalized units
set(fig, 'Units', 'normalized');
Expand Down Expand Up @@ -304,7 +306,7 @@ function mainWindow(windowTitle, sample_data, states, startState, selectionCallb
set(hToolsDiagram2DCommonVarDepthNonQC, 'callBack', {@displayDiagramMooringVar, false, false, 'DEPTH'});
set(hToolsDiagram2DCommonVarDepthQC, 'callBack', {@displayDiagramMooringVar, true, false, 'DEPTH'});
case 'profile'
hToolsLineCastVar = uimenu(hToolsMenu, 'label', '1D variable vs DEPTH profile line plot');
hToolsLineCastVar = uimenu(hToolsMenu, 'label', '1D variable vs DEPTH selected profile line plot');
hToolsLineCastVarNonQC = uimenu(hToolsLineCastVar, 'label', 'all data');
hToolsLineCastVarQC = uimenu(hToolsLineCastVar, 'label', 'only good and non QC''d data');

Expand Down Expand Up @@ -648,29 +650,33 @@ function disableZoomAndPan(source, ev)

function displayLineCastVar(source, ev, isQC)
%DISPLAYLINECASTVAR Opens a new window where all the
% variables collected by the CTD cast are line-plotted in a profile plot.
% variables collected by the currently selected CTD cast are line-plotted in a profile plot.
%

% only currently selected profile for better readability
iSampleMenu = get(sampleMenu, 'Value');
sam = sample_data(iSampleMenu);

% get all params names
lenSampleData = length(sample_data);
lenSampleData = length(sam);
paramsName = {};
for i=1:lenSampleData
lenParamsSample = length(sample_data{i}.variables);
lenParamsSample = length(sam{i}.variables);
for j=1:lenParamsSample
isParamQC = any(sample_data{i}.variables{j}.flags == 1) || any(sample_data{i}.variables{j}.flags == 2);
isParamQC = any(sam{i}.variables{j}.flags == 1) || any(sam{i}.variables{j}.flags == 2);
if i==1 && j==1
paramsName{1} = sample_data{1}.variables{1}.name;
paramsName{1} = sam{1}.variables{1}.name;
else
sameParam = strcmpi(paramsName, sample_data{i}.variables{j}.name);
sameParam = strcmpi(paramsName, sam{i}.variables{j}.name);
if ~any(sameParam)
paramsName{end+1} = sample_data{i}.variables{j}.name;
paramsName{end+1} = sam{i}.variables{j}.name;
end
end
% get rid of non QC'd params if only interested in QC
if isQC && ~isParamQC; paramsName(end) = []; end
end
end
lineCastVar(sample_data, paramsName, isQC, false, '');
lineCastVar(sam, paramsName, isQC, false, '');
end

function displayScatterMooringVar(source, ev, isQC, is1D)
Expand Down
4 changes: 2 additions & 2 deletions Graph/DepthProfile/graphDepthProfileGeneric.m
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@
end
end

% set background to be grey
set(ax, 'Color', [0.85 0.85 0.85])
% set background to be transparent (same as figure background)
set(ax, 'Color', 'none')

labels = {var.name, 'DEPTH'};

Expand Down
4 changes: 2 additions & 2 deletions Graph/DepthProfile/highlightDepthProfileGeneric.m
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,6 @@
'Parent', gca, ...
'LineStyle', 'none', ...
'Marker', 'o', ...
'MarkerEdgeColor', 'white', ...
'MarkerFaceColor', 'white');
'MarkerEdgeColor', 'black', ...
'MarkerFaceColor', 'black');
end
4 changes: 2 additions & 2 deletions Graph/TimeSeries/graphTimeSeriesGeneric.m
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@
end
end

% set background to be grey
set(ax, 'Color', [0.85 0.85 0.85])
% set background to be transparent (same as background color)
set(ax, 'Color', 'none')

if strncmp(var.name, 'DEPTH', 4) || strncmp(var.name, 'PRES', 4) || strncmp(var.name, 'PRES_REL', 8)
set(ax, 'YDir', 'reverse');
Expand Down
4 changes: 2 additions & 2 deletions Graph/TimeSeries/graphTimeSeriesTimeDepth.m
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@
if length(cbLabel) > 20, cbLabel = [cbLabel(1:17) '...']; end
set(get(cb, 'YLabel'), 'String', cbLabel, 'Interpreter', 'none');

% set background to be grey
set(ax, 'Color', [0.75 0.75 0.75])
% set background to be light grey (colorbar can include white color)
set(ax, 'Color', [0.85 0.85 0.85])

labels = {time.name, depth.name};

Expand Down
4 changes: 2 additions & 2 deletions Graph/TimeSeries/graphTimeSeriesTimeFrequency.m
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@
if length(cbLabel) > 20, cbLabel = [cbLabel(1:17) '...']; end
set(get(cb, 'YLabel'), 'String', cbLabel, 'Interpreter', 'none');

% set background to be grey
set(ax, 'Color', [0.75 0.75 0.75])
% set background to be light grey (colorbar can include white color)
set(ax, 'Color', [0.85 0.85 0.85])

labels = {time.name, freq.name};

Expand Down
4 changes: 2 additions & 2 deletions Graph/TimeSeries/graphTimeSeriesTimeFrequencyDirection.m
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@
if length(cbLabel) > 20, cbLabel = [cbLabel(1:17) '...']; end
set(get(cb, 'YLabel'), 'String', cbLabel, 'Interpreter', 'none');

% set background to be grey
set(ax, 'Color', [0.75 0.75 0.75])
% set background to be light grey (colorbar can include white color)
set(ax, 'Color', [0.85 0.85 0.85])

labels = {};

Expand Down
4 changes: 2 additions & 2 deletions Graph/TimeSeries/highlightTimeSeriesGeneric.m
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,6 @@
'Parent', gca, ...
'LineStyle', 'none', ...
'Marker', 'o', ...
'MarkerEdgeColor', 'white', ...
'MarkerFaceColor', 'white');
'MarkerEdgeColor', 'black', ...
'MarkerFaceColor', 'black');
end
4 changes: 2 additions & 2 deletions Graph/TimeSeries/highlightTimeSeriesTimeDepth.m
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
'Parent', gca, ...
'LineStyle', 'none', ...
'Marker', 'o', ...
'MarkerEdgeColor', 'white', ...
'MarkerFaceColor', 'white', ...
'MarkerEdgeColor', 'black', ...
'MarkerFaceColor', 'black', ...
'MarkerSize', 3);
end
4 changes: 2 additions & 2 deletions Graph/TimeSeries/highlightTimeSeriesTimeFrequencyDirection.m
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
'Parent', gca, ...
'LineStyle', 'none', ...
'Marker', 'o', ...
'MarkerEdgeColor', 'white', ...
'MarkerFaceColor', 'white', ...
'MarkerEdgeColor', 'black', ...
'MarkerFaceColor', 'black', ...
'MarkerSize', 3);
end
2 changes: 1 addition & 1 deletion Graph/TimeSeries/selectTimeSeriesGeneric.m
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ function buttonDown(source,ev)
rect = rectangle(...
'Parent', gca,...
'Position', rectPos,...
'EdgeColor', [1 1 1],...
'EdgeColor', 'black',...
'LineStyle', '--',...
'LineWidth', 0.25);

Expand Down
4 changes: 2 additions & 2 deletions Graph/Transect/graphTransectGeneric.m
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
if length(cbLabel) > 20, cbLabel = [cbLabel(1:17) '...']; end
set(get(cb, 'YLabel'), 'String', cbLabel, 'Interpreter', 'none');

% set background to be grey
set(ax, 'Color', [0.85 0.85 0.85])
% set background to be transparent (same as background color)
set(ax, 'Color', 'none')

labels = {'LATITUDE', 'LONGITUDE'};
4 changes: 2 additions & 2 deletions Graph/XvY/graphXvYGeneric.m
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
end
end

% set background to be grey
set(ax, 'Color', [0.85 0.85 0.85])
% set background to be transparent (same as background color)
set(ax, 'Color', 'none')

labels = {sample_data.variables{vars(1)}.name, sample_data.variables{vars(2)}.name};
39 changes: 6 additions & 33 deletions Graph/checkMooringPlannedDepths.m
Original file line number Diff line number Diff line change
Expand Up @@ -313,39 +313,12 @@ function checkMooringPlannedDepths(sample_data, isQC, saveToFile, exportDir)
for i = 1:lenMetaDepth
avgDep(i) = median(dataVar(i, ~iNaN(i, :)));

if fastScatter
% for performance, we use plot (1 single handle object
% returned) rather than scatter (as many handles returned as
% points to plot). We plot as many subsets of the total amount
% of points as we want colors to be displayed. This is
% performed by the function plotclr.

% !!! The result is such that the overlapping of points is dictated by
% the order of the colors to be plotted and not by the X axis order (from
% first to last) of the total points given. We choose an ordering from
% centre to both ends of colorbar in order to keep extreme colors visible
% though.

plotclr(hAxDepthDiff, ...
metaDepth(i), ...
avgDep(i) - metaDepth(i), ...
metaDepth(i), ...
'o', ...
[min(metaDepth) max(metaDepth)], ...
'Color', cMap(i, :), ...
'MarkerFaceColor', cMap(i, :), ...
'MarkerSize', 2.5);
else
% faster than scatter, but legend requires adjusting
fastScatterMesh(hAxDepthDiff, ...
metaDepth(i), ...
avgDep(i) - metaDepth(i), ...
metaDepth(i), ...
[min(metaDepth) max(metaDepth)], ...
'Marker', 'o', ...
'FaceColor', cMap(i, :), ...
'MarkerSize', 2.5);
end
scatter(hAxDepthDiff, ...
metaDepth(i), ...
avgDep(i) - metaDepth(i), ...
[], ...
cMap(i, :), ...
'filled');
end

instrumentDesc(1) = [];
Expand Down
12 changes: 6 additions & 6 deletions Graph/pcolorMooring2DVar.m
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ function pcolorMooring2DVar(sample_data, varName, isQC, saveToFile, exportDir)

initiateFigure = true;

backgroundColor = [0.85 0.85 0.85]; % light grey to allow for colorbar with white
backgroundFigure = [1 1 1]; % white
backgroundAxis = [0.85 0.85 0.85]; % light grey to allow for colorbar with white

for i=1:lenSampleData
% instrument description
Expand Down Expand Up @@ -146,7 +147,7 @@ function pcolorMooring2DVar(sample_data, varName, isQC, saveToFile, exportDir)
'Name', title, ...
'NumberTitle', 'off', ...
'Visible', visible, ...
'Color', backgroundColor, ...
'Color', backgroundFigure, ...
'OuterPosition', monitorRect(iBigMonitor, :));

hAxMooringVar = axes('Parent', hFigMooringVar);
Expand Down Expand Up @@ -227,9 +228,8 @@ function pcolorMooring2DVar(sample_data, varName, isQC, saveToFile, exportDir)

set(get(hCBar, 'Title'), 'String', [varName ' (' varUnit ')'], 'Interpreter', 'none');

% set axes background to be transparent (figure color shows
% through)
set(hAxMooringVar, 'Color', 'none')
% set axes background
set(hAxMooringVar, 'Color', backgroundAxis)
end
end
end
Expand All @@ -247,7 +247,7 @@ function pcolorMooring2DVar(sample_data, varName, isQC, saveToFile, exportDir)
fileName = strrep(fileName, '_PARAM_', ['_', varName, '_']); % IMOS_[sub-facility_code]_[site_code]_FV01_[deployment_code]_[PLOT-TYPE]_[PARAM]_C-[creation_date].png
fileName = strrep(fileName, '_PLOT-TYPE_', '_PCOLOR_');

fastSaveas(hFigMooringVar, backgroundColor, fullfile(exportDir, fileName));
fastSaveas(hFigMooringVar, backgroundFigure, fullfile(exportDir, fileName));

close(hFigMooringVar);
end
Expand Down
18 changes: 8 additions & 10 deletions Graph/scatterMooring2DVarAgainstDepth.m
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@ function scatterMooring2DVarAgainstDepth(sample_data, varName, isQC, saveToFile,
end
end

backgroundColor = [0.85 0.85 0.85]; % light grey to allow for colorbar with white
backgroundFigure = [1 1 1]; % white
backgroundAxis = [0.85 0.85 0.85]; % light grey to allow for colorbar with white

if any(isPlottable)
% collect visualQC config
Expand Down Expand Up @@ -246,7 +247,7 @@ function scatterMooring2DVarAgainstDepth(sample_data, varName, isQC, saveToFile,
'Name', title, ...
'NumberTitle', 'off', ...
'Visible', visible, ...
'Color', backgroundColor, ...
'Color', backgroundFigure, ...
'OuterPosition', monitorRect(iBigMonitor, :));

hAxMooringVar = axes('Parent', hFigMooringVar);
Expand All @@ -260,7 +261,7 @@ function scatterMooring2DVarAgainstDepth(sample_data, varName, isQC, saveToFile,
hold(hAxMooringVar, 'on');

% dummy entry for first entry in legend
hScatterVar(1) = plot(0, 0, 'Color', backgroundColor, 'Visible', 'off'); % color same as background (invisible in legend)
hScatterVar(1) = plot(0, 0, 'Color', backgroundAxis, 'Visible', 'off'); % color same as background (invisible in legend)

% set data cursor mode custom display
dcm_obj = datacursormode(hFigMooringVar);
Expand Down Expand Up @@ -403,9 +404,8 @@ function scatterMooring2DVarAgainstDepth(sample_data, varName, isQC, saveToFile,
'YGrid', 'on', ...
'Layer', 'top');

% set axes background to be transparent (figure color shows
% through)
set(hAxMooringVar, 'Color', 'none')
% set axes background
set(hAxMooringVar, 'Color', backgroundAxis)
end

% we plot the instrument nominal depth
Expand Down Expand Up @@ -468,7 +468,7 @@ function scatterMooring2DVarAgainstDepth(sample_data, varName, isQC, saveToFile,
end
end
posAx = get(hAxMooringVar, 'Position');
set(hLegend, 'Units', 'Normalized', 'Color', 'none')
set(hLegend, 'Units', 'Normalized', 'Color', backgroundAxis)
posLh = get(hLegend, 'Position');
if posLh(2) < 0
set(hLegend, 'Position',[posLh(1), abs(posLh(2)), posLh(3), posLh(4)]);
Expand All @@ -477,13 +477,11 @@ function scatterMooring2DVarAgainstDepth(sample_data, varName, isQC, saveToFile,
set(hAxMooringVar, 'Position',[posAx(1), posAx(2)+abs(posLh(2)), posAx(3), posAx(4)-abs(posLh(2))]);
end

% set(hLegend, 'Box', 'off', 'Color', 'none');

if saveToFile
fileName = strrep(fileName, '_PARAM_', ['_', varName, '_']); % IMOS_[sub-facility_code]_[site_code]_FV01_[deployment_code]_[PLOT-TYPE]_[PARAM]_C-[creation_date].png
fileName = strrep(fileName, '_PLOT-TYPE_', '_SCATTER_');

fastSaveas(hFigMooringVar, backgroundColor, fullfile(exportDir, fileName));
fastSaveas(hFigMooringVar, backgroundFigure, fullfile(exportDir, fileName));

close(hFigMooringVar);
end
Expand Down
Loading

0 comments on commit d8ad331

Please sign in to comment.