Skip to content

Commit

Permalink
Merge pull request #357 from aodn/2.5.12
Browse files Browse the repository at this point in the history
2.5.12
  • Loading branch information
ggalibert authored Jun 10, 2016
2 parents b77e895 + ac2e991 commit 9989efc
Show file tree
Hide file tree
Showing 21 changed files with 168 additions and 124 deletions.
4 changes: 2 additions & 2 deletions FlowManager/displayManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ function dataClickCallback(ax, type, point)

graphFunc = getGraphFunc(graphType, 'graph', varName);
if strcmpi(func2str(graphFunc), 'graphTimeSeriesTimeDepth')
lineMooring2DVarSection(sample_data{1}, varName, point(1), false, false, '')
lineMooring2DVarSection(sample_data{setIdx}, varName, point(1), false, false, '')
end
end

Expand Down Expand Up @@ -377,7 +377,7 @@ function dataClickCallback(ax, type, point)

graphFunc = getGraphFunc(graphType, 'graph', varName);
if strcmpi(func2str(graphFunc), 'graphTimeSeriesTimeDepth')
lineMooring2DVarSection(sample_data{1}, varName, point(1), true, false, '')
lineMooring2DVarSection(sample_data{setIdx}, varName, point(1), true, false, '')
end
end

Expand Down
2 changes: 1 addition & 1 deletion GUI/dataFileStatusDialog.m
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@

% we have to handle the case when InstrumentDepth is not documented
instDepths = {deployments.InstrumentDepth};
instDepths{cellfun(@isempty, instDepths)} = NaN;
instDepths(cellfun(@isempty, instDepths)) = {NaN};
instDepths = cell2mat(instDepths);

