Skip to content

Commit

Permalink
Merge pull request #378 from aodn/2.5.17
Browse files Browse the repository at this point in the history
2.5.17
  • Loading branch information
ggalibert authored Oct 19, 2016
2 parents 46c8994 + 8f1d982 commit b97e0f9
Show file tree
Hide file tree
Showing 19 changed files with 993 additions and 163 deletions.
25 changes: 8 additions & 17 deletions Graph/checkMooringPlannedDepths.m
Original file line number Diff line number Diff line change
Expand Up @@ -191,16 +191,17 @@ function checkMooringPlannedDepths(sample_data, isQC, saveToFile, exportDir)
%now plot all the calculated depths on one plot to choose region for comparison:
%plot
fileName = genIMOSFileName(sample_data{1}, 'png');
visible = 'on';
if saveToFile, visible = 'off'; end
hFigPress = figure(...
'Name', title, ...
'NumberTitle','off', ...
'Visible', visible, ...
'OuterPosition', monitorRect(iBigMonitor, :));

hAxPress = subplot(2,1,1,'Parent', hFigPress);
hAxDepthDiff = subplot(2,1,2,'Parent', hFigPress);
% create uipanel within figure so that screencapture can be
% used on the plot only and without capturing all of the figure
% (including buttons, menus...)
hPanelMooringVar = uipanel('Parent', hFigPress);
hAxPress = subplot(2,1,1,'Parent', hPanelMooringVar);
hAxDepthDiff = subplot(2,1,2,'Parent', hPanelMooringVar);

%depth plot for selecting region to compare depth to planned depth
set(hAxPress, 'YDir', 'reverse')
Expand Down Expand Up @@ -313,21 +314,11 @@ function checkMooringPlannedDepths(sample_data, isQC, saveToFile, exportDir)

if isPlottable
if saveToFile
% ensure the printed version is the same whatever the screen used.
set(hFigPress, 'PaperPositionMode', 'manual');
set(hFigPress, 'PaperType', 'A4', 'PaperOrientation', 'landscape', 'PaperUnits', 'normalized', 'PaperPosition', [0, 0, 1, 1]);

% preserve the color scheme
set(hFigPress, 'InvertHardcopy', 'off');

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_');

% use hardcopy as a trick to go faster than print.
% opengl (hardware or software) should be supported by any platform and go at least just as
% fast as zbuffer. With hardware accelaration supported, could even go a
% lot faster.
imwrite(hardcopy(hFigPress, '-dopengl'), fullfile(exportDir, fileName), 'png');
fastSaveas(hFigPress, hPanelMooringVar, fullfile(exportDir, fileName));

