Skip to content

Commit

Permalink
Merge pull request #497 from aodn/2.5.37
Browse files Browse the repository at this point in the history
2.5.37
  • Loading branch information
ggalibert authored Mar 22, 2018
2 parents 8d7823e + 0b0d6d0 commit a0eb1a5
Show file tree
Hide file tree
Showing 21 changed files with 164 additions and 106 deletions.
16 changes: 9 additions & 7 deletions Graph/checkMooringPlannedDepths.m
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function checkMooringPlannedDepths(sample_data, isQC, saveToFile, exportDir)
timeVar = dataVar;
isPlottable = false;

backgroundColor = [0.85 0.85 0.85];
backgroundColor = [1 1 1]; % white

for i=1:lenSampleData
%only look at instruments with pressure
Expand Down Expand Up @@ -184,6 +184,7 @@ function checkMooringPlannedDepths(sample_data, isQC, saveToFile, exportDir)
'Name', title, ...
'NumberTitle', 'off', ...
'Visible', visible, ...
'Color', backgroundColor, ...
'OuterPosition', monitorRect(iBigMonitor, :));

hAxPress = subplot(2,1,1,'Parent', hFigPress);
Expand All @@ -206,9 +207,10 @@ function checkMooringPlannedDepths(sample_data, isQC, saveToFile, exportDir)
hold(hAxDepthDiff, 'on');
grid(hAxDepthDiff, 'on');

% set background to be grey
set(hAxPress, 'Color', backgroundColor);
set(hAxDepthDiff, 'Color', backgroundColor);
% set axes background to be transparent (figure color shows
% through)
set(hAxPress, 'Color', 'none');
set(hAxDepthDiff, 'Color', 'none');

%color map
lenMetaDepth = length(metaDepth);
Expand All @@ -222,7 +224,7 @@ function checkMooringPlannedDepths(sample_data, isQC, saveToFile, exportDir)
cMap = flipud(cMap);

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

%now plot the data:Have to do it one at a time to get the colors right..
for i = 1:lenMetaDepth
Expand Down Expand Up @@ -272,7 +274,7 @@ function checkMooringPlannedDepths(sample_data, isQC, saveToFile, exportDir)
'FontSize', fontSizeAx,...
'xscale', xscale);
posAx = get(hAxPress, 'Position');
set(hLegend, 'Units', 'Normalized', 'color', backgroundColor);
set(hLegend, 'Units', 'Normalized', 'Color', 'none');

% for some reason this call brings everything back together while it
% shouldn't have moved previously anyway...
Expand Down Expand Up @@ -355,7 +357,7 @@ function checkMooringPlannedDepths(sample_data, isQC, saveToFile, exportDir)
fileName = strrep(fileName, '_PARAM_', '_DEPTH_vs_NOMINAL_DEPTH_'); % IMOS_[sub-facility_code]_[site_code]_FV01_[deployment_code]_[PLOT-TYPE]_[PARAM]_C-[creation_date].png
fileName = strrep(fileName, '_PLOT-TYPE_', '_CHECK_');

fastSaveas(hFigPress, fullfile(exportDir, fileName));
fastSaveas(hFigPress, backgroundColor, fullfile(exportDir, fileName));

