diff --git a/Graph/checkMooringPlannedDepths.m b/Graph/checkMooringPlannedDepths.m index f09616438..091ea0072 100644 --- a/Graph/checkMooringPlannedDepths.m +++ b/Graph/checkMooringPlannedDepths.m @@ -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 @@ -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); @@ -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); @@ -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 @@ -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... @@ -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 diff --git a/Graph/checkMooringPresDiffs.m b/Graph/checkMooringPresDiffs.m index 4a36bf913..c3e328f70 100644 --- a/Graph/checkMooringPresDiffs.m +++ b/Graph/checkMooringPresDiffs.m @@ -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'); @@ -135,6 +135,7 @@ function checkMooringPresDiffs(sample_data, iSampleMenu, isQC, saveToFile, expor 'Name', title, ... 'NumberTitle', 'off', ... 'Visible', visible, ... + 'Color', backgroundColor, ... 'OuterPosition', monitorRect(iBigMonitor, :)); %pressure plot @@ -142,7 +143,7 @@ function checkMooringPresDiffs(sample_data, iSampleMenu, isQC, saveToFile, expor 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'); @@ -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; @@ -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]; @@ -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 @@ -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'); @@ -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... @@ -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 diff --git a/Graph/diagramMooring1DVarAgainstOther.m b/Graph/diagramMooring1DVarAgainstOther.m index 103c6ca78..64aaa725b 100644 --- a/Graph/diagramMooring1DVarAgainstOther.m +++ b/Graph/diagramMooring1DVarAgainstOther.m @@ -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. @@ -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 @@ -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); @@ -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); @@ -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') @@ -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)]); @@ -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 diff --git a/Graph/diagramMooring2DVarAgainstOther.m b/Graph/diagramMooring2DVarAgainstOther.m index 498fb3cbb..711cf4ae2 100644 --- a/Graph/diagramMooring2DVarAgainstOther.m +++ b/Graph/diagramMooring2DVarAgainstOther.m @@ -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 @@ -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); @@ -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); @@ -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') @@ -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)]); @@ -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 diff --git a/Graph/lineCastVar.m b/Graph/lineCastVar.m index 9a8a7d25a..37398ff82 100644 --- a/Graph/lineCastVar.m +++ b/Graph/lineCastVar.m @@ -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 @@ -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; @@ -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); @@ -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 @@ -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 diff --git a/Graph/lineMooring1DVar.m b/Graph/lineMooring1DVar.m index d94e06fdc..d7f83963c 100644 --- a/Graph/lineMooring1DVar.m +++ b/Graph/lineMooring1DVar.m @@ -121,7 +121,7 @@ function lineMooring1DVar(sample_data, varName, isQC, saveToFile, exportDir) initiateFigure = true; isPlottable = false; -backgroundColor = [0.85 0.85 0.85]; +backgroundColor = [1 1 1]; % white for i=1:lenSampleData % instrument description @@ -152,6 +152,7 @@ function lineMooring1DVar(sample_data, varName, isQC, saveToFile, exportDir) 'Name', title, ... 'NumberTitle', 'off', ... 'Visible', visible, ... + 'Color', backgroundColor, ... 'OuterPosition', monitorRect(iBigMonitor, :)); hAxMooringVar = axes('Parent', hFigMooringVar); @@ -167,7 +168,7 @@ function lineMooring1DVar(sample_data, varName, isQC, saveToFile, exportDir) hold(hAxMooringVar, '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) % set data cursor mode custom display dcm_obj = datacursormode(hFigMooringVar); @@ -247,8 +248,9 @@ function lineMooring1DVar(sample_data, varName, isQC, saveToFile, exportDir) '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 end end @@ -327,7 +329,7 @@ function lineMooring1DVar(sample_data, varName, isQC, saveToFile, exportDir) 'FontSize', fontSizeAx,... 'xscale', xscale); 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)]); @@ -340,7 +342,7 @@ function lineMooring1DVar(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_', '_LINE_'); - fastSaveas(hFigMooringVar, fullfile(exportDir, fileName)); + fastSaveas(hFigMooringVar, backgroundColor, fullfile(exportDir, fileName)); close(hFigMooringVar); end diff --git a/Graph/lineMooring2DVarSection.m b/Graph/lineMooring2DVarSection.m index 6c07bb651..e61513f6e 100644 --- a/Graph/lineMooring2DVarSection.m +++ b/Graph/lineMooring2DVarSection.m @@ -96,7 +96,7 @@ function lineMooring2DVarSection(sample_data, varName, timeValue, isQC, saveToFi dimTitle = imosParameters(dimName, 'long_name'); dimUnit = imosParameters(dimName, 'uom'); -backgroundColor = [0.85 0.85 0.85]; +backgroundColor = [1 1 1]; % white if iVar > 0 if initiateFigure @@ -107,6 +107,7 @@ function lineMooring2DVarSection(sample_data, varName, timeValue, isQC, saveToFi 'Name', title, ... 'NumberTitle', 'off', ... 'Visible', visible, ... + 'Color', backgroundColor, ... 'OuterPosition', monitorRect(iBigMonitor, :)); initiateFigure = false; @@ -212,8 +213,9 @@ function lineMooring2DVarSection(sample_data, varName, timeValue, isQC, saveToFi 'YGrid', 'on', ... 'Layer', 'top'); - % set background to be grey - set(hAxVarSection, 'Color', backgroundColor) + % set axes background to be transparent (figure color shows + % through) + set(hAxVarSection, 'Color', 'none') end if ~initiateFigure @@ -236,7 +238,7 @@ function lineMooring2DVarSection(sample_data, varName, timeValue, isQC, saveToFi 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(hFigVarSection, fullfile(exportDir, fileName)); + fastSaveas(hFigVarSection, backgroundColor, fullfile(exportDir, fileName)); close(hFigVarSection); end diff --git a/Graph/pcolorMooring2DVar.m b/Graph/pcolorMooring2DVar.m index e611292e6..628f15492 100644 --- a/Graph/pcolorMooring2DVar.m +++ b/Graph/pcolorMooring2DVar.m @@ -92,6 +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 + for i=1:lenSampleData % instrument description if ~isempty(strtrim(sample_data{iSort(i)}.instrument)) @@ -144,6 +146,7 @@ function pcolorMooring2DVar(sample_data, varName, isQC, saveToFile, exportDir) 'Name', title, ... 'NumberTitle', 'off', ... 'Visible', visible, ... + 'Color', backgroundColor, ... 'OuterPosition', monitorRect(iBigMonitor, :)); hAxMooringVar = axes('Parent', hFigMooringVar); @@ -224,8 +227,9 @@ function pcolorMooring2DVar(sample_data, varName, isQC, saveToFile, exportDir) set(get(hCBar, 'Title'), 'String', [varName ' (' varUnit ')'], 'Interpreter', 'none'); - % set background to be grey - set(hAxMooringVar, 'Color', [0.75 0.75 0.75]) + % set axes background to be transparent (figure color shows + % through) + set(hAxMooringVar, 'Color', 'none') end end end @@ -243,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, fullfile(exportDir, fileName)); + fastSaveas(hFigMooringVar, backgroundColor, fullfile(exportDir, fileName)); close(hFigMooringVar); end diff --git a/Graph/scatterMooring1DVarAgainstDepth.m b/Graph/scatterMooring1DVarAgainstDepth.m index cbf549ce9..a1dec4db7 100644 --- a/Graph/scatterMooring1DVarAgainstDepth.m +++ b/Graph/scatterMooring1DVarAgainstDepth.m @@ -149,7 +149,7 @@ function scatterMooring1DVarAgainstDepth(sample_data, varName, isQC, saveToFile, end end -backgroundColor = [0.85 0.85 0.85]; +backgroundColor = [1 1 1]; % white if any(isPlottable) % collect visualQC config @@ -188,6 +188,7 @@ function scatterMooring1DVarAgainstDepth(sample_data, varName, isQC, saveToFile, hFigMooringVar = figure(... 'Name', title, ... 'NumberTitle', 'off', ... + 'Color', backgroundColor, ... 'Visible', visible, ... 'OuterPosition', monitorRect(iBigMonitor, :)); @@ -202,7 +203,7 @@ function scatterMooring1DVarAgainstDepth(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 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); @@ -327,8 +328,9 @@ function scatterMooring1DVarAgainstDepth(sample_data, varName, isQC, saveToFile, '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 % we plot the instrument nominal depth @@ -396,7 +398,7 @@ function scatterMooring1DVarAgainstDepth(sample_data, varName, isQC, saveToFile, 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)]); @@ -418,7 +420,7 @@ function scatterMooring1DVarAgainstDepth(sample_data, varName, isQC, 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, fullfile(exportDir, fileName)); + fastSaveas(hFigMooringVar, backgroundColor, fullfile(exportDir, fileName)); close(hFigMooringVar); end diff --git a/Graph/scatterMooring2DVarAgainstDepth.m b/Graph/scatterMooring2DVarAgainstDepth.m index 5e06231f7..541665f94 100644 --- a/Graph/scatterMooring2DVarAgainstDepth.m +++ b/Graph/scatterMooring2DVarAgainstDepth.m @@ -170,7 +170,7 @@ function scatterMooring2DVarAgainstDepth(sample_data, varName, isQC, saveToFile, end end -backgroundColor = [0.75 0.75 0.75]; +backgroundColor = [0.85 0.85 0.85]; % light grey to allow for colorbar with white if any(isPlottable) % collect visualQC config @@ -246,6 +246,7 @@ function scatterMooring2DVarAgainstDepth(sample_data, varName, isQC, saveToFile, 'Name', title, ... 'NumberTitle', 'off', ... 'Visible', visible, ... + 'Color', backgroundColor, ... 'OuterPosition', monitorRect(iBigMonitor, :)); hAxMooringVar = axes('Parent', hFigMooringVar); @@ -259,7 +260,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 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); @@ -330,12 +331,7 @@ function scatterMooring2DVarAgainstDepth(sample_data, varName, isQC, saveToFile, else if isfield(sample_data{iSort(i)}, 'instrument_nominal_depth') if ~isempty(sample_data{iSort(i)}.instrument_nominal_depth) - if iHeight == 0 - dataDepth = sample_data{iSort(i)}.instrument_nominal_depth*ones(size(iGoodTime)); - else - dataDepth = repmat(sample_data{iSort(i)}.instrument_nominal_depth + ... - sample_data{iSort(i)}.dimensions{iHeight}.data, 1, length(iGoodTime)); - end + dataDepth = sample_data{iSort(i)}.instrument_nominal_depth*ones(size(iGoodTime)); else fprintf('%s\n', ['Error : in ' sample_data{iSort(i)}.toolbox_input_file ... ', global attribute instrument_nominal_depth is not documented.']); @@ -407,8 +403,9 @@ function scatterMooring2DVarAgainstDepth(sample_data, varName, isQC, saveToFile, '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 % we plot the instrument nominal depth @@ -471,7 +468,7 @@ function scatterMooring2DVarAgainstDepth(sample_data, varName, isQC, saveToFile, 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)]); @@ -486,7 +483,7 @@ function scatterMooring2DVarAgainstDepth(sample_data, varName, isQC, 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, fullfile(exportDir, fileName)); + fastSaveas(hFigMooringVar, backgroundColor, fullfile(exportDir, fileName)); close(hFigMooringVar); end diff --git a/NetCDF/exportNetCDF.m b/NetCDF/exportNetCDF.m index 12d356dab..de6c1440a 100644 --- a/NetCDF/exportNetCDF.m +++ b/NetCDF/exportNetCDF.m @@ -56,7 +56,7 @@ % we don't want the API to automatically pre-fill with FillValue, we're % taking care of it ourselves and avoid 2 times writting on disk - netcdf.setFill(fid, 'NC_NOFILL'); + netcdf.setFill(fid, 'NOFILL'); dateFmt = readProperty('exportNetCDF.dateFormat'); qcSet = str2double(readProperty('toolbox.qc_set')); diff --git a/Parser/SBE19Parse.m b/Parser/SBE19Parse.m index 46cacd94f..378d524b1 100644 --- a/Parser/SBE19Parse.m +++ b/Parser/SBE19Parse.m @@ -145,6 +145,13 @@ switch mode case 'profile' + if ~isfield(procHeader, 'binSize') + disp(['Warning : ' sample_data.toolbox_input_file ... + ' has not been vertically binned as per ' ... + 'http://help.aodn.org.au/help/sites/help.aodn.org.au/' ... + 'files/ANMN%20CTD%20Processing%20Procedures.pdf']); + end + % dimensions creation iVarPRES_REL = NaN; iVarDEPTH = NaN; @@ -429,6 +436,7 @@ sensorId = ''; sensorType = '<[tT]ype>(.*\S+.*)'; serialExpr = '^\*\s*SerialNumber:\s*(\S+)'; %SBE39plus +serialExpr2 = '^\*\s*SEACAT PROFILER\s*V(\S+)\s*SN\s*(\S+)'; %SEACAT PROFILER exprs = {... headerExpr headerExpr2 headerExpr3 scanExpr ... @@ -438,7 +446,7 @@ castExpr castExpr2 intervalExpr ... sbe38Expr optodeExpr ... voltCalExpr otherExpr ... - firmExpr sensorId sensorType firmExpr2 serialExpr}; + firmExpr sensorId sensorType firmExpr2 serialExpr serialExpr2}; for k = 1:length(headerLines) @@ -592,6 +600,12 @@ % SerialNumber, SBE39plus cnv case 25 header.instrument_serial_no = tkns{1}{1}; + + % old SEACAT PROFILER serial number format + % example "* SEACAT PROFILER V2.1a SN 597 10/15/11 10:02:56.721" + case 26 + % is tkns{1}{1} firmware version? + header.instrument_serial_no = tkns{1}{2}; end break; @@ -625,6 +639,7 @@ volt0Expr = 'sensor \d+ = Extrnl Volt 0 (.+)'; volt1Expr = 'sensor \d+ = Extrnl Volt 1 (.+)'; volt2Expr = 'sensor \d+ = Extrnl Volt 2 (.+)'; + binExpr = 'binavg_binsize = (\d+)'; for k = 1:length(headerLines) @@ -673,6 +688,13 @@ header.volt2Expr = tkns{1}{1}; continue; end + + % then try bin expr + tkns = regexp(headerLines{k}, binExpr, 'tokens'); + if ~isempty(tkns) + header.binSize = str2double(tkns{1}{1}); + continue; + end end end diff --git a/Parser/convertSBEcnvVar.m b/Parser/convertSBEcnvVar.m index 9f64acf34..aa5d90f74 100644 --- a/Parser/convertSBEcnvVar.m +++ b/Parser/convertSBEcnvVar.m @@ -82,7 +82,7 @@ comment = ''; % strain gauge pressure (dbar) - case {'pr', 'prM', 'prdM'} + case {'pr', 'prM', 'prdM', 'prSM'} name = 'PRES_REL'; comment = ''; diff --git a/Parser/readECOraw.m b/Parser/readECOraw.m index fa756704e..05aa7a913 100644 --- a/Parser/readECOraw.m +++ b/Parser/readECOraw.m @@ -202,9 +202,11 @@ durationBurst(i) = (timeBurst(end) - timeBurst(1))*24*3600 + sampleIntervalInBurst(i); end - sample_data.meta.instrument_sample_interval = round(median(sampleIntervalInBurst)); + iNaNBurst = isnan(sampleIntervalInBurst); % it is possible that only one sample is output for a burst + + sample_data.meta.instrument_sample_interval = round(median(sampleIntervalInBurst(~iNaNBurst))); sample_data.meta.instrument_burst_interval = round(median(diff(firstTimeBurst*24*3600))); - sample_data.meta.instrument_burst_duration = round(median(durationBurst)); + sample_data.meta.instrument_burst_duration = round(median(durationBurst(~iNaNBurst))); end sample_data.dimensions{1}.name = 'TIME'; diff --git a/Parser/signatureParse.m b/Parser/signatureParse.m index c42d62bc7..292a460b1 100644 --- a/Parser/signatureParse.m +++ b/Parser/signatureParse.m @@ -760,7 +760,7 @@ if data.(acquisitionMode{i}).isASTData vars = [vars; { 'AST_DIST', 1, data.(acquisitionMode{i}).AltimeterDistanceAST; ... - 'AST_QUALITY', 1, data.(acquisitionMode{i}).AltimeterQualityAST; ... + 'AST_QUALITY', 1, data.(acquisitionMode{i}).AltimeterQualityAST; ... % Dimensionless indication of signal's surface return strength. Is reported the lowest quality for the pair of AST measurements. Useful for data clean up when there is poor surface returns. The values range from 0 to 256 and "good" data is often found above 100. 'AST_TIME_OFFSET', 1, data.(acquisitionMode{i}).AltimeterTimeOffsetAST; ... 'ALTIMETER_PRES', 1, data.(acquisitionMode{i}).AltimeterPressure }]; diff --git a/Preprocessing/depthPP.m b/Preprocessing/depthPP.m index c6b51817a..b1ed69d9d 100644 --- a/Preprocessing/depthPP.m +++ b/Preprocessing/depthPP.m @@ -589,6 +589,8 @@ 'pressure measurements to which a nominal ' ... 'value for atmospheric pressure (10.1325 dbar) ' ... 'has been substracted']; + dimensions = sample_data{nearestInsts{iCurSam}(iFirst)}.variables{presIdxOther}.dimensions; + coordinates = sample_data{nearestInsts{iCurSam}(iFirst)}.variables{presIdxOther}.coordinates; else % update from a relative pressure measurement relPresOther = sample_data{nearestInsts{iCurSam}(iFirst)}.variables{presRelIdxOther}.data; @@ -597,6 +599,8 @@ 'usually performed to balance current ' ... 'atmospheric pressure and acute sensor ' ... 'precision at a deployed depth)']; + dimensions = sample_data{nearestInsts{iCurSam}(iFirst)}.variables{presRelIdxOther}.dimensions; + coordinates = sample_data{nearestInsts{iCurSam}(iFirst)}.variables{presRelIdxOther}.coordinates; end % compute depth of the nearest sensor from its pressure @@ -719,6 +723,8 @@ 'pressure measurements to which a nominal ' ... 'value for atmospheric pressure (10.1325 dbar) ' ... 'has been substracted']; + dimensions = sample_data{nearestInsts{iCurSam}(iFirst )}.variables{presIdxFirst }.dimensions; + coordinates = sample_data{nearestInsts{iCurSam}(iFirst )}.variables{presIdxFirst }.coordinates; elseif presIdxFirst ~= 0 && presIdxSecond == 0 relPresFirst = sample_data{nearestInsts{iCurSam}(iFirst )}.variables{presIdxFirst }.data - gsw_P0/10^4; relPresSecond = sample_data{nearestInsts{iCurSam}(iSecond)}.variables{presRelIdxSecond}.data; @@ -726,6 +732,8 @@ 'pressure measurements to which a nominal ' ... 'value for atmospheric pressure (10.1325 dbar) ' ... 'has been substracted']; + dimensions = sample_data{nearestInsts{iCurSam}(iFirst )}.variables{presIdxFirst }.dimensions; + coordinates = sample_data{nearestInsts{iCurSam}(iFirst )}.variables{presIdxFirst }.coordinates; elseif presIdxFirst == 0 && presIdxSecond ~= 0 relPresFirst = sample_data{nearestInsts{iCurSam}(iFirst )}.variables{presRelIdxFirst}.data; relPresSecond = sample_data{nearestInsts{iCurSam}(iSecond)}.variables{presIdxSecond }.data - gsw_P0/10^4; @@ -733,6 +741,8 @@ 'pressure measurements to which a nominal ' ... 'value for atmospheric pressure (10.1325 dbar) ' ... 'has been substracted']; + dimensions = sample_data{nearestInsts{iCurSam}(iFirst )}.variables{presRelIdxFirst}.dimensions; + coordinates = sample_data{nearestInsts{iCurSam}(iFirst )}.variables{presRelIdxFirst}.coordinates; else % update from a relative measured pressure relPresFirst = sample_data{nearestInsts{iCurSam}(iFirst )}.variables{presRelIdxFirst }.data; @@ -742,6 +752,8 @@ 'usually performed to balance current ' ... 'atmospheric pressure and acute sensor ' ... 'precision at a deployed depth)']; + dimensions = sample_data{nearestInsts{iCurSam}(iFirst )}.variables{presRelIdxFirst}.dimensions; + coordinates = sample_data{nearestInsts{iCurSam}(iFirst )}.variables{presRelIdxFirst}.coordinates; end % compute pressure at current sensor using trigonometry and @@ -821,17 +833,6 @@ fprintf('%s\n', ['Warning : ' descSam{iCurSam} ... ' will not have its depth inferred from any neighbouring pressure sensor ' ... 'on mooring']); - - % write/update dataset PP parameters before moving to - % the next sample_data - writeDatasetParameter(sample_data{iCurSam}.toolbox_input_file, currentPProutine, 'same_family', same_family); - writeDatasetParameter(sample_data{iCurSam}.toolbox_input_file, currentPProutine, 'include', include); - writeDatasetParameter(sample_data{iCurSam}.toolbox_input_file, currentPProutine, 'exclude', exclude); - writeDatasetParameter(sample_data{iCurSam}.toolbox_input_file, currentPProutine, 'useItsOwnDepth', useItsOwnDepth(iCurSam)); - writeDatasetParameter(sample_data{iCurSam}.toolbox_input_file, currentPProutine, 'useItsOwnPres', useItsOwnPres(iCurSam)); - writeDatasetParameter(sample_data{iCurSam}.toolbox_input_file, currentPProutine, 'useItsOwnPresRel', useItsOwnPresRel(iCurSam)); - writeDatasetParameter(sample_data{iCurSam}.toolbox_input_file, currentPProutine, 'firstNearestInst', firstNearestInst(iCurSam)); - writeDatasetParameter(sample_data{iCurSam}.toolbox_input_file, currentPProutine, 'secondNearestInst', secondNearestInst(iCurSam)); continue; end end @@ -842,12 +843,6 @@ 'computed from 1 or 2 other pressure sensors in the mooring']); continue; end - - % variable DEPTH will be a function of dimension TIME - dimensions = getVar(sample_data{iCurSam}.dimensions, 'TIME'); - - % hopefully the last variable in the file is a data variable - coordinates = sample_data{iCurSam}.variables{end}.coordinates; end if depthIdx(iCurSam) diff --git a/Util/fastSaveas.m b/Util/fastSaveas.m index d7fcc95f3..444c0deff 100644 --- a/Util/fastSaveas.m +++ b/Util/fastSaveas.m @@ -1,6 +1,35 @@ -function fastSaveas( hFig, fileDestination ) +function fastSaveas( hFig, backgroundColor, fileDestination ) %FASTSAVEAS is a faster alternative to saveas. % It is used to save diagnostic plots when exporting netCDF files. +% +% Inputs: +% hFig - figure handler. +% +% backgroundColor - a three-element vector of RGB values for figure +% background. +% +% fileDestination - path to which the figure is printed. +% +% Author: Guillaume Galibert +% + +% +% Copyright (C) 2017, Australian Ocean Data Network (AODN) and Integrated +% Marine Observing System (IMOS). +% +% This program is free software: you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation version 3 of the License. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. + +% You should have received a copy of the GNU General Public License +% along with this program. +% If not, see . +% % ensure the printed version is the same whatever the screen used. set(hFig, ... @@ -26,7 +55,7 @@ function fastSaveas( hFig, fileDestination ) % use hgexport to print to file as close as possible as what we see myStyle = hgexport('factorystyle'); myStyle.Format = 'png'; % (default is eps) -myStyle.Background = [0.75 0.75 0.75]; % grey (default is white) +myStyle.Background = backgroundColor; % (default is white) hgexport(hFig, fileDestination, myStyle); diff --git a/imosToolbox.m b/imosToolbox.m index b28563b5c..cf627d5b9 100644 --- a/imosToolbox.m +++ b/imosToolbox.m @@ -37,7 +37,7 @@ function imosToolbox(auto, varargin) % % Set current toolbox version -toolboxVersion = ['2.5.36 - ' computer]; +toolboxVersion = ['2.5.37 - ' computer]; if nargin == 0, auto = 'manual'; end diff --git a/imosToolbox_Linux64.bin b/imosToolbox_Linux64.bin index b72a64e7b..55f0d09e4 100755 Binary files a/imosToolbox_Linux64.bin and b/imosToolbox_Linux64.bin differ diff --git a/imosToolbox_Win32.exe b/imosToolbox_Win32.exe index c7febe767..0c1b8dd1a 100644 Binary files a/imosToolbox_Win32.exe and b/imosToolbox_Win32.exe differ diff --git a/imosToolbox_Win64.exe b/imosToolbox_Win64.exe index 52a722f86..0b1188c8d 100644 Binary files a/imosToolbox_Win64.exe and b/imosToolbox_Win64.exe differ