close(hFigPress);
end
end
Expand Down
26 changes: 9 additions & 17 deletions Graph/checkMooringPresDiffs.m
Original file line number Diff line number Diff line change
Expand Up @@ -140,16 +140,18 @@ function checkMooringPresDiffs(sample_data, iSampleMenu, isQC, saveToFile, expor

%plot
fileName = genIMOSFileName(sample_data{iCurrSam}, 'png');
visible = 'on';
if saveToFile, visible = 'off'; end
hFigPressDiff = figure(...
'Name', title, ...
'NumberTitle','off', ...
'Visible', visible, ...
'OuterPosition', monitorRect(iBigMonitor, :));

% create uipanel within figure so that screencapture can be
% used on the plot only and without capturing all of the figure
% (including buttons, menus...)
hPanelMooringVar = uipanel('Parent', hFigPressDiff);

%pressure plot
hAxPress = subplot(2,1,1,'Parent', hFigPressDiff);
hAxPress = subplot(2,1,1,'Parent', hPanelMooringVar);
set(hAxPress, 'YDir', 'reverse')
set(get(hAxPress, 'XLabel'), 'String', 'Time');
set(get(hAxPress, 'YLabel'), 'String', [presRelCode ' (' varUnit ')'], 'Interpreter', 'none');
Expand All @@ -159,7 +161,7 @@ function checkMooringPresDiffs(sample_data, iSampleMenu, isQC, saveToFile, expor
hold(hAxPress, 'on');

%Pressure diff plot
hAxPressDiff = subplot(2,1,2,'Parent', hFigPressDiff);
hAxPressDiff = subplot(2,1,2,'Parent', hPanelMooringVar);
set(get(hAxPressDiff, 'XLabel'), 'String', 'Time');
set(get(hAxPressDiff, 'YLabel'), 'String', [presRelCode ' (' varUnit ')'], 'Interpreter', 'none');
set(get(hAxPressDiff, 'Title'), 'String', ...
Expand Down Expand Up @@ -329,21 +331,11 @@ function checkMooringPresDiffs(sample_data, iSampleMenu, isQC, saveToFile, expor
set(hAxPress, 'Position', posAx);

if saveToFile
% ensure the printed version is the same whatever the screen used.
set(hFigPressDiff, 'PaperPositionMode', 'manual');
set(hFigPressDiff, 'PaperType', 'A4', 'PaperOrientation', 'landscape', 'PaperUnits', 'normalized', 'PaperPosition', [0, 0, 1, 1]);

% preserve the color scheme
set(hFigPressDiff, 'InvertHardcopy', 'off');

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_');

% use hardcopy as a trick to go faster than print.
% opengl (hardware or software) should be supported by any platform and go at least just as
% fast as zbuffer. With hardware accelaration supported, could even go a
% lot faster.
imwrite(hardcopy(hFigPressDiff, '-dopengl'), fullfile(exportDir, fileName), 'png');
fastSaveas(hFigPressDiff, hPanelMooringVar, fullfile(exportDir, fileName));

close(hFigPressDiff);
end
end
Expand Down
23 changes: 7 additions & 16 deletions Graph/lineCastVar.m
Original file line number Diff line number Diff line change
Expand Up @@ -127,19 +127,21 @@ function lineCastVar(sample_data, varNames, isQC, saveToFile, exportDir)
if iVar > 0
if initiateFigure
fileName = genIMOSFileName(sample_data{i}, 'png');
visible = 'on';
if saveToFile, visible = 'off'; end
hFigCastVar = figure(...
'Name', title, ...
'NumberTitle','off', ...
'Visible', visible, ...
'OuterPosition', monitorRect(iBigMonitor, :));

% create uipanel within figure so that screencapture can be
% used on the plot only and without capturing all of the figure
% (including buttons, menus...)
hPanelCastVar = uipanel('Parent', hFigCastVar);

initiateFigure = false;
end

if i==1
hAxCastVar = subplot(1, lenVarNames, k);
hAxCastVar = subplot(1, lenVarNames, k, 'Parent', hPanelCastVar);
set(hAxCastVar, 'YDir', 'reverse');
set(get(hAxCastVar, 'Title'), 'String', title, 'Interpreter', 'none');
set(get(hAxCastVar, 'XLabel'), 'String', varName, 'Interpreter', 'none');
Expand Down Expand Up @@ -303,20 +305,9 @@ function lineCastVar(sample_data, varNames, isQC, saveToFile, exportDir)
end

if saveToFile
% ensure the printed version is the same whatever the screen used.
set(hFigCastVar, 'PaperPositionMode', 'manual');
set(hFigCastVar, 'PaperType', 'A4', 'PaperOrientation', 'landscape', 'PaperUnits', 'normalized', 'PaperPosition', [0, 0, 1, 1]);

% preserve the color scheme
set(hFigCastVar, 'InvertHardcopy', 'off');

fileName = strrep(fileName, '_PLOT-TYPE_', '_LINE_'); % IMOS_[sub-facility_code]_[platform_code]_FV01_[time_coverage_start]_[PLOT-TYPE]_C-[creation_date].png

% use hardcopy as a trick to go faster than print.
% opengl (hardware or software) should be supported by any platform and go at least just as
% fast as zbuffer. With hardware accelaration supported, could even go a
% lot faster.
imwrite(hardcopy(hFigCastVar, '-dopengl'), fullfile(exportDir, fileName), 'png');
fastSaveas(hFigCastVar, hPanelCastVar, fullfile(exportDir, fileName));

close(hFigCastVar);
end
Expand Down
24 changes: 8 additions & 16 deletions Graph/lineMooring1DVar.m
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,17 @@ function lineMooring1DVar(sample_data, varName, isQC, saveToFile, exportDir)
all(~strncmpi(sample_data{iSort(i)}.variables{iVar}.name, {'UCUR', 'VCUR', 'WCUR', 'CDIR', 'CSPD', 'VEL1', 'VEL2', 'VEL3'}, 4))
if initiateFigure
fileName = genIMOSFileName(sample_data{iSort(i)}, 'png');
visible = 'on';
if saveToFile, visible = 'off'; end
hFigMooringVar = figure(...
'Name', title, ...
'NumberTitle','off', ...
'Visible', visible, ...
'OuterPosition', monitorRect(iBigMonitor, :));

hAxMooringVar = axes('Parent', hFigMooringVar);
% create uipanel within figure so that screencapture can be
% used on the plot only and without capturing all of the figure
% (including buttons, menus...)
hPanelMooringVar = uipanel('Parent', hFigMooringVar);
hAxMooringVar = axes('Parent', hPanelMooringVar);

if any(strcmpi(varName, {'DEPTH', 'PRES', 'PRES_REL'})), set(hAxMooringVar, 'YDir', 'reverse'); end
set(get(hAxMooringVar, 'XLabel'), 'String', 'Time');
set(get(hAxMooringVar, 'YLabel'), 'String', [varName ' (' varUnit ')'], 'Interpreter', 'none');
Expand Down Expand Up @@ -288,21 +290,11 @@ function lineMooring1DVar(sample_data, varName, isQC, saveToFile, exportDir)
end

if saveToFile
% ensure the printed version is the same whatever the screen used.
set(hFigMooringVar, 'PaperPositionMode', 'manual');
set(hFigMooringVar, 'PaperType', 'A4', 'PaperOrientation', 'landscape', 'PaperUnits', 'normalized', 'PaperPosition', [0, 0, 1, 1]);

% preserve the color scheme
set(hFigMooringVar, 'InvertHardcopy', 'off');

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_');

% use hardcopy as a trick to go faster than print.
% opengl (hardware or software) should be supported by any platform and go at least just as
% fast as zbuffer. With hardware accelaration supported, could even go a
% lot faster.
imwrite(hardcopy(hFigMooringVar, '-dopengl'), fullfile(exportDir, fileName), 'png');
fastSaveas(hFigMooringVar, hPanelMooringVar, fullfile(exportDir, fileName));

close(hFigMooringVar);
end
end
Expand Down
41 changes: 16 additions & 25 deletions Graph/lineMooring2DVarSection.m
Original file line number Diff line number Diff line change
Expand Up @@ -117,23 +117,25 @@ function lineMooring2DVarSection(sample_data, varName, timeValue, isQC, saveToFi
if iVar > 0
if initiateFigure
fileName = genIMOSFileName(sample_data, 'png');
visible = 'on';
if saveToFile, visible = 'off'; end
hFigVarSection = figure(...
'Name', title, ...
'NumberTitle','off', ...
'Visible', visible, ...
'OuterPosition', monitorRect(iBigMonitor, :));

% create uipanel within figure so that screencapture can be
% used on the plot only and without capturing all of the figure
% (including buttons, menus...)
hPanelVarSection = uipanel('Parent', hFigVarSection);

initiateFigure = false;
end

hAxCastVar = axes;
set(get(hAxCastVar, 'Title'), 'String', title, 'Interpreter', 'none');
set(get(hAxCastVar, 'XLabel'), 'String', [varTitle ' (' varUnit ')'], 'Interpreter', 'none');
set(get(hAxCastVar, 'YLabel'), 'String', [dimTitle ' (' dimUnit ')'], 'Interpreter', 'none');
hAxVarSection = axes('Parent', hPanelVarSection);
set(get(hAxVarSection, 'Title'), 'String', title, 'Interpreter', 'none');
set(get(hAxVarSection, 'XLabel'), 'String', [varTitle ' (' varUnit ')'], 'Interpreter', 'none');
set(get(hAxVarSection, 'YLabel'), 'String', [dimTitle ' (' dimUnit ')'], 'Interpreter', 'none');

hold(hAxCastVar, 'on');
hold(hAxVarSection, 'on');

% dummy entry for first entry in legend
hLineVar(1) = plot(0, 0, 'o', 'color', backgroundColor, 'Visible', 'off'); % color grey same as background (invisible)
Expand All @@ -145,8 +147,8 @@ function lineMooring2DVarSection(sample_data, varName, timeValue, isQC, saveToFi
yLine, ...
'LineStyle', '-');

xLim = get(hAxCastVar, 'XLim');
yLim = get(hAxCastVar, 'YLim');
xLim = get(hAxVarSection, 'XLim');
yLim = get(hAxVarSection, 'YLim');

%get var QC information
varFlags = sample_data.variables{iVar}.flags(iX);
Expand Down Expand Up @@ -238,13 +240,13 @@ function lineMooring2DVarSection(sample_data, varName, timeValue, isQC, saveToFi

% Let's redefine properties after line to make sure grid lines appear
% above color data and XTick and XTickLabel haven't changed
set(hAxCastVar, ...
set(hAxVarSection, ...
'XGrid', 'on', ...
'YGrid', 'on', ...
'Layer', 'top');

% set background to be grey
set(hAxCastVar, 'Color', backgroundColor)
set(hAxVarSection, 'Color', backgroundColor)
end

if ~initiateFigure
Expand All @@ -258,28 +260,17 @@ function lineMooring2DVarSection(sample_data, varName, timeValue, isQC, saveToFi
instrumentDesc = [instrumentDesc; flagDesc];
% Matlab >R2015 legend entries for data which are not plotted
% will be shown with reduced opacity
hLegend = legend(hAxCastVar, ...
hLegend = legend(hAxVarSection, ...
hLineVar, regexprep(instrumentDesc,'_','\_'), ...
'Interpreter', 'none', ...
'Location', 'SouthOutside');
% set(hLegend, 'Box', 'off', 'Color', 'none');
end

if saveToFile
% ensure the printed version is the same whatever the screen used.
set(hFigVarSection, 'PaperPositionMode', 'manual');
set(hFigVarSection, 'PaperType', 'A4', 'PaperOrientation', 'landscape', 'PaperUnits', 'normalized', 'PaperPosition', [0, 0, 1, 1]);

% preserve the color scheme
set(hFigVarSection, 'InvertHardcopy', 'off');

fileName = strrep(fileName, '_PLOT-TYPE_', '_LINE_'); % IMOS_[sub-facility_code]_[platform_code]_FV01_[time_coverage_start]_[PLOT-TYPE]_C-[creation_date].png

% use hardcopy as a trick to go faster than print.
% opengl (hardware or software) should be supported by any platform and go at least just as
% fast as zbuffer. With hardware accelaration supported, could even go a
% lot faster.
imwrite(hardcopy(hFigVarSection, '-dopengl'), fullfile(exportDir, fileName), 'png');
fastSaveas(hFigVarSection, hPanelVarSection, fullfile(exportDir, fileName));

close(hFigVarSection);
end
Expand Down
28 changes: 7 additions & 21 deletions Graph/pcolorMooring2DVar.m
Original file line number Diff line number Diff line change
Expand Up @@ -144,28 +144,17 @@ function pcolorMooring2DVar(sample_data, varName, isQC, saveToFile, exportDir)
size(sample_data{iSort(i)}.variables{iVar}.data, 3) == 1 % we're only plotting ADCP 2D variables
if initiateFigure
fileName = genIMOSFileName(sample_data{iSort(i)}, 'png');
visible = 'on';
if saveToFile, visible = 'off'; end
hFigMooringVar = figure(...
'Name', title, ...
'NumberTitle', 'off', ...
'Visible', visible, ...
'OuterPosition', monitorRect(iBigMonitor, :));

if saveToFile
% the default renderer under windows is opengl; for some reason,
% printing pcolor plots fails when using opengl as the renderer
set(hFigMooringVar, 'Renderer', 'zbuffer');

% ensure the printed version is the same whatever the screen used.
set(hFigMooringVar, 'PaperPositionMode', 'manual');
set(hFigMooringVar, 'PaperType', 'A4', 'PaperOrientation', 'landscape', 'PaperUnits', 'normalized', 'PaperPosition', [0, 0, 1, 1]);

% preserve the color scheme
set(hFigMooringVar, 'InvertHardcopy', 'off');
end
% create uipanel within figure so that screencapture can be
% used on the plot only and without capturing all of the figure
% (including buttons, menus...)
hPanelMooringVar = uipanel('Parent', hFigMooringVar);
hAxMooringVar = axes('Parent', hPanelMooringVar);

hAxMooringVar = axes('Parent', hFigMooringVar);
set(get(hAxMooringVar, 'XLabel'), 'String', 'Time');
set(get(hAxMooringVar, 'YLabel'), 'String', [nameHeight ' (m)'], 'Interpreter', 'none');
set(get(hAxMooringVar, 'Title'), 'String', sprintf('%s\n%s', title, instrumentDesc{i}), 'Interpreter', 'none');
Expand Down Expand Up @@ -261,11 +250,8 @@ 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_');

% use hardcopy as a trick to go faster than print.
% opengl (hardware or software) should be supported by any platform and go at least just as
% fast as zbuffer. With hardware accelaration supported, could even go a
% lot faster.
imwrite(hardcopy(hFigMooringVar, '-dopengl'), fullfile(exportDir, fileName), 'png');
fastSaveas(hFigMooringVar, hPanelMooringVar, fullfile(exportDir, fileName));

close(hFigMooringVar);
end
end
Expand Down
24 changes: 8 additions & 16 deletions Graph/scatterMooring1DVarAgainstDepth.m
Original file line number Diff line number Diff line change
Expand Up @@ -190,15 +190,17 @@ function scatterMooring1DVarAgainstDepth(sample_data, varName, isQC, saveToFile,
if isPlottable(i)
if initiateFigure
fileName = genIMOSFileName(sample_data{iSort(i)}, 'png');
visible = 'on';
if saveToFile, visible = 'off'; end
hFigMooringVar = figure(...
'Name', title, ...
'NumberTitle','off', ...
'Visible', visible, ...
'OuterPosition', monitorRect(iBigMonitor, :));

hAxMooringVar = axes('Parent', hFigMooringVar);
% create uipanel within figure so that screencapture can be
% used on the plot only and without capturing all of the figure
% (including buttons, menus...)
hPanelMooringVar = uipanel('Parent', hFigMooringVar);
hAxMooringVar = axes('Parent', hPanelMooringVar);

set(hAxMooringVar, 'YDir', 'reverse');
set(get(hAxMooringVar, 'XLabel'), 'String', 'Time');
set(get(hAxMooringVar, 'YLabel'), 'String', 'DEPTH (m)', 'Interpreter', 'none');
Expand Down Expand Up @@ -415,21 +417,11 @@ function scatterMooring1DVarAgainstDepth(sample_data, varName, isQC, saveToFile,
% set(hLegend, 'Box', 'off', 'Color', 'none');

if saveToFile
% ensure the printed version is the same whatever the screen used.
set(hFigMooringVar, 'PaperPositionMode', 'manual');
set(hFigMooringVar, 'PaperType', 'A4', 'PaperOrientation', 'landscape', 'PaperUnits', 'normalized', 'PaperPosition', [0, 0, 1, 1]);

% preserve the color scheme
set(hFigMooringVar, 'InvertHardcopy', 'off');

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_');

% use hardcopy as a trick to go faster than print.
% opengl (hardware or software) should be supported by any platform and go at least just as
% fast as zbuffer. With hardware accelaration supported, could even go a
% lot faster.
imwrite(hardcopy(hFigMooringVar, '-dopengl'), fullfile(exportDir, fileName), 'png');
fastSaveas(hFigMooringVar, hPanelMooringVar, fullfile(exportDir, fileName));

close(hFigMooringVar);
end
end
Expand Down
Loading

0 comments on commit b97e0f9

Please sign in to comment.