close(hFigPress);
end
Expand Down
43 changes: 19 additions & 24 deletions Graph/checkMooringPresDiffs.m
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ function checkMooringPresDiffs(sample_data, iSampleMenu, isQC, saveToFile, expor

isPlottable = false;

backgroundColor = [0.85 0.85 0.85];
backgroundColor = [1 1 1]; % white

%plot
fileName = genIMOSFileName(sample_data{iCurrSam}, 'png');
Expand All @@ -135,14 +135,15 @@ function checkMooringPresDiffs(sample_data, iSampleMenu, isQC, saveToFile, expor
'Name', title, ...
'NumberTitle', 'off', ...
'Visible', visible, ...
'Color', backgroundColor, ...
'OuterPosition', monitorRect(iBigMonitor, :));

%pressure plot
hAxPress = subplot(2,1,1,'Parent', hFigPressDiff);
set(hAxPress, 'YDir', 'reverse')
set(get(hAxPress, 'XLabel'), 'String', 'Time');
set(get(hAxPress, 'YLabel'), 'String', [presRelCode ' (' varUnit ')'], 'Interpreter', 'none');
set(get(hAxPress, 'Title'), 'String', [varTitle '( ' varUnit ')'], 'Interpreter', 'none');
set(get(hAxPress, 'Title'), 'String', [varTitle ' (' varUnit ')'], 'Interpreter', 'none');
set(hAxPress, 'XTick', (xMin:(xMax-xMin)/4:xMax));
set(hAxPress, 'XLim', [xMin, xMax]);
hold(hAxPress, 'on');
Expand All @@ -152,16 +153,13 @@ function checkMooringPresDiffs(sample_data, iSampleMenu, isQC, saveToFile, expor
set(get(hAxPressDiff, 'XLabel'), 'String', 'Time');
set(get(hAxPressDiff, 'YLabel'), 'String', ['Pressure differences (' varUnit ')'], 'Interpreter', 'none');
set(get(hAxPressDiff, 'Title'), 'String', ...
['Pressure differences in ' varUnit ' (minus respective median over 1st quarter) between ' instrumentDesc{iCurrSam} ' (in black above) and 4 (max) nearest neighbours'] , 'Interpreter', 'none');
['Pressure differences in ' varUnit ' (minus respective median over 1st quarter) between ' instrumentDesc{iCurrSam} ' (in black above) and 4 (when possible) nearest neighbours'] , 'Interpreter', 'none');
set(hAxPressDiff, 'XTick', (xMin:(xMax-xMin)/4:xMax));
set(hAxPressDiff, 'XLim', [xMin, xMax]);
hold(hAxPressDiff, 'on');

linkaxes([hAxPressDiff,hAxPress],'x')

%zero line
line([xMin, xMax], [0, 0], 'Color', 'black');

%now plot the data of interest:
iCurrTime = getVar(sample_data{iCurrSam}.dimensions, 'TIME');
curSamTime = sample_data{iCurrSam}.dimensions{iCurrTime}.data;
Expand Down Expand Up @@ -197,14 +195,17 @@ function checkMooringPresDiffs(sample_data, iSampleMenu, isQC, saveToFile, expor
nOthers = nOthersMax;
end

% put iOthers back in metaDepth order
iOthers = sort(iOthers);

%color map
% no need to reverse the colorbar since instruments are plotted from
% nearest (blue) to farthest (yellow)
% we reverse the colormap since we want close to bottom == blue while close
% to surface == yellow.
try
defaultColormapFh = str2func(readProperty('visualQC.defaultColormap'));
cMap = colormap(hAxPress, defaultColormapFh(nOthers));
cMap = flipud(colormap(hAxPress, defaultColormapFh(nOthers)));
catch e
cMap = colormap(hAxPress, parula(nOthers));
cMap = flipud(colormap(hAxPress, parula(nOthers)));
end
% current sample is black
cMap(iOthers == iCurrSam, :) = [0, 0, 0];
Expand Down Expand Up @@ -268,9 +269,10 @@ function checkMooringPresDiffs(sample_data, iSampleMenu, isQC, saveToFile, expor
'LineStyle', '-', ...
'Parent', hAxPressDiff);

% set background to be grey
set(hAxPress, 'Color', backgroundColor)
set(hAxPressDiff, 'Color', backgroundColor)
% set axes background to be transparent (figure color shows
% through)
set(hAxPress, 'Color', 'none')
set(hAxPressDiff, 'Color', 'none')
end
end

Expand All @@ -289,14 +291,7 @@ function checkMooringPresDiffs(sample_data, iSampleMenu, isQC, saveToFile, expor
'Layer', 'top');

if isPlottable
iOthersLogical = false(max(iOthers), 1);
iOthersLogical(iOthers) = true;
iNan = isnan(hLineVar);
if any(iNan)
hLineVar(iNan) = [];
instrumentDesc(iNan) = [];
iOthersLogical(iNan) = [];
end
instrumentDesc = instrumentDesc(iOthers);

datetick(hAxPressDiff, 'x', 'dd-mm-yy HH:MM:SS', 'keepticks');
datetick(hAxPress, 'x', 'dd-mm-yy HH:MM:SS', 'keepticks');
Expand All @@ -315,14 +310,14 @@ function checkMooringPresDiffs(sample_data, iSampleMenu, isQC, saveToFile, expor
xscale = 0.75;
end
hYBuffer = 1.1 * (2*(fontSizeAx + fontSizeLb));
hLegend = legendflex(hAxPress, instrumentDesc(iOthersLogical),...
hLegend = legendflex(hAxPress, instrumentDesc,...
'anchor', [6 2], ...
'buffer', [0 -hYBuffer], ...
'ncol', nCols,...
'FontSize', fontSizeAx,...
'xscale', xscale);
posAx = get(hAxPress, 'Position');
set(hLegend, 'Units', 'Normalized', 'color', backgroundColor);
set(hLegend, 'Units', 'Normalized', 'Color', 'none');

% for some reason this call brings everything back together while it
% shouldn't have moved previously anyway...
Expand All @@ -332,7 +327,7 @@ function checkMooringPresDiffs(sample_data, iSampleMenu, isQC, saveToFile, expor
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_', '_LINE_');

fastSaveas(hFigPressDiff, fullfile(exportDir, fileName));
fastSaveas(hFigPressDiff, backgroundColor, fullfile(exportDir, fileName));

close(hFigPressDiff);
end
Expand Down
16 changes: 9 additions & 7 deletions Graph/diagramMooring1DVarAgainstOther.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
function diagramMooring1DVarAgainstOther(sample_data, varName, yAxisVarName, isQC, saveToFile, exportDir)
%DIAGRAMMOORING1DVARAGAINSTOTHER Opens a new window where the selected 1D
% variable collected by all the intruments on the mooring are plotted in a digram plot.
% variable collected by all the intruments on the mooring are plotted in a diagram plot.
%
% Inputs:
% sample_data - cell array of structs containing the entire data set and dimension data.
Expand Down Expand Up @@ -169,7 +169,7 @@ function diagramMooring1DVarAgainstOther(sample_data, varName, yAxisVarName, isQ
end
end

backgroundColor = [0.85 0.85 0.85];
backgroundColor = [1 1 1]; % white

if any(isPlottable)
% collect visualQC config
Expand Down Expand Up @@ -210,6 +210,7 @@ function diagramMooring1DVarAgainstOther(sample_data, varName, yAxisVarName, isQ
'Name', title, ...
'NumberTitle', 'off', ...
'Visible', visible, ...
'Color', backgroundColor, ...
'OuterPosition', monitorRect(iBigMonitor, :));

hAxMooringVar = axes('Parent', hFigMooringVar);
Expand All @@ -224,7 +225,7 @@ function diagramMooring1DVarAgainstOther(sample_data, varName, yAxisVarName, isQ
hold(hAxMooringVar, 'on');

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

% set data cursor mode custom display
dcm_obj = datacursormode(hFigMooringVar);
Expand Down Expand Up @@ -349,8 +350,9 @@ function diagramMooring1DVarAgainstOther(sample_data, varName, yAxisVarName, isQ
'YGrid', 'on', ...
'Layer', 'top');

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

if strcmpi(yAxisVarName, 'DEPTH')
Expand Down Expand Up @@ -418,7 +420,7 @@ function diagramMooring1DVarAgainstOther(sample_data, varName, yAxisVarName, isQ
end
end
posAx = get(hAxMooringVar, 'Position');
set(hLegend, 'Units', 'Normalized', 'color', backgroundColor);
set(hLegend, 'Units', 'Normalized', 'Color', 'none');
posLh = get(hLegend, 'Position');
if posLh(2) < 0
set(hLegend, 'Position',[posLh(1), abs(posLh(2)), posLh(3), posLh(4)]);
Expand All @@ -440,7 +442,7 @@ function diagramMooring1DVarAgainstOther(sample_data, varName, yAxisVarName, isQ
fileName = strrep(fileName, '_PARAM_', ['_' varName '_vs_' yAxisVarName '_']); % IMOS_[sub-facility_code]_[site_code]_FV01_[deployment_code]_[PLOT-TYPE]_[PARAM]_vs_[OTHER-PARAM]_C-[creation_date].png
fileName = strrep(fileName, '_PLOT-TYPE_', '_DIAGRAM_');

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

close(hFigMooringVar);
end
Expand Down
14 changes: 8 additions & 6 deletions Graph/diagramMooring2DVarAgainstOther.m
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ function diagramMooring2DVarAgainstOther(sample_data, varName, yAxisVarName, isQ
end
end

backgroundColor = [0.85 0.85 0.85];
backgroundColor = [1 1 1]; % white

if any(isPlottable)
% collect visualQC config
Expand Down Expand Up @@ -280,6 +280,7 @@ function diagramMooring2DVarAgainstOther(sample_data, varName, yAxisVarName, isQ
'Name', title, ...
'NumberTitle', 'off', ...
'Visible', visible, ...
'Color', backgroundColor, ...
'OuterPosition', monitorRect(iBigMonitor, :));

hAxMooringVar = axes('Parent', hFigMooringVar);
Expand All @@ -294,7 +295,7 @@ function diagramMooring2DVarAgainstOther(sample_data, varName, yAxisVarName, isQ
hold(hAxMooringVar, 'on');

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

% set data cursor mode custom display
dcm_obj = datacursormode(hFigMooringVar);
Expand Down Expand Up @@ -445,8 +446,9 @@ function diagramMooring2DVarAgainstOther(sample_data, varName, yAxisVarName, isQ
'YGrid', 'on', ...
'Layer', 'top');

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

if strcmpi(yAxisVarName, 'DEPTH')
Expand Down Expand Up @@ -509,7 +511,7 @@ function diagramMooring2DVarAgainstOther(sample_data, varName, yAxisVarName, isQ
end
end
posAx = get(hAxMooringVar, 'Position');
set(hLegend, 'Units', 'Normalized', 'color', backgroundColor)
set(hLegend, 'Units', 'Normalized', 'Color', 'none')
posLh = get(hLegend, 'Position');
if posLh(2) < 0
set(hLegend, 'Position',[posLh(1), abs(posLh(2)), posLh(3), posLh(4)]);
Expand All @@ -524,7 +526,7 @@ function diagramMooring2DVarAgainstOther(sample_data, varName, yAxisVarName, isQ
fileName = strrep(fileName, '_PARAM_', ['_' varName '_vs_' yAxisVarName '_']); % IMOS_[sub-facility_code]_[site_code]_FV01_[deployment_code]_[PLOT-TYPE]_[PARAM]_vs_[OTHER-PARAM]_C-[creation_date].png
fileName = strrep(fileName, '_PLOT-TYPE_', '_DIAGRAM_');

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

close(hFigMooringVar);
end
Expand Down
12 changes: 7 additions & 5 deletions Graph/lineCastVar.m
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function lineCastVar(sample_data, varNames, isQC, saveToFile, exportDir)

initiateFigure = true;

backgroundColor = [0.85 0.85 0.85];
backgroundColor = [1 1 1]; % white

lenVarNames = length(varNames);
for k=1:lenVarNames
Expand Down Expand Up @@ -122,6 +122,7 @@ function lineCastVar(sample_data, varNames, isQC, saveToFile, exportDir)
'Name', title, ...
'NumberTitle', 'off', ...
'Visible', visible, ...
'Color', backgroundColor, ...
'OuterPosition', monitorRect(iBigMonitor, :));

initiateFigure = false;
Expand All @@ -147,7 +148,7 @@ function lineCastVar(sample_data, varNames, isQC, saveToFile, exportDir)
hold(hAxCastVar, 'on');

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

cMap = colormap(hAxCastVar, parula(lenSampleData));
cMap = flipud(cMap);
Expand Down Expand Up @@ -265,8 +266,9 @@ function lineCastVar(sample_data, varNames, isQC, saveToFile, exportDir)
'YGrid', 'on', ...
'Layer', 'top');

% set background to be grey
set(hAxCastVar, 'Color', backgroundColor)
% set axes background to be transparent (figure color shows
% through)
set(hAxCastVar, 'Color', 'none')
end
end

Expand Down Expand Up @@ -297,7 +299,7 @@ function lineCastVar(sample_data, varNames, isQC, saveToFile, exportDir)
if saveToFile
fileName = strrep(fileName, '_PLOT-TYPE_', '_LINE_'); % IMOS_[sub-facility_code]_[platform_code]_FV01_[time_coverage_start]_[PLOT-TYPE]_C-[creation_date].png

fastSaveas(hFigCastVar, fullfile(exportDir, fileName));
fastSaveas(hFigCastVar, backgroundColor, fullfile(exportDir, fileName));

close(hFigCastVar);
end
Expand Down
Loading

0 comments on commit a0eb1a5

Please sign in to comment.