[~, iSort] = sort(instDepths);
Expand Down
30 changes: 14 additions & 16 deletions GUI/mainWindow.m
Original file line number Diff line number Diff line change
Expand Up @@ -278,23 +278,23 @@ function mainWindow(...
switch mode
case 'timeSeries'
hToolsCheckPlannedDepths = uimenu(hToolsMenu, 'label', 'Check measured against planned depths');
hToolsCheckPlannedDepthsNonQC = uimenu(hToolsCheckPlannedDepths, 'label', 'non QC');
hToolsCheckPlannedDepthsQC = uimenu(hToolsCheckPlannedDepths, 'label', 'QC');
hToolsCheckPlannedDepthsNonQC = uimenu(hToolsCheckPlannedDepths, 'label', 'all data');
hToolsCheckPlannedDepthsQC = uimenu(hToolsCheckPlannedDepths, 'label', 'only good and non QC''d data');
hToolsCheckPressDiffs = uimenu(hToolsMenu, 'label', 'Check pressure differences between selected instrument and nearest neighbours');
hToolsCheckPressDiffsNonQC = uimenu(hToolsCheckPressDiffs, 'label', 'non QC');
hToolsCheckPressDiffsQC = uimenu(hToolsCheckPressDiffs, 'label', 'QC');
hToolsCheckPressDiffsNonQC = uimenu(hToolsCheckPressDiffs, 'label', 'all data');
hToolsCheckPressDiffsQC = uimenu(hToolsCheckPressDiffs, 'label', 'only good and non QC''d data');
hToolsLineDepth = uimenu(hToolsMenu, 'label', 'Line plot mooring''s depths');
hToolsLineDepthNonQC = uimenu(hToolsLineDepth, 'label', 'non QC');
hToolsLineDepthQC = uimenu(hToolsLineDepth, 'label', 'QC');
hToolsLineDepthNonQC = uimenu(hToolsLineDepth, 'label', 'all data');
hToolsLineDepthQC = uimenu(hToolsLineDepth, 'label', 'only good and non QC''d data');
hToolsLineCommonVar = uimenu(hToolsMenu, 'label', 'Line plot mooring''s 1D variables');
hToolsLineCommonVarNonQC = uimenu(hToolsLineCommonVar, 'label', 'non QC');
hToolsLineCommonVarQC = uimenu(hToolsLineCommonVar, 'label', 'QC');
hToolsLineCommonVarNonQC = uimenu(hToolsLineCommonVar, 'label', 'all data');
hToolsLineCommonVarQC = uimenu(hToolsLineCommonVar, 'label', 'only good and non QC''d data');
hToolsScatterCommonVar = uimenu(hToolsMenu, 'label', 'Scatter plot mooring''s 1D variables VS depth');
hToolsScatterCommonVarNonQC = uimenu(hToolsScatterCommonVar, 'label', 'non QC');
hToolsScatterCommonVarQC = uimenu(hToolsScatterCommonVar, 'label', 'QC');
hToolsScatterCommonVarNonQC = uimenu(hToolsScatterCommonVar, 'label', 'all data');
hToolsScatterCommonVarQC = uimenu(hToolsScatterCommonVar, 'label', 'only good and non QC''d data');
hToolsScatter2DCommonVar = uimenu(hToolsMenu, 'label', 'Scatter plot mooring''s 2D variables VS depth');
hToolsScatter2DCommonVarNonQC = uimenu(hToolsScatter2DCommonVar, 'label', 'non QC');
hToolsScatter2DCommonVarQC = uimenu(hToolsScatter2DCommonVar, 'label', 'QC');
hToolsScatter2DCommonVarNonQC = uimenu(hToolsScatter2DCommonVar, 'label', 'all data');
hToolsScatter2DCommonVarQC = uimenu(hToolsScatter2DCommonVar, 'label', 'only good and non QC''d data');

%set menu callbacks
set(hToolsCheckPlannedDepthsNonQC, 'callBack', {@displayCheckPlannedDepths, false});
Expand All @@ -311,8 +311,8 @@ function mainWindow(...
set(hToolsScatter2DCommonVarQC, 'callBack', {@displayScatterMooringVar, true, false});
case 'profile'
hToolsLineCastVar = uimenu(hToolsMenu, 'label', 'Line plot profile variables');
hToolsLineCastVarNonQC = uimenu(hToolsLineCastVar, 'label', 'non QC');
hToolsLineCastVarQC = uimenu(hToolsLineCastVar, 'label', 'QC');
hToolsLineCastVarNonQC = uimenu(hToolsLineCastVar, 'label', 'all data');
hToolsLineCastVarQC = uimenu(hToolsLineCastVar, 'label', 'only good and non QC''d data');

%set menu callbacks
set(hToolsLineCastVarNonQC, 'callBack', {@displayLineCastVar, false});
Expand Down Expand Up @@ -587,8 +587,6 @@ function displayLineCastVar(source,ev, isQC)
%DISPLAYLINECASTVAR Opens a new window where all the
% variables collected by the CTD cast are line-plotted.
%
stringQC = 'non QC';
if isQC; stringQC = 'QC'; end

% get all params names
lenSampleData = length(sample_data);
Expand Down
5 changes: 3 additions & 2 deletions GUI/startDialog.m
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,11 @@

% retrieve all field trip IDs; they are displayed as a drop down menu
if isCSV
fieldTrips = executeCSVQuery('FieldTrip', [], []);
executeQueryFunc = @executeCSVQuery;
else
fieldTrips = executeDDBQuery('FieldTrip', [], []);
executeQueryFunc = @executeDDBQuery;
end
fieldTrips = executeQueryFunc('FieldTrip', [], []);

if isempty(fieldTrips), error('No field trip entries in DDB'); end

Expand Down
2 changes: 1 addition & 1 deletion GUI/updateViewMetadata.m
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ function updateTable(data, prefix, tempType, dateFmt, mode)

% make sure numeric values are not rounded (too much)
case 'N',
data{i,2} = sprintf('%.10f', data{i,2});
data{i,2} = sprintf('%.10f ', data{i,2});

% make everything else a string - i'm assuming that when
% num2str is passed a string, it will return that string
Expand Down
8 changes: 6 additions & 2 deletions GUI/viewMetadata.m
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ function viewMetadata(parent, sample_data, updateCallback, repCallback, mode)

% make sure numeric values are not rounded (too much)
case 'N',
data{i,2} = sprintf('%.10g', data{i,2});
data{i,2} = sprintf('%.10g ', data{i,2});

% make everything else a string - i'm assuming that when
% num2str is passed a string, it will return that string
Expand Down Expand Up @@ -435,13 +435,17 @@ function applyUpdate(prefix, templateDir, fieldName, fieldValue, tempType)

% numbers are just numbers
case 'N'
temp = str2double(fieldValue);
temp = str2num(fieldValue); %#ok<ST2NM> str2num used on purpose to deal with arrays

% reject anything that is not a number
if isempty(temp)
error([fieldName ' must be a number']);
end

if length(temp) > 1
fieldValue = ['[' fieldValue ']'];
end

% qc flag is different depending on qc set in use
case 'Q'

Expand Down
26 changes: 16 additions & 10 deletions Graph/checkMooringPlannedDepths.m
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,26 @@ function checkMooringPlannedDepths(sample_data, isQC, saveToFile, exportDir)
if ~islogical(saveToFile), error('saveToFile must be a logical'); end
if ~ischar(exportDir), error('exportDir must be a string'); end

monitorRect = getRectMonitor();
iBigMonitor = getBiggestMonitor();

varTitle = imosParameters('DEPTH', 'long_name');
varUnit = imosParameters('DEPTH', 'uom');

stringQC = 'non QC';
if isQC, stringQC = 'QC'; end
stringQC = 'all';
if isQC, stringQC = 'only good and non QC''d'; end

%plot depth information
monitorRect = getRectMonitor();
iBigMonitor = getBiggestMonitor();
title = [sample_data{1}.deployment_code ' mooring planned vs measured ' stringQC ' ' varTitle];

title = [sample_data{1}.deployment_code ' mooring planned depth vs measured depth ' stringQC '''d good ' varTitle];
% retrieve good flag values
qcSet = str2double(readProperty('toolbox.qc_set'));
rawFlag = imosQCFlag('raw', qcSet, 'flag');
goodFlag = imosQCFlag('good', qcSet, 'flag');
pGoodFlag = imosQCFlag('probablyGood', qcSet, 'flag');
goodFlags = [rawFlag, goodFlag, pGoodFlag];

%extract the essential data and
%sort instruments by depth
% extract the essential data and
% sort instruments by depth
lenSampleData = length(sample_data);
instrumentDesc = cell(lenSampleData, 1);
hLineVar = nan(lenSampleData, 1);
Expand Down Expand Up @@ -112,8 +118,8 @@ function checkMooringPlannedDepths(sample_data, isQC, saveToFile, exportDir)
timeFlags = sample_data{i}.dimensions{iTime}.flags;
presFlags = sample_data{i}.variables{iPresRel}.flags;

iGood = (timeFlags == 0 | timeFlags == 1 | timeFlags == 2) ...
& (presFlags == 1 | presFlags == 2);
iGood = ismember(timeFlags, goodFlags) ...
& ismember(presFlags, goodFlags);
end

if all(~iGood) && isQC
Expand Down
24 changes: 15 additions & 9 deletions Graph/checkMooringPresDiffs.m
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,27 @@ function checkMooringPresDiffs(sample_data, iSampleMenu, isQC, saveToFile, expor
if ~islogical(saveToFile), error('saveToFile must be a logical'); end
if ~ischar(exportDir), error('exportDir must be a string'); end

monitorRect = getRectMonitor();
iBigMonitor = getBiggestMonitor();

presRelCode = 'PRES_REL';
presCode = 'PRES';
varTitle = imosParameters(presRelCode, 'long_name');
varUnit = imosParameters(presRelCode, 'uom');

stringQC = 'non QC';
if isQC, stringQC = 'QC'; end
stringQC = 'all';
if isQC, stringQC = 'only good and non QC''d'; end

%plot depth information
monitorRect = getRectMonitor();
iBigMonitor = getBiggestMonitor();
title = [sample_data{1}.deployment_code ' mooring ' stringQC ' ' varTitle ' differences'];

title = [sample_data{1}.deployment_code ' mooring pressure differences ' stringQC '''d ' varTitle];
% retrieve good flag values
qcSet = str2double(readProperty('toolbox.qc_set'));
rawFlag = imosQCFlag('raw', qcSet, 'flag');
goodFlag = imosQCFlag('good', qcSet, 'flag');
pGoodFlag = imosQCFlag('probablyGood', qcSet, 'flag');
goodFlags = [rawFlag, goodFlag, pGoodFlag];

%sort instruments by depth
% sort instruments by depth
lenSampleData = length(sample_data);
instrumentDesc = cell(lenSampleData, 1);
metaDepth = nan(lenSampleData, 1);
Expand Down Expand Up @@ -186,7 +192,7 @@ function checkMooringPresDiffs(sample_data, iSampleMenu, isQC, saveToFile, expor
timeFlags = sample_data{iCurrSam}.dimensions{iCurrTime}.flags;
varFlags = sample_data{iCurrSam}.variables{iCurrPresRel}.flags;

iGood = (timeFlags == 0 | timeFlags == 1 | timeFlags == 2) & (varFlags == 1 | varFlags == 2);
iGood = ismember(timeFlags, goodFlags) & ismember(varFlags, goodFlags);
end

curSamTime(~iGood) = NaN;
Expand Down Expand Up @@ -235,7 +241,7 @@ function checkMooringPresDiffs(sample_data, iSampleMenu, isQC, saveToFile, expor
timeFlags = sample_data{iOthers(i)}.dimensions{iOtherTime}.flags;
varFlags = sample_data{iOthers(i)}.variables{iOtherPresRel}.flags;

iGood = (timeFlags == 0 | timeFlags == 1 | timeFlags == 2) & (varFlags == 1 | varFlags == 2);
iGood = ismember(timeFlags, goodFlags) & ismember(varFlags, goodFlags);
end

if all(~iGood) && isQC
Expand Down
6 changes: 1 addition & 5 deletions Graph/lineCastVar.m
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,6 @@ function lineCastVar(sample_data, varNames, isQC, saveToFile, exportDir)

title = [sample_data{1}.site_code ' profile on ' datestr(sample_data{1}.time_coverage_start, 'yyyy-mm-dd UTC')];

lineStyle = {'-', '--', ':', '-.'};
lenLineStyle = length(lineStyle);

initiateFigure = true;

lenVarNames = length(varNames);
Expand Down Expand Up @@ -169,8 +166,7 @@ function lineCastVar(sample_data, varNames, isQC, saveToFile, exportDir)

hLineVar(i + 1) = line(dataVar, ...
yLine, ...
'Color', cMap(i, :), ...
'LineStyle', lineStyle{mod(i, lenLineStyle)+1});
'Color', cMap(i, :));

xLim = get(hAxCastVar, 'XLim');
yLim = get(hAxCastVar, 'YLim');
Expand Down
40 changes: 23 additions & 17 deletions Graph/lineMooring1DVar.m
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,25 @@ function lineMooring1DVar(sample_data, varName, isQC, saveToFile, exportDir)
if ~islogical(saveToFile), error('saveToFile must be a logical'); end
if ~ischar(exportDir), error('exportDir must be a string'); end

monitorRect = getRectMonitor();
iBigMonitor = getBiggestMonitor();

varTitle = imosParameters(varName, 'long_name');
varUnit = imosParameters(varName, 'uom');

stringQC = 'non QC';
if isQC, stringQC = 'QC'; end
stringQC = 'all';
if isQC, stringQC = 'only good and non QC''d'; end

%plot depth information
monitorRect = getRectMonitor();
iBigMonitor = getBiggestMonitor();
title = [sample_data{1}.deployment_code ' mooring''s instruments ' stringQC ' ' varTitle];

title = [sample_data{1}.deployment_code ' mooring''s instruments ' stringQC '''d good ' varTitle];
% retrieve good flag values
qcSet = str2double(readProperty('toolbox.qc_set'));
rawFlag = imosQCFlag('raw', qcSet, 'flag');
goodFlag = imosQCFlag('good', qcSet, 'flag');
pGoodFlag = imosQCFlag('probablyGood', qcSet, 'flag');
goodFlags = [rawFlag, goodFlag, pGoodFlag];

%sort instruments by depth
% sort instruments by depth
lenSampleData = length(sample_data);
metaDepth = nan(lenSampleData, 1);
xMin = nan(lenSampleData, 1);
Expand All @@ -90,7 +96,7 @@ function lineMooring1DVar(sample_data, varName, isQC, saveToFile, exportDir)
timeFlags = sample_data{i}.dimensions{iTime}.flags;
varFlags = sample_data{i}.variables{iVar}.flags;

iGood = (timeFlags == 1 | timeFlags == 2) & (varFlags == 1 | varFlags == 2);
iGood = ismember(timeFlags, goodFlags) & ismember(varFlags, goodFlags);
end

if iVar
Expand All @@ -105,9 +111,6 @@ function lineMooring1DVar(sample_data, varName, isQC, saveToFile, exportDir)
xMin = min(xMin);
xMax = max(xMax);

lineStyle = {'-', '--', ':', '-.'};
lenLineStyle = length(lineStyle);

instrumentDesc = cell(lenSampleData + 1, 1);
hLineVar = nan(lenSampleData + 1, 1);

Expand Down Expand Up @@ -199,7 +202,7 @@ function lineMooring1DVar(sample_data, varName, isQC, saveToFile, exportDir)
timeFlags = sample_data{iSort(i)}.dimensions{iTime}.flags;
varFlags = sample_data{iSort(i)}.variables{iVar}.flags;

iGood = (timeFlags == 1 | timeFlags == 2) & (varFlags == 1 | varFlags == 2);
iGood = ismember(timeFlags, goodFlags) & ismember(varFlags, goodFlags);
end

if all(~iGood) && isQC
Expand All @@ -217,8 +220,7 @@ function lineMooring1DVar(sample_data, varName, isQC, saveToFile, exportDir)

hLineVar(i + 1) = line(xLine, ...
dataVar, ...
'Color', cMap(i, :), ...
'LineStyle', lineStyle{mod(i, lenLineStyle)+1});
'Color', cMap(i, :));
userData.idx = iSort(i);
userData.xName = 'TIME';
userData.yName = varName;
Expand Down Expand Up @@ -346,13 +348,13 @@ function lineMooring1DVar(sample_data, varName, isQC, saveToFile, exportDir)
end

if strcmp(xName, 'TIME')
xStr = datestr(posClic(1),'yyyy-mm-dd HH:MM:SS.FFF');
xStr = datestr(posClic(1),'dd-mm-yyyy HH:MM:SS.FFF');
else
xStr = [num2str(posClic(1)) ' ' xUnits];
end

if strcmp(yName, 'TIME')
yStr = datestr(posClic(2),'yyyy-mm-dd HH:MM:SS.FFF');
yStr = datestr(posClic(2),'dd-mm-yyyy HH:MM:SS.FFF');
else
yStr = [num2str(posClic(2)) ' (' yUnits ')']; %num2str(posClic(2),4)
end
Expand All @@ -365,7 +367,11 @@ function lineMooring1DVar(sample_data, varName, isQC, saveToFile, exportDir)

%%
function zoomDateTick(obj,event_obj,hAx)
datetick(hAx,'x','dd-mm-yy HH:MM:SS','keeplimits')
xLim = get(hAx, 'XLim');
currXTicks = get(hAx, 'xtick');
newXTicks = linspace(xLim(1), xLim(2), length(currXTicks));
set(hAx, 'xtick', newXTicks);
datetick(hAx,'x','dd-mm-yy HH:MM:SS','keepticks');
end

end
1 change: 0 additions & 1 deletion Graph/lineMooring2DVarSection.m
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ function lineMooring2DVarSection(sample_data, varName, timeValue, isQC, saveToFi
if ~islogical(saveToFile), error('saveToFile must be a logical'); end
if ~ischar(exportDir), error('exportDir must be a string'); end

%plot depth information
monitorRect = getRectMonitor();
iBigMonitor = getBiggestMonitor();

Expand Down
12 changes: 9 additions & 3 deletions Graph/pcolorMooring2DVar.m
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,18 @@ function pcolorMooring2DVar(sample_data, varName, isQC, saveToFile, exportDir)
stringQC = 'non QC';
if isQC, stringQC = 'QC'; end

%plot depth information
monitorRect = getRectMonitor();
iBigMonitor = getBiggestMonitor();

title = [sample_data{1}.deployment_code ' mooring''s instruments ' stringQC '''d good ' varTitle];

% retrieve good flag values
qcSet = str2double(readProperty('toolbox.qc_set'));
rawFlag = imosQCFlag('raw', qcSet, 'flag');
goodFlag = imosQCFlag('good', qcSet, 'flag');
pGoodFlag = imosQCFlag('probablyGood', qcSet, 'flag');
goodFlags = [rawFlag, goodFlag, pGoodFlag];

%sort instruments by depth
lenSampleData = length(sample_data);
metaDepth = nan(lenSampleData, 1);
Expand Down Expand Up @@ -180,11 +186,11 @@ function pcolorMooring2DVar(sample_data, varName, isQC, saveToFile, exportDir)
timeFlags = sample_data{iSort(i)}.dimensions{iTime}.flags;
varFlags = sample_data{iSort(i)}.variables{iVar}.flags;

iGoodTime = (timeFlags == 1 | timeFlags == 2);
iGoodTime = ismember(timeFlags, goodFlags);
nGoodTime = sum(iGoodTime);

iGood = repmat(iGoodTime, [1, size(sample_data{iSort(i)}.variables{iVar}.data, 2)]);
iGood = iGood & (varFlags == 1 | varFlags == 2);
iGood = iGood & ismember(varFlags, goodFlags);

iGoodHeight = any(iGood, 1);
nGoodHeight = sum(iGoodHeight);
Expand Down
Loading

0 comments on commit 9989efc

Please sign in to comment.