diff --git a/AutomaticQC/imosImpossibleDepthQC.m b/AutomaticQC/imosImpossibleDepthQC.m index 5770c2c9a..1058205c6 100644 --- a/AutomaticQC/imosImpossibleDepthQC.m +++ b/AutomaticQC/imosImpossibleDepthQC.m @@ -100,9 +100,8 @@ depthInfos = {'DEPTH', 'PRES_REL', 'PRES'}; if ~any(strcmpi(paramName, depthInfos)), return; end -% get the toolbox execution mode. Values can be 'timeSeries' and 'profile'. -% If no value is set then default mode is 'timeSeries' -mode = lower(readProperty('toolbox.mode')); +% get the toolbox execution mode +mode = readProperty('toolbox.mode'); switch mode case 'profile' @@ -198,7 +197,7 @@ end end - otherwise % 'timeSeries' + case 'timeSeries' % this test doesn't apply on dimensions if ~strcmp(type, 'variables'), return; end diff --git a/AutomaticQC/imosInOutWaterQC.m b/AutomaticQC/imosInOutWaterQC.m index 7f9f1fd6a..0353752dd 100644 --- a/AutomaticQC/imosInOutWaterQC.m +++ b/AutomaticQC/imosInOutWaterQC.m @@ -92,9 +92,8 @@ end time = sample_data.(tTime){iTime}.data; -% get the toolbox execution mode. Values can be 'timeSeries' and 'profile'. -% If no value is set then default mode is 'timeSeries' -mode = lower(readProperty('toolbox.mode')); +% get the toolbox execution mode +mode = readProperty('toolbox.mode'); switch mode case 'profile' @@ -110,7 +109,7 @@ error(['TIME value ' datestr(time, 'yyyy-mm-dd HH:MM:SS') ' is greater than time_deployment_end ' datestr(time_out_water, 'yyyy-mm-dd HH:MM:SS') ' => Check ddb station time values against data file time values!']); end - otherwise % 'timeSeries' + case 'timeSeries' qcSet = str2double(readProperty('toolbox.qc_set')); rawFlag = imosQCFlag('raw', qcSet, 'flag'); failFlag = imosQCFlag('bad', qcSet, 'flag'); diff --git a/AutomaticQC/imosRegionalRangeQC.m b/AutomaticQC/imosRegionalRangeQC.m index 46c348588..aea8d6b7f 100644 --- a/AutomaticQC/imosRegionalRangeQC.m +++ b/AutomaticQC/imosRegionalRangeQC.m @@ -87,7 +87,6 @@ % site = sample_data.meta.site_name; % source = ddb % if strcmpi(site, 'UNKNOWN'), site = sample_data.site_code; end % source = global_attributes file site = sample_data.site_code; -site = imosSites(site); % test if site information exists if isempty(site) @@ -121,11 +120,11 @@ end % read values from imosRegionalRangeQC properties file - [regionalMin, regionalMax, isSite] = getImosRegionalRange(site.name, paramName); + [regionalMin, regionalMax, isSite] = getImosRegionalRange(site, paramName); if ~isSite fprintf('%s\n', ['Warning : ' 'File imosRegionalRangeQC.txt is not documented '... - 'for site ' site.name]); + 'for site ' site]); else if ~isnan(regionalMin) % get the flag values with which we flag good and out of range data diff --git a/AutomaticQC/imosVerticalVelocityQC.m b/AutomaticQC/imosVerticalVelocityQC.m index da2ca6957..48419b23a 100644 --- a/AutomaticQC/imosVerticalVelocityQC.m +++ b/AutomaticQC/imosVerticalVelocityQC.m @@ -73,7 +73,7 @@ % get all necessary dimensions and variables id in sample_data struct idWcur = 0; paramName = sample_data.(type){k}.name; -if strcmpi(paramName, 'WCUR'), idWcur = k; end +if strncmpi(paramName, 'WCUR', 4), idWcur = k; end % check if the data is compatible with the QC algorithm idMandatory = idWcur; diff --git a/FlowManager/autoIMOSToolbox.m b/FlowManager/autoIMOSToolbox.m index be38e602e..aab53c3a0 100644 --- a/FlowManager/autoIMOSToolbox.m +++ b/FlowManager/autoIMOSToolbox.m @@ -65,27 +65,16 @@ function autoIMOSToolbox(toolboxVersion, fieldTrip, dataDir, ppChain, qcChain, e % narginchk(1, 6); -% get the toolbox execution mode. Values can be 'timeSeries' and 'profile'. -% If no value is set then default mode is 'timeSeries' -mode = lower(readProperty('toolbox.mode')); +% get the toolbox execution mode. +mode = readProperty('toolbox.mode'); % validate and save field trip if nargin > 1 if isnumeric(fieldTrip), error('field trip must be a string'); end - switch mode - case 'profile' - writeProperty('startDialog.fieldTrip.profile', fieldTrip); - otherwise - writeProperty('startDialog.fieldTrip.timeSeries', fieldTrip); - end + writeProperty(['startDialog.fieldTrip.' mode], fieldTrip); else try - switch mode - case 'profile' - fieldTrip = readProperty('startDialog.fieldTrip.profile'); - otherwise - fieldTrip = readProperty('startDialog.fieldTrip.timeSeries'); - end + fieldTrip = readProperty(['startDialog.fieldTrip.' mode]); catch e end end @@ -95,20 +84,10 @@ function autoIMOSToolbox(toolboxVersion, fieldTrip, dataDir, ppChain, qcChain, e if ~ischar(dataDir), error('dataDir must be a string'); end if ~exist(dataDir, 'dir'), error('dataDir must be a directory'); end - switch mode - case 'profile' - writeProperty('startDialog.dataDir.profile', dataDir); - otherwise - writeProperty('startDialog.dataDir.timeSeries', dataDir); - end + writeProperty(['startDialog.dataDir.' mode], dataDir); else try - switch mode - case 'profile' - dataDir = readProperty('startDialog.dataDir.profile'); - otherwise - dataDir = readProperty('startDialog.dataDir.timeSeries'); - end + dataDir = readProperty(['startDialog.dataDir.' mode]); catch e end end @@ -134,12 +113,7 @@ function autoIMOSToolbox(toolboxVersion, fieldTrip, dataDir, ppChain, qcChain, e ppChainStr = ''; end - switch mode - case 'profile' - writeProperty('preprocessManager.preprocessChain.profile', ppChainStr); - otherwise - writeProperty('preprocessManager.preprocessChain.timeSeries', ppChainStr); - end + writeProperty(['preprocessManager.preprocessChain.' mode], ppChainStr); end % validate and save qc chain @@ -163,12 +137,7 @@ function autoIMOSToolbox(toolboxVersion, fieldTrip, dataDir, ppChain, qcChain, e qcChainStr = ''; end - switch mode - case 'profile' - writeProperty('autoQCManager.autoQCChain.profile', qcChainStr); - otherwise - writeProperty('autoQCManager.autoQCChain.timeSeries', qcChainStr); - end + writeProperty(['autoQCManager.autoQCChain.' mode], qcChainStr); end % validate and save export dir @@ -189,15 +158,11 @@ function autoIMOSToolbox(toolboxVersion, fieldTrip, dataDir, ppChain, qcChain, e [~, sourceFolder] = fileparts(dataDir); fprintf('%s\n', ['Processing field trip ' fieldTrip ' from folder ' sourceFolder]); -% get the toolbox execution mode. Values can be 'timeSeries' and 'profile'. -% If no value is set then default mode is 'timeSeries' -mode = lower(readProperty('toolbox.mode')); - % get infos from current field trip switch mode case 'profile' [~, deps, sits, dataDir] = getCTDs(true); - otherwise + case 'timeSeries' [~, deps, sits, dataDir] = getDeployments(true); end diff --git a/FlowManager/autoQCManager.m b/FlowManager/autoQCManager.m index c5abd0c8a..9fe97fee5 100644 --- a/FlowManager/autoQCManager.m +++ b/FlowManager/autoQCManager.m @@ -75,7 +75,7 @@ % get last filter chain if there is one try - % get the toolbox execution mode. Values can be 'timeSeries' and 'profile'. + % get the toolbox execution mode mode = readProperty('toolbox.mode'); qcChain = textscan(readProperty(['autoQCManager.autoQCChain.' mode]), '%s'); qcChain = qcChain{1}; @@ -227,8 +227,7 @@ qcRoutines = listAutoQCRoutines(); qcChain = {}; - % get the toolbox execution mode. Values can be 'timeSeries' and 'profile'. - % If no value is set then default mode is 'timeSeries' + % get the toolbox execution mode mode = readProperty('toolbox.mode'); % get default filter chain if there is one diff --git a/FlowManager/displayManager.m b/FlowManager/displayManager.m index 022b971db..492bfd39c 100644 --- a/FlowManager/displayManager.m +++ b/FlowManager/displayManager.m @@ -115,9 +115,8 @@ function displayManager(windowTitle, sample_data, callbacks) qcSet = str2double(readProperty('toolbox.qc_set')); badFlag = imosQCFlag('bad', qcSet, 'flag'); - % get the toolbox execution mode. Values can be 'timeSeries' and 'profile'. - % If no value is set then default mode is 'timeSeries' - mode = lower(readProperty('toolbox.mode')); + % get the toolbox execution mode + mode = readProperty('toolbox.mode'); % define the user options, and create the main window states = {'Import', 'Metadata', 'Raw data', 'QC data', 'QC stats', 'Reset manual QC' ... @@ -240,7 +239,7 @@ function rawDataCallback() switch mode case 'profile' nVar = length(sample_data{setIdx}.variables) - 5; - otherwise + case 'timeSeries' nVar = length(sample_data{setIdx}.variables) - 3; end vars(vars > nVar) = []; diff --git a/FlowManager/exportManager.m b/FlowManager/exportManager.m index 416fbaebb..4b3999b22 100644 --- a/FlowManager/exportManager.m +++ b/FlowManager/exportManager.m @@ -75,9 +75,8 @@ function exportManager(dataSets, levelNames, output, auto) otherwise, error(['unknown output type: ' output]); end - % get the toolbox execution mode. Values can be 'timeSeries' and 'profile'. - % If no value is set then default mode is 'timeSeries' - mode = lower(readProperty('toolbox.mode')); + % get the toolbox execution mode + mode = readProperty('toolbox.mode'); setNames = {}; for k = 1:numSets @@ -246,38 +245,39 @@ function exportQCPlots(sample_data, exportDir, mode, auto, progress) paramsName = unique(paramsName); -if strcmpi(mode, 'timeseries') - % we get rid of specific parameters - notNeededParams = {'TIMESERIES', 'PROFILE', 'TRAJECTORY', 'LATITUDE', 'LONGITUDE', 'NOMINAL_DEPTH'}; - for i=1:length(notNeededParams) - iNotNeeded = strcmpi(paramsName, notNeededParams{i}); - paramsName(iNotNeeded) = []; - end - - % timeseries specific plots - nParams = length(paramsName); - for i=1:nParams - if ~auto - waitbar(i / nParams, progress, ['Exporting ' paramsName{i} ' plots']); +switch mode + case 'timeSeries' + % we get rid of specific parameters + notNeededParams = {'TIMESERIES', 'PROFILE', 'TRAJECTORY', 'LATITUDE', 'LONGITUDE', 'NOMINAL_DEPTH'}; + for i=1:length(notNeededParams) + iNotNeeded = strcmpi(paramsName, notNeededParams{i}); + paramsName(iNotNeeded) = []; end + + % timeseries specific plots + nParams = length(paramsName); + for i=1:nParams + if ~auto + waitbar(i / nParams, progress, ['Exporting ' paramsName{i} ' plots']); + end + try + lineMooring1DVar(sample_data, paramsName{i}, true, true, exportDir); + scatterMooring1DVarAgainstDepth(sample_data, paramsName{i}, true, true, exportDir); + scatterMooring2DVarAgainstDepth(sample_data, paramsName{i}, true, true, exportDir); + %pcolorMooring2DVar(sample_data, paramsName{i}, true, true, exportDir); + catch e + errorString = getErrorString(e); + fprintf('%s\n', ['Error says : ' errorString]); + end + end + case 'profile' + % profile specific plots try - lineMooring1DVar(sample_data, paramsName{i}, true, true, exportDir); - scatterMooring1DVarAgainstDepth(sample_data, paramsName{i}, true, true, exportDir); - scatterMooring2DVarAgainstDepth(sample_data, paramsName{i}, true, true, exportDir); - %pcolorMooring2DVar(sample_data, paramsName{i}, true, true, exportDir); + lineCastVar(sample_data, paramsName, true, true, exportDir); catch e errorString = getErrorString(e); fprintf('%s\n', ['Error says : ' errorString]); end - end -else - % profile specific plots - try - lineCastVar(sample_data, paramsName, true, true, exportDir); - catch e - errorString = getErrorString(e); - fprintf('%s\n', ['Error says : ' errorString]); - end end diff --git a/FlowManager/flowManager.m b/FlowManager/flowManager.m index e6332b07c..f70433b5b 100644 --- a/FlowManager/flowManager.m +++ b/FlowManager/flowManager.m @@ -43,9 +43,8 @@ function flowManager(toolboxVersion) lastAutoQCSetIdx = 0; - % get the toolbox execution mode. Values can be 'timeSeries' and 'profile'. - % If no value is set then default mode is 'timeSeries' - mode = lower(readProperty('toolbox.mode')); + % get the toolbox execution mode + mode = readProperty('toolbox.mode'); % import data nonUTCRawData = importManager(toolboxVersion); diff --git a/FlowManager/importManager.m b/FlowManager/importManager.m index 3a36969d1..5f8804da8 100644 --- a/FlowManager/importManager.m +++ b/FlowManager/importManager.m @@ -78,14 +78,17 @@ driver = readProperty('toolbox.ddb.driver'); connection = readProperty('toolbox.ddb.connection'); + % get the toolbox execution mode + mode = readProperty('toolbox.mode'); + sample_data = {}; rawFiles = {}; if ~isempty(ddb) || (~isempty(driver) && ~isempty(connection)) - [structs rawFiles] = ddbImport(auto, iMooring, ddb); + [structs rawFiles] = ddbImport(auto, iMooring, ddb, mode); else if auto, error('manual import cannot be automated without deployment database'); end - [structs rawFiles] = manualImport(); + [structs rawFiles] = manualImport(mode); end % user cancelled @@ -115,10 +118,13 @@ end end -function [sample_data rawFile]= manualImport() +function [sample_data rawFile]= manualImport(mode) %MANUALIMPORT Imports a data set by manually prompting the user to select a % raw file, and a parser with which to import it. % +% Input: +% mode - toolbox execution mode. +% % Outputs: % sample_data - cell array containig a single imported data set, or empty % cell array if the user cancelled. @@ -131,10 +137,6 @@ manualDir = readProperty('importManager.manualDir'); if isempty(manualDir), manualDir = pwd; end - % get the toolbox execution mode. Values can be 'timeSeries' and 'profile'. - % If no value is set then default mode is 'timeSeries' - mode = lower(readProperty('toolbox.mode')); - while true % prompt the user to select a data file @@ -191,7 +193,7 @@ end end -function [sample_data rawFiles] = ddbImport(auto, iMooring, ddb) +function [sample_data rawFiles] = ddbImport(auto, iMooring, ddb, mode) %DDBIMPORT Imports data sets using metadata retrieved from a deployment % database. % @@ -203,6 +205,7 @@ % from one mooring set of deployments. % ddb - deployment database string attribute from % toolboxProperties.txt +% mode - toolbox execution mode. % % Outputs: % sample_data - cell array containig the imported data sets, or empty @@ -214,15 +217,11 @@ rawFiles = {}; allFiles = {}; - % get the toolbox execution mode. Values can be 'timeSeries' and 'profile'. - % If no value is set then default mode is 'timeSeries' - mode = lower(readProperty('toolbox.mode')); - while true switch mode case 'profile' [fieldTrip deps sits dataDir] = getCTDs(auto); % one entry is one CTD profile instrument file - otherwise + case 'timeSeries' [fieldTrip deps sits dataDir] = getDeployments(auto); % one entry is one moored instrument file end @@ -287,7 +286,7 @@ switch mode case 'profile' deps(~iSelectedSite) = []; - otherwise + case 'timeSeries' deps(~iSelectedSite) = []; sits(~iSelectedSite) = []; end @@ -303,7 +302,7 @@ switch mode case 'profile' id = deps(k).FieldTrip; - otherwise + case 'timeSeries' id = deps(k).DeploymentId; end @@ -372,7 +371,7 @@ switch mode case 'profile' sample_data{end}{m}.meta.profile = deps(k); - otherwise + case 'timeSeries' sample_data{end}{m}.meta.deployment = deps(k); sample_data{end}{m}.meta.site = sits(k); end @@ -382,7 +381,7 @@ switch mode case 'profile' sample_data{end}.meta.profile = deps(k); - otherwise + case 'timeSeries' sample_data{end}.meta.deployment = deps(k); sample_data{end}.meta.site = sits(k); end @@ -403,7 +402,7 @@ fprintf('\t%s\n', ['InstrumentID = ' deps(k).InstrumentID]); errorString = getErrorString(e); fprintf('%s\n', ['Error says : ' errorString]); - otherwise + case 'timeSeries' fprintf('%s\n', ['Warning : skipping ' deps(k).FileName]); fprintf('\t%s\n', ['EndFieldTrip = ' deps(k).EndFieldTrip]); fprintf('\t%s\n', ['SiteName = ' sits(k).SiteName]); @@ -428,7 +427,7 @@ % files - Cell array containing file names. % parsers - Cell array of strings containing all available parsers. % noParserPrompt - Whether to prompt the user if a parser cannot be found. - % mode - Toolbox data type mode ('profile' or 'timeSeries'). + % mode - Toolbox data type mode. % ddb - deployment database string attribute from % toolboxProperties.txt % diff --git a/FlowManager/preprocessManager.m b/FlowManager/preprocessManager.m index 3b699c186..0e9f5ae57 100644 --- a/FlowManager/preprocessManager.m +++ b/FlowManager/preprocessManager.m @@ -8,7 +8,7 @@ % Inputs: % sample_data - cell array of sample_data structs. % qcLevel - string, 'raw' or 'qc'. Some pp not applied when 'raw'. -% mode - string, 'timeSerie' or 'profile'. +% mode - string, toolbox execution mode. % auto - logical, check if pre-processing in batch mode. % % Outputs: @@ -78,14 +78,7 @@ % get default filter chain if there is one try - switch mode - case 'profile' - ppChain = ... - textscan(readProperty('preprocessManager.preprocessChain.profile'), '%s'); - otherwise - ppChain = ... - textscan(readProperty('preprocessManager.preprocessChain.timeSeries'), '%s'); - end + ppChain = textscan(readProperty(['preprocessManager.preprocessChain.' mode]), '%s'); ppChain = ppChain{1}; catch e end @@ -115,14 +108,8 @@ % save user's latest selection for next time - turn the ppChain % cell array into a space-separated string of the names ppChainStr = cellfun(@(x)([x ' ']), ppChain, 'UniformOutput', false); - switch mode - case 'profile' - writeProperty('preprocessManager.preprocessChain.profile', ... - deblank([ppChainStr{:}])); - otherwise - writeProperty('preprocessManager.preprocessChain.timeSeries', ... - deblank([ppChainStr{:}])); - end + writeProperty(['preprocessManager.preprocessChain.' mode], ... + deblank([ppChainStr{:}])); end if ~isempty(ppChain) @@ -198,8 +185,7 @@ ppRoutines = listPreprocessRoutines(); ppChain = {}; - % get the toolbox execution mode. Values can be 'timeSeries' and 'profile'. - % If no value is set then default mode is 'timeSeries' + % get the toolbox execution mode mode = readProperty('toolbox.mode'); % get default filter chain if there is one diff --git a/GUI/dataFileStatusDialog.m b/GUI/dataFileStatusDialog.m index 9cddce0a6..7a2bc7c5a 100644 --- a/GUI/dataFileStatusDialog.m +++ b/GUI/dataFileStatusDialog.m @@ -64,9 +64,8 @@ origDeployments = deployments; origFiles = files; - % get the toolbox execution mode. Values can be 'timeSeries' and 'profile'. - % If no value is set then default mode is 'timeSeries' - mode = lower(readProperty('toolbox.mode')); + % get the toolbox execution mode + mode = readProperty('toolbox.mode'); deploymentDescs = genDepDescriptions(deployments, files); @@ -80,9 +79,15 @@ case 'profile' % for a profile, sort by alphabetical order [deploymentDescs, iSort] = sort(deploymentDescs); - otherwise + case 'timeSeries' % for a mooring, sort instruments by depth - [~, iSort] = sort([deployments.InstrumentDepth]); + + % we have to handle the case when InstrumentDepth is not documented + instDepths = {deployments.InstrumentDepth}; + instDepths{cellfun(@isempty, instDepths)} = NaN; + instDepths = cell2mat(instDepths); + + [~, iSort] = sort(instDepths); deploymentDescs = deploymentDescs(iSort); end @@ -277,16 +282,9 @@ function fileAddCallback(source,ev) % Opens a dialog, allowing the user to select a file to add to the % deployment. % - switch mode - case 'profile' - [newFile path] = uigetfile('*', 'Select Data File',... - readProperty('startDialog.dataDir.profile'),... - 'MultiSelect', 'on'); - otherwise - [newFile path] = uigetfile('*', 'Select Data File',... - readProperty('startDialog.dataDir.timeSeries'),... - 'MultiSelect', 'on'); - end + [newFile path] = uigetfile('*', 'Select Data File',... + readProperty(['startDialog.dataDir.' mode]),... + 'MultiSelect', 'on'); % user cancelled dialog if newFile == 0, return; end diff --git a/GUI/mainWindow.m b/GUI/mainWindow.m index 154cb4121..d71ecdd93 100644 --- a/GUI/mainWindow.m +++ b/GUI/mainWindow.m @@ -122,14 +122,13 @@ function mainWindow(... 'Value', 1,... 'Tag', 'samplePopUpMenu'); - % get the toolbox execution mode. Values can be 'timeSeries' and 'profile'. - % If no value is set then default mode is 'timeSeries' - mode = lower(readProperty('toolbox.mode')); + % get the toolbox execution mode + mode = readProperty('toolbox.mode'); switch mode case 'profile' graphMenuValue = 2; - otherwise + case 'timeSeries' graphMenuValue = 1; end @@ -276,47 +275,48 @@ function mainWindow(... %set uimenu hToolsMenu = uimenu(fig, 'label', 'Tools'); - if strcmpi(mode, 'timeseries') - hToolsCheckPlannedDepths = uimenu(hToolsMenu, 'label', 'Check measured against planned depths'); - hToolsCheckPlannedDepthsNonQC = uimenu(hToolsCheckPlannedDepths, 'label', 'non QC'); - hToolsCheckPlannedDepthsQC = uimenu(hToolsCheckPlannedDepths, 'label', 'QC'); - hToolsCheckPressDiffs = uimenu(hToolsMenu, 'label', 'Check pressure differences between selected instrument and nearest neighbours'); - hToolsCheckPressDiffsNonQC = uimenu(hToolsCheckPressDiffs, 'label', 'non QC'); - hToolsCheckPressDiffsQC = uimenu(hToolsCheckPressDiffs, 'label', 'QC'); - hToolsLineDepth = uimenu(hToolsMenu, 'label', 'Line plot mooring''s depths'); - hToolsLineDepthNonQC = uimenu(hToolsLineDepth, 'label', 'non QC'); - hToolsLineDepthQC = uimenu(hToolsLineDepth, 'label', 'QC'); - hToolsLineCommonVar = uimenu(hToolsMenu, 'label', 'Line plot mooring''s 1D variables'); - hToolsLineCommonVarNonQC = uimenu(hToolsLineCommonVar, 'label', 'non QC'); - hToolsLineCommonVarQC = uimenu(hToolsLineCommonVar, 'label', 'QC'); - hToolsScatterCommonVar = uimenu(hToolsMenu, 'label', 'Scatter plot mooring''s 1D variables VS depth'); - hToolsScatterCommonVarNonQC = uimenu(hToolsScatterCommonVar, 'label', 'non QC'); - hToolsScatterCommonVarQC = uimenu(hToolsScatterCommonVar, 'label', 'QC'); - hToolsScatter2DCommonVar = uimenu(hToolsMenu, 'label', 'Scatter plot mooring''s 2D variables VS depth'); - hToolsScatter2DCommonVarNonQC = uimenu(hToolsScatter2DCommonVar, 'label', 'non QC'); - hToolsScatter2DCommonVarQC = uimenu(hToolsScatter2DCommonVar, 'label', 'QC'); - - %set menu callbacks - set(hToolsCheckPlannedDepthsNonQC, 'callBack', {@displayCheckPlannedDepths, false}); - set(hToolsCheckPlannedDepthsQC, 'callBack', {@displayCheckPlannedDepths, true}); - set(hToolsCheckPressDiffsNonQC, 'callBack', {@displayCheckPressDiffs, false}); - set(hToolsCheckPressDiffsQC, 'callBack', {@displayCheckPressDiffs, true}); - set(hToolsLineDepthNonQC, 'callBack', {@displayLineMooringDepth, false}); - set(hToolsLineDepthQC, 'callBack', {@displayLineMooringDepth, true}); - set(hToolsLineCommonVarNonQC, 'callBack', {@displayLineMooringVar, false}); - set(hToolsLineCommonVarQC, 'callBack', {@displayLineMooringVar, true}); - set(hToolsScatterCommonVarNonQC, 'callBack', {@displayScatterMooringVar, false, true}); - set(hToolsScatterCommonVarQC, 'callBack', {@displayScatterMooringVar, true, true}); - set(hToolsScatter2DCommonVarNonQC, 'callBack', {@displayScatterMooringVar, false, false}); - set(hToolsScatter2DCommonVarQC, 'callBack', {@displayScatterMooringVar, true, false}); - else - hToolsLineCastVar = uimenu(hToolsMenu, 'label', 'Line plot profile variables'); - hToolsLineCastVarNonQC = uimenu(hToolsLineCastVar, 'label', 'non QC'); - hToolsLineCastVarQC = uimenu(hToolsLineCastVar, 'label', 'QC'); - - %set menu callbacks - set(hToolsLineCastVarNonQC, 'callBack', {@displayLineCastVar, false}); - set(hToolsLineCastVarQC, 'callBack', {@displayLineCastVar, true}); + switch mode + case 'timeSeries' + hToolsCheckPlannedDepths = uimenu(hToolsMenu, 'label', 'Check measured against planned depths'); + hToolsCheckPlannedDepthsNonQC = uimenu(hToolsCheckPlannedDepths, 'label', 'non QC'); + hToolsCheckPlannedDepthsQC = uimenu(hToolsCheckPlannedDepths, 'label', 'QC'); + hToolsCheckPressDiffs = uimenu(hToolsMenu, 'label', 'Check pressure differences between selected instrument and nearest neighbours'); + hToolsCheckPressDiffsNonQC = uimenu(hToolsCheckPressDiffs, 'label', 'non QC'); + hToolsCheckPressDiffsQC = uimenu(hToolsCheckPressDiffs, 'label', 'QC'); + hToolsLineDepth = uimenu(hToolsMenu, 'label', 'Line plot mooring''s depths'); + hToolsLineDepthNonQC = uimenu(hToolsLineDepth, 'label', 'non QC'); + hToolsLineDepthQC = uimenu(hToolsLineDepth, 'label', 'QC'); + hToolsLineCommonVar = uimenu(hToolsMenu, 'label', 'Line plot mooring''s 1D variables'); + hToolsLineCommonVarNonQC = uimenu(hToolsLineCommonVar, 'label', 'non QC'); + hToolsLineCommonVarQC = uimenu(hToolsLineCommonVar, 'label', 'QC'); + hToolsScatterCommonVar = uimenu(hToolsMenu, 'label', 'Scatter plot mooring''s 1D variables VS depth'); + hToolsScatterCommonVarNonQC = uimenu(hToolsScatterCommonVar, 'label', 'non QC'); + hToolsScatterCommonVarQC = uimenu(hToolsScatterCommonVar, 'label', 'QC'); + hToolsScatter2DCommonVar = uimenu(hToolsMenu, 'label', 'Scatter plot mooring''s 2D variables VS depth'); + hToolsScatter2DCommonVarNonQC = uimenu(hToolsScatter2DCommonVar, 'label', 'non QC'); + hToolsScatter2DCommonVarQC = uimenu(hToolsScatter2DCommonVar, 'label', 'QC'); + + %set menu callbacks + set(hToolsCheckPlannedDepthsNonQC, 'callBack', {@displayCheckPlannedDepths, false}); + set(hToolsCheckPlannedDepthsQC, 'callBack', {@displayCheckPlannedDepths, true}); + set(hToolsCheckPressDiffsNonQC, 'callBack', {@displayCheckPressDiffs, false}); + set(hToolsCheckPressDiffsQC, 'callBack', {@displayCheckPressDiffs, true}); + set(hToolsLineDepthNonQC, 'callBack', {@displayLineMooringDepth, false}); + set(hToolsLineDepthQC, 'callBack', {@displayLineMooringDepth, true}); + set(hToolsLineCommonVarNonQC, 'callBack', {@displayLineMooringVar, false}); + set(hToolsLineCommonVarQC, 'callBack', {@displayLineMooringVar, true}); + set(hToolsScatterCommonVarNonQC, 'callBack', {@displayScatterMooringVar, false, true}); + set(hToolsScatterCommonVarQC, 'callBack', {@displayScatterMooringVar, true, true}); + set(hToolsScatter2DCommonVarNonQC, 'callBack', {@displayScatterMooringVar, false, false}); + 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'); + + %set menu callbacks + set(hToolsLineCastVarNonQC, 'callBack', {@displayLineCastVar, false}); + set(hToolsLineCastVarQC, 'callBack', {@displayLineCastVar, true}); end hHelpMenu = uimenu(fig, 'label', 'Help'); hHelpWiki = uimenu(hHelpMenu, 'label', 'IMOS Toolbox Wiki'); @@ -828,7 +828,7 @@ function createVarPanel(sam, vars) if iDepth ~= 0 sam.variables(iDepth) = []; end - otherwise + case 'timeSeries' % we don't want to plot TIMESERIES, PROFILE, TRAJECTORY, LATITUDE, LONGITUDE, NOMINAL_DEPTH p = getVar(sam.variables, 'NOMINAL_DEPTH'); end @@ -886,7 +886,7 @@ function createVarPanel(sam, vars) case 'profile' % we don't want to plot TIME, PROFILE, DIRECTION, LATITUDE, LONGITUDE, BOT_DEPTH varOffset = getVar(sam.variables, 'BOT_DEPTH'); - otherwise + case 'timeSeries' % we don't want to plot TIMESERIES, PROFILE, TRAJECTORY, LATITUDE, LONGITUDE, NOMINAL_DEPTH varOffset = getVar(sam.variables, 'NOMINAL_DEPTH'); end diff --git a/GUI/startDialog.m b/GUI/startDialog.m index 0b9817b55..524955a95 100644 --- a/GUI/startDialog.m +++ b/GUI/startDialog.m @@ -10,7 +10,7 @@ % % Input: % -% mode - String, toolox execution mode can be 'profile' or 'timeSeries'. +% mode - String, toolox execution mode. % isCSV - optional boolean (default = false). True if importing from csv files. % % Outputs: @@ -62,18 +62,10 @@ dateFmt = readProperty('toolbox.dateFormat'); % if values exist for data dir and field trip, use them - switch mode - case 'profile' - dataDir = readProperty('startDialog.dataDir.profile'); - fieldTripId = readProperty('startDialog.fieldTrip.profile'); - lowDate = str2double(readProperty('startDialog.lowDate.profile')); - highDate = str2double(readProperty('startDialog.highDate.profile')); - otherwise - dataDir = readProperty('startDialog.dataDir.timeSeries'); - fieldTripId = readProperty('startDialog.fieldTrip.timeSeries'); - lowDate = str2double(readProperty('startDialog.lowDate.timeSeries')); - highDate = str2double(readProperty('startDialog.highDate.timeSeries')); - end + dataDir = readProperty(['startDialog.dataDir.' mode]); + fieldTripId = readProperty(['startDialog.fieldTrip.' mode]); + lowDate = str2double(readProperty(['startDialog.lowDate.' mode])); + highDate = str2double(readProperty(['startDialog.highDate.' mode])); % otherwise use default values if isempty(dataDir), dataDir = pwd; end @@ -342,18 +334,10 @@ function confirmCallback(source,ev) if isempty(dataDir) || isempty(fieldTrip), return; end % persist the user's directory and field trip selection - switch mode - case 'profile' - writeProperty('startDialog.dataDir.profile', dataDir); - writeProperty('startDialog.fieldTrip.profile', fieldTrip.FieldTripID); - writeProperty('startDialog.lowDate.profile', num2str(lowDate)); - writeProperty('startDialog.highDate.profile', num2str(highDate)); - otherwise - writeProperty('startDialog.dataDir.timeSeries', dataDir); - writeProperty('startDialog.fieldTrip.timeSeries', fieldTrip.FieldTripID); - writeProperty('startDialog.lowDate.timeSeries', num2str(lowDate)); - writeProperty('startDialog.highDate.timeSeries', num2str(highDate)); - end + writeProperty(['startDialog.dataDir.' mode], dataDir); + writeProperty(['startDialog.fieldTrip.' mode], fieldTrip.FieldTripID); + writeProperty(['startDialog.lowDate.' mode], num2str(lowDate)); + writeProperty(['startDialog.highDate.' mode], num2str(highDate)); end diff --git a/GUI/updateViewMetadata.m b/GUI/updateViewMetadata.m index 5fda8a4b6..781216187 100644 --- a/GUI/updateViewMetadata.m +++ b/GUI/updateViewMetadata.m @@ -11,7 +11,7 @@ function updateViewMetadata(parent, sample_data, mode) % parent - handle to the figure/uipanel in which the metadata should % be displayed. % sample_data - struct containing sample data. -% mode - Toolbox data type mode ('profile' or 'timeSeries'). +% mode - Toolbox data type mode. % % Author: Guillaume Galibert % diff --git a/GUI/viewMetadata.m b/GUI/viewMetadata.m index eb7bf1890..65ef8f2b5 100644 --- a/GUI/viewMetadata.m +++ b/GUI/viewMetadata.m @@ -24,7 +24,7 @@ function viewMetadata(parent, sample_data, updateCallback, repCallback, mode) % % function repCallback(location, names, values) % -% mode - Toolbox data type mode ('profile' or 'timeSeries'). +% mode - Toolbox data type mode. % % Author: Paul McCarthy % Contributor: Guillaume Galibert diff --git a/GUI/viewQCstats.m b/GUI/viewQCstats.m index c7056e1af..9a638d0da 100644 --- a/GUI/viewQCstats.m +++ b/GUI/viewQCstats.m @@ -9,7 +9,7 @@ function viewQCstats(parent, sample_data, mode) % parent - handle to the figure/uipanel in which the metadata should % be displayed. % sample_data - struct containing sample data. -% mode - Toolbox data type mode ('profile' or 'timeSeries'). +% mode - Toolbox data type mode. % % Author: Guillaume Galibert % diff --git a/Graph/checkMooringPlannedDepths.m b/Graph/checkMooringPlannedDepths.m index 8dcaa9d48..f6f0776da 100644 --- a/Graph/checkMooringPlannedDepths.m +++ b/Graph/checkMooringPlannedDepths.m @@ -61,10 +61,8 @@ function checkMooringPlannedDepths(sample_data, isQC, saveToFile, exportDir) if isQC, stringQC = 'QC'; end %plot depth information -monitorRec = get(0,'MonitorPosition'); -xResolution = monitorRec(:, 3)-monitorRec(:, 1); -iBigMonitor = xResolution == max(xResolution); -if sum(iBigMonitor)==2, iBigMonitor(2) = false; end % in case exactly same monitors +monitorRect = getRectMonitor(); +iBigMonitor = getBiggestMonitor(); title = [sample_data{1}.deployment_code ' mooring planned depth vs measured depth ' stringQC '''d good ' varTitle]; @@ -193,7 +191,7 @@ function checkMooringPlannedDepths(sample_data, isQC, saveToFile, exportDir) 'Name', title, ... 'NumberTitle','off', ... 'Visible', visible, ... - 'OuterPosition', [0, 0, monitorRec(iBigMonitor, 3), monitorRec(iBigMonitor, 4)]); + 'OuterPosition', monitorRect(iBigMonitor, :)); hAxPress = subplot(2,1,1,'Parent', hFigPress); hAxDepthDiff = subplot(2,1,2,'Parent', hFigPress); diff --git a/Graph/checkMooringPresDiffs.m b/Graph/checkMooringPresDiffs.m index a12bbef7f..75ba7b21b 100644 --- a/Graph/checkMooringPresDiffs.m +++ b/Graph/checkMooringPresDiffs.m @@ -63,10 +63,8 @@ function checkMooringPresDiffs(sample_data, iSampleMenu, isQC, saveToFile, expor if isQC, stringQC = 'QC'; end %plot depth information -monitorRec = get(0,'MonitorPosition'); -xResolution = monitorRec(:, 3)-monitorRec(:, 1); -iBigMonitor = xResolution == max(xResolution); -if sum(iBigMonitor)==2, iBigMonitor(2) = false; end % in case exactly same monitors +monitorRect = getRectMonitor(); +iBigMonitor = getBiggestMonitor(); title = [sample_data{1}.deployment_code ' mooring pressure differences ' stringQC '''d ' varTitle]; @@ -142,7 +140,7 @@ function checkMooringPresDiffs(sample_data, iSampleMenu, isQC, saveToFile, expor 'Name', title, ... 'NumberTitle','off', ... 'Visible', visible, ... - 'OuterPosition', [0, 0, monitorRec(iBigMonitor, 3), monitorRec(iBigMonitor, 4)]); + 'OuterPosition', monitorRect(iBigMonitor, :)); %pressure plot hAxPress = subplot(2,1,1,'Parent', hFigPressDiff); diff --git a/Graph/graphDepthProfile.m b/Graph/graphDepthProfile.m index 693f0495d..69b264289 100644 --- a/Graph/graphDepthProfile.m +++ b/Graph/graphDepthProfile.m @@ -65,15 +65,14 @@ return; end - % get the toolbox execution mode. Values can be 'timeSeries' and 'profile'. - % If no value is set then default mode is 'timeSeries' - mode = lower(readProperty('toolbox.mode')); + % get the toolbox execution mode + mode = readProperty('toolbox.mode'); switch mode case 'profile' % we don't want to plot TIME, PROFILE, DIRECTION, LATITUDE, LONGITUDE, BOT_DEPTH p = getVar(sample_data.variables, 'BOT_DEPTH'); - otherwise + case 'timeSeries' % we don't want to plot TIMESERIES, PROFILE, TRAJECTORY, LATITUDE, LONGITUDE, NOMINAL_DEPTH p = getVar(sample_data.variables, 'NOMINAL_DEPTH'); end diff --git a/Graph/graphTimeSeries.m b/Graph/graphTimeSeries.m index 7e40d7f50..e405e2ff0 100644 --- a/Graph/graphTimeSeries.m +++ b/Graph/graphTimeSeries.m @@ -61,15 +61,14 @@ return; end - % get the toolbox execution mode. Values can be 'timeSeries' and 'profile'. - % If no value is set then default mode is 'timeSeries' - mode = lower(readProperty('toolbox.mode')); + % get the toolbox execution mode + mode = readProperty('toolbox.mode'); switch mode case 'profile' % we don't want to plot TIME, PROFILE, DIRECTION, LATITUDE, LONGITUDE, BOT_DEPTH p = getVar(sample_data.variables, 'BOT_DEPTH'); - otherwise + case 'timeSeries' % we don't want to plot TIMESERIES, PROFILE, TRAJECTORY, LATITUDE, LONGITUDE, NOMINAL_DEPTH p = getVar(sample_data.variables, 'NOMINAL_DEPTH'); end diff --git a/Graph/lineCastVar.m b/Graph/lineCastVar.m index f209e25ac..c7214f640 100644 --- a/Graph/lineCastVar.m +++ b/Graph/lineCastVar.m @@ -62,10 +62,8 @@ function lineCastVar(sample_data, varNames, isQC, saveToFile, exportDir) end %plot depth information -monitorRec = get(0,'MonitorPosition'); -xResolution = monitorRec(:, 3)-monitorRec(:, 1); -iBigMonitor = xResolution == max(xResolution); -if sum(iBigMonitor)==2, iBigMonitor(2) = false; end % in case exactly same monitors +monitorRect = getRectMonitor(); +iBigMonitor = getBiggestMonitor(); title = [sample_data{1}.site_code ' profile on ' datestr(sample_data{1}.time_coverage_start, 'yyyy-mm-dd UTC')]; @@ -138,7 +136,7 @@ function lineCastVar(sample_data, varNames, isQC, saveToFile, exportDir) 'Name', title, ... 'NumberTitle','off', ... 'Visible', visible, ... - 'OuterPosition', [0, 0, monitorRec(iBigMonitor, 3), monitorRec(iBigMonitor, 4)]); + 'OuterPosition', monitorRect(iBigMonitor, :)); initiateFigure = false; end diff --git a/Graph/lineMooring1DVar.m b/Graph/lineMooring1DVar.m index b74a0488f..18e113bd7 100644 --- a/Graph/lineMooring1DVar.m +++ b/Graph/lineMooring1DVar.m @@ -61,10 +61,8 @@ function lineMooring1DVar(sample_data, varName, isQC, saveToFile, exportDir) if isQC, stringQC = 'QC'; end %plot depth information -monitorRec = get(0,'MonitorPosition'); -xResolution = monitorRec(:, 3)-monitorRec(:, 1); -iBigMonitor = xResolution == max(xResolution); -if sum(iBigMonitor)==2, iBigMonitor(2) = false; end % in case exactly same monitors +monitorRect = getRectMonitor(); +iBigMonitor = getBiggestMonitor(); title = [sample_data{1}.deployment_code ' mooring''s instruments ' stringQC '''d good ' varTitle]; @@ -141,7 +139,7 @@ function lineMooring1DVar(sample_data, varName, isQC, saveToFile, exportDir) iVar = getVar(sample_data{iSort(i)}.variables, varName); if iVar > 0 && size(sample_data{iSort(i)}.variables{iVar}.data, 2) == 1 && ... % we're only plotting 1D variables but no current - all(~strcmpi(sample_data{iSort(i)}.variables{iVar}.name, {'UCUR', 'VCUR', 'WCUR', 'CDIR', 'CSPD', 'VEL1', 'VEL2', 'VEL3'})) + 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'; @@ -150,7 +148,7 @@ function lineMooring1DVar(sample_data, varName, isQC, saveToFile, exportDir) 'Name', title, ... 'NumberTitle','off', ... 'Visible', visible, ... - 'OuterPosition', [0, 0, monitorRec(iBigMonitor, 3), monitorRec(iBigMonitor, 4)]); + 'OuterPosition', monitorRect(iBigMonitor, :)); hAxMooringVar = axes('Parent', hFigMooringVar); if any(strcmpi(varName, {'DEPTH', 'PRES', 'PRES_REL'})), set(hAxMooringVar, 'YDir', 'reverse'); end diff --git a/Graph/lineMooring2DVarSection.m b/Graph/lineMooring2DVarSection.m index 8789a3777..f23f2ea52 100644 --- a/Graph/lineMooring2DVarSection.m +++ b/Graph/lineMooring2DVarSection.m @@ -58,10 +58,8 @@ function lineMooring2DVarSection(sample_data, varName, timeValue, isQC, saveToFi if ~ischar(exportDir), error('exportDir must be a string'); end %plot depth information -monitorRec = get(0,'MonitorPosition'); -xResolution = monitorRec(:, 3)-monitorRec(:, 1); -iBigMonitor = xResolution == max(xResolution); -if sum(iBigMonitor)==2, iBigMonitor(2) = false; end % in case exactly same monitors +monitorRect = getRectMonitor(); +iBigMonitor = getBiggestMonitor(); iVar = getVar(sample_data.variables, varName); title = [sample_data.variables{iVar}.name ' section of ' sample_data.deployment_code ' at ' datestr(timeValue, 'yyyy-mm-dd HH:MM:SS UTC')]; @@ -126,7 +124,7 @@ function lineMooring2DVarSection(sample_data, varName, timeValue, isQC, saveToFi 'Name', title, ... 'NumberTitle','off', ... 'Visible', visible, ... - 'OuterPosition', [0, 0, monitorRec(iBigMonitor, 3), monitorRec(iBigMonitor, 4)]); + 'OuterPosition', monitorRect(iBigMonitor, :)); initiateFigure = false; end diff --git a/Graph/pcolorMooring2DVar.m b/Graph/pcolorMooring2DVar.m index bb4c50d53..7db9b8fb6 100644 --- a/Graph/pcolorMooring2DVar.m +++ b/Graph/pcolorMooring2DVar.m @@ -61,10 +61,9 @@ function pcolorMooring2DVar(sample_data, varName, isQC, saveToFile, exportDir) if isQC, stringQC = 'QC'; end %plot depth information -monitorRec = get(0,'MonitorPosition'); -xResolution = monitorRec(:, 3)-monitorRec(:, 1); -iBigMonitor = xResolution == max(xResolution); -if sum(iBigMonitor)==2, iBigMonitor(2) = false; end % in case exactly same monitors +monitorRect = getRectMonitor(); +iBigMonitor = getBiggestMonitor(); + title = [sample_data{1}.deployment_code ' mooring''s instruments ' stringQC '''d good ' varTitle]; %sort instruments by depth @@ -108,7 +107,7 @@ function pcolorMooring2DVar(sample_data, varName, isQC, saveToFile, exportDir) instrumentDesc{i} = [strrep(instrumentDesc{i}, '_', ' ') ' (' num2str(metaDepth(i)) 'm' instrumentSN ')']; - switch varName + switch varName(1:4) case {'UCUR', 'VCUR', 'WCUR', 'VEL1', 'VEL2', 'VEL3'} % 0 centred parameters cMap = 'r_b'; cType = 'centeredOnZero'; @@ -145,7 +144,7 @@ function pcolorMooring2DVar(sample_data, varName, isQC, saveToFile, exportDir) 'Name', title, ... 'NumberTitle', 'off', ... 'Visible', visible, ... - 'OuterPosition', [0, 0, monitorRec(iBigMonitor, 3), monitorRec(iBigMonitor, 4)]); + 'OuterPosition', monitorRect(iBigMonitor, :)); if saveToFile % the default renderer under windows is opengl; for some reason, diff --git a/Graph/scatterMooring1DVarAgainstDepth.m b/Graph/scatterMooring1DVarAgainstDepth.m index cf749b68a..942788369 100644 --- a/Graph/scatterMooring1DVarAgainstDepth.m +++ b/Graph/scatterMooring1DVarAgainstDepth.m @@ -63,10 +63,8 @@ function scatterMooring1DVarAgainstDepth(sample_data, varName, isQC, saveToFile, if isQC, stringQC = 'QC'; end %plot depth information -monitorRec = get(0,'MonitorPosition'); -xResolution = monitorRec(:, 3)-monitorRec(:, 1); -iBigMonitor = xResolution == max(xResolution); -if sum(iBigMonitor)==2, iBigMonitor(2) = false; end % in case exactly same monitors +monitorRect = getRectMonitor(); +iBigMonitor = getBiggestMonitor(); title = [sample_data{1}.deployment_code ' mooring''s instruments ' stringQC '''d good ' varTitle]; @@ -129,7 +127,7 @@ function scatterMooring1DVarAgainstDepth(sample_data, varName, isQC, saveToFile, izVar = getVar(sample_data{iSort(i)}.variables, varName); if izVar > 0 && size(sample_data{iSort(i)}.variables{izVar}.data, 2) == 1 && ... % we're only plotting 1D variables with depth variable but no current - all(~strcmpi(sample_data{iSort(i)}.variables{izVar}.name, {'UCUR', 'VCUR', 'WCUR', 'CDIR', 'CSPD', 'VEL1', 'VEL2', 'VEL3'})) + all(~strncmpi(sample_data{iSort(i)}.variables{izVar}.name, {'UCUR', 'VCUR', 'WCUR', 'CDIR', 'CSPD', 'VEL1', 'VEL2', 'VEL3'}, 4)) iGood = true(size(sample_data{iSort(i)}.variables{izVar}.data)); if isQC %get time, depth and var QC information @@ -192,7 +190,7 @@ function scatterMooring1DVarAgainstDepth(sample_data, varName, isQC, saveToFile, 'Name', title, ... 'NumberTitle','off', ... 'Visible', visible, ... - 'OuterPosition', [0, 0, monitorRec(iBigMonitor, 3), monitorRec(iBigMonitor, 4)]); + 'OuterPosition', monitorRect(iBigMonitor, :)); hAxMooringVar = axes('Parent', hFigMooringVar); set(hAxMooringVar, 'YDir', 'reverse'); diff --git a/Graph/scatterMooring2DVarAgainstDepth.m b/Graph/scatterMooring2DVarAgainstDepth.m index 38841e132..32e93f563 100644 --- a/Graph/scatterMooring2DVarAgainstDepth.m +++ b/Graph/scatterMooring2DVarAgainstDepth.m @@ -65,10 +65,8 @@ function scatterMooring2DVarAgainstDepth(sample_data, varName, isQC, saveToFile, if isQC, stringQC = 'QC'; end %plot depth information -monitorRec = get(0,'MonitorPosition'); -xResolution = monitorRec(:, 3)-monitorRec(:, 1); -iBigMonitor = xResolution == max(xResolution); -if sum(iBigMonitor)==2, iBigMonitor(2) = false; end % in case exactly same monitors +monitorRect = getRectMonitor(); +iBigMonitor = getBiggestMonitor(); title = [sample_data{1}.deployment_code ' mooring''s instruments ' stringQC '''d good ' varTitle]; @@ -163,7 +161,7 @@ function scatterMooring2DVarAgainstDepth(sample_data, varName, isQC, saveToFile, end elseif iVar > 0 && ... - any(strcmpi(sample_data{iSort(i)}.variables{iVar}.name, {'UCUR', 'VCUR', 'WCUR', 'CDIR', 'CSPD', 'VEL1', 'VEL2', 'VEL3'})) && ... + any(strncmpi(sample_data{iSort(i)}.variables{iVar}.name, {'UCUR', 'VCUR', 'WCUR', 'CDIR', 'CSPD', 'VEL1', 'VEL2', 'VEL3'}, 4)) && ... size(sample_data{iSort(i)}.variables{iVar}.data, 2) == 1 % we're plotting current metre 1D variables with DEPTH variable. iGood = true(size(sample_data{iSort(i)}.variables{iVar}.data)); if isQC @@ -261,7 +259,7 @@ function scatterMooring2DVarAgainstDepth(sample_data, varName, isQC, saveToFile, 'Name', title, ... 'NumberTitle', 'off', ... 'Visible', visible, ... - 'OuterPosition', [0, 0, monitorRec(iBigMonitor, 3), monitorRec(iBigMonitor, 4)]); + 'OuterPosition', monitorRect(iBigMonitor, :)); hAxMooringVar = axes('Parent', hFigMooringVar); set(hAxMooringVar, 'YDir', 'reverse'); diff --git a/IMOS/finaliseData.m b/IMOS/finaliseData.m index fb23738a8..5bdceddca 100644 --- a/IMOS/finaliseData.m +++ b/IMOS/finaliseData.m @@ -58,9 +58,8 @@ sam.file_version_quality_control = imosFileVersion(sam.meta.level, 'desc'); end - % get the toolbox execution mode. Values can be 'timeSeries' and 'profile'. - % If no value is set then default mode is 'timeSeries' - mode = lower(readProperty('toolbox.mode')); + % get the toolbox execution mode + mode = readProperty('toolbox.mode'); % turn raw data files a into semicolon separated string rawFiles = cellfun(@(x)([x ';']), rawFiles, 'UniformOutput', false); @@ -195,7 +194,7 @@ if isempty(sam.time_coverage_end), sam.time_coverage_end = []; end end - otherwise + case 'timeSeries' time = getVar(sam.dimensions, 'TIME'); if time ~= 0 if isempty(sam.time_coverage_start), diff --git a/IMOS/genIMOSFileName.m b/IMOS/genIMOSFileName.m index 1073c65c2..311e482d4 100644 --- a/IMOS/genIMOSFileName.m +++ b/IMOS/genIMOSFileName.m @@ -58,15 +58,14 @@ % dateFmt = readProperty('exportNetCDF.fileDateFormat'); - % get the toolbox execution mode. Values can be 'timeSeries' and 'profile'. - % If no value is set then default mode is 'timeSeries' + % get the toolbox execution mode mode = readProperty('toolbox.mode'); % get default config, and file config defCfg = genDefaultFileNameConfig(sample_data, dateFmt, mode); fileCfg = readFileNameConfig(sample_data); - switch lower(mode) + switch mode case 'profile' % build the file name if strcmpi(suffix, 'png') @@ -86,7 +85,7 @@ filename = [filename getVal(fileCfg, defCfg, 'product_type') '_']; filename = [filename 'C-' getVal(fileCfg, defCfg, 'creation_date') ]; end - otherwise + case 'timeSeries' % build the file name if strcmpi(suffix, 'png') filename = [sample_data.naming_authority '_']; @@ -190,12 +189,12 @@ config.file_version = imosFileVersion(sample_data.meta.level, 'fileid'); % - switch lower(mode) + switch mode case 'profile' config.product_type = ['Profile-' ... sample_data.meta.instrument_model]; - otherwise + case 'timeSeries' config.product_type = [... sample_data.meta.site_id '-' ... sample_data.meta.instrument_model '-' ... diff --git a/NetCDF/exportNetCDF.m b/NetCDF/exportNetCDF.m index 4eaa323df..55c0f4329 100644 --- a/NetCDF/exportNetCDF.m +++ b/NetCDF/exportNetCDF.m @@ -8,7 +8,7 @@ % Inputs: % sample_data - a struct containing sample data for one process level. % dest - Destination directory to save the file. -% mode - Toolbox data type mode ('profile' or 'timeSeries'). +% mode - Toolbox data type mode. % % Outputs: % filename - String containing the absolute path of the saved NetCDF file. @@ -474,7 +474,7 @@ % coordinate variables and data variables. % netcdfType - The netCDF type in which the flags should be output. % dateFmt - Date format in which date attributes should be output. -% mode - Toolbox processing mode ('profile' or 'timeSeries'). +% mode - Toolbox processing mode. % % Outputs: % vid - NetCDF variable identifier of the QC variable that was @@ -545,7 +545,7 @@ case 'profile' iInWater = true(size(sample_data.(type){varIdx}.data)); - otherwise + case 'timeSeries' % inOutWater test don't apply on dimensions for timeseries data if ~strcmp(type, 'variables') || any(strcmp(sample_data.(type){varIdx}.name, {'TIMESERIES', 'PROFILE', 'TRAJECTORY', 'LATITUDE', 'LONGITUDE', 'NOMINAL_DEPTH'})) iInWater = true(size(sample_data.(type){varIdx}.data)); @@ -630,7 +630,7 @@ function putAtts(fid, vid, var, template, templateFile, netcdfType, dateFmt, mod % originated. % netcdfType - type to use for casting valid_min/valid_max/_FillValue attributes. % dateFmt - format to use for writing date attributes. -% mode - Toolbox processing mode ('profile' or 'timeSeries'). +% mode - Toolbox processing mode. % % we convert the NetCDF required data type into a casting function towards the diff --git a/NetCDF/makeNetCDFCompliant.m b/NetCDF/makeNetCDFCompliant.m index de58c8cfb..4f9ac7f4c 100644 --- a/NetCDF/makeNetCDFCompliant.m +++ b/NetCDF/makeNetCDFCompliant.m @@ -65,17 +65,11 @@ % global attributes % - % get the toolbox execution mode. Values can be 'timeSeries' and 'profile'. - % If no value is set then default mode is 'timeSeries' - mode = lower(readProperty('toolbox.mode')); + % get the toolbox execution mode + mode = readProperty('toolbox.mode'); % get infos from current field trip - switch mode - case 'profile' - globalAttributeFile = 'global_attributes_profile.txt'; - otherwise - globalAttributeFile = 'global_attributes_timeSeries.txt'; - end + globalAttributeFile = ['global_attributes_' mode '.txt']; globAtts = parseNetCDFTemplate(... fullfile(path, globalAttributeFile), sample_data); diff --git a/NetCDF/templateType.m b/NetCDF/templateType.m index ab623d5f3..75bc9f659 100644 --- a/NetCDF/templateType.m +++ b/NetCDF/templateType.m @@ -16,7 +16,7 @@ % name - the attribute name % temp - what kind of attribute - 'global', 'time', 'depth', 'latitude', % 'longitude', 'variable', 'qc' or 'qc_coord' -% mode - Toolbox data type mode ('profile' or 'timeSeries'). +% mode - Toolbox data type mode. % % Outputs: % t - the type of the attribute, one of 'S', 'N', 'D', or 'Q', or @@ -70,11 +70,7 @@ isGlobal = false; if strcmpi(temp, 'global') - if strcmpi(mode, 'profile') - temp = [temp '_attributes_profile.txt']; - else - temp = [temp '_attributes_timeSeries.txt']; - end + temp = [temp '_attributes_' mode '.txt']; isGlobal = true; else % let's handle the case temp is a parameter name and we have multiple diff --git a/Parser/DR1050Parse.m b/Parser/DR1050Parse.m index b008578b2..9387ef7bc 100644 --- a/Parser/DR1050Parse.m +++ b/Parser/DR1050Parse.m @@ -7,7 +7,7 @@ % % Inputs: % filename - Cell array containing the name of the file to parse. -% mode - Toolbox data type mode ('profile' or 'timeSeries'). +% mode - Toolbox data type mode. % % Outputs: % sample_data - Struct containing imported sample data. diff --git a/Parser/ECOBB9Parse.m b/Parser/ECOBB9Parse.m index cd6a31e80..f0a34c88a 100644 --- a/Parser/ECOBB9Parse.m +++ b/Parser/ECOBB9Parse.m @@ -5,7 +5,7 @@ % % Inputs: % filename - name of the input file to be parsed -% mode - Toolbox data type mode ('profile' or 'timeSeries'). +% mode - Toolbox data type mode. % % Outputs: % sample_data - contains a time vector (in matlab numeric format), and a diff --git a/Parser/ECOTripletParse.m b/Parser/ECOTripletParse.m index 3b28ca67b..c9f002fe4 100644 --- a/Parser/ECOTripletParse.m +++ b/Parser/ECOTripletParse.m @@ -4,7 +4,7 @@ % % Inputs: % filename - name of the input file to be parsed -% mode - Toolbox data type mode ('profile' or 'timeSeries'). +% mode - Toolbox data type mode. % % Outputs: % sample_data - contains a time vector (in matlab numeric format), and a diff --git a/Parser/NIWAParse.m b/Parser/NIWAParse.m index 64e274801..bc1271dd5 100644 --- a/Parser/NIWAParse.m +++ b/Parser/NIWAParse.m @@ -12,7 +12,7 @@ % % Inputs: % filename - cell array of files to import (only one supported). -% mode - Toolbox data type mode ('profile' or 'timeSeries'). +% mode - Toolbox data type mode. % % Outputs: % sample_data - Struct containing sample data. diff --git a/Parser/NXICBinaryParse.m b/Parser/NXICBinaryParse.m index 39b3ffccc..deb966cda 100644 --- a/Parser/NXICBinaryParse.m +++ b/Parser/NXICBinaryParse.m @@ -11,7 +11,7 @@ % Inputs: % filename - cell array of strings, names of the files to import. Only % one file is supported. -% mode - Toolbox data type mode ('profile' or 'timeSeries'). +% mode - Toolbox data type mode. % % Outputs: % sample_data - struct containing sample data. diff --git a/Parser/SBE19Parse.m b/Parser/SBE19Parse.m index ef3b1d369..6a3994a07 100644 --- a/Parser/SBE19Parse.m +++ b/Parser/SBE19Parse.m @@ -19,7 +19,7 @@ % % Inputs: % filename - cell array of files to import (only one supported). -% mode - Toolbox data type mode ('profile' or 'timeSeries'). +% mode - Toolbox data type mode. % % Outputs: % sample_data - Struct containing sample data. @@ -338,7 +338,7 @@ end end - otherwise + case 'timeSeries' % dimensions creation sample_data.dimensions{1}.name = 'TIME'; sample_data.dimensions{1}.typeCastFunc = str2func(netcdf3ToMatlabType(imosParameters(sample_data.dimensions{1}.name, 'type'))); diff --git a/Parser/SBE37Parse.m b/Parser/SBE37Parse.m index 042f16fe3..2929562a9 100644 --- a/Parser/SBE37Parse.m +++ b/Parser/SBE37Parse.m @@ -11,7 +11,7 @@ % % Inputs: % filename - name of the input file to be parsed -% mode - Toolbox data type mode ('profile' or 'timeSeries'). +% mode - Toolbox data type mode. % % Outputs: % sample_data - struct containing the sample data diff --git a/Parser/SBE37SMParse.m b/Parser/SBE37SMParse.m index d79bd29b8..831b30780 100644 --- a/Parser/SBE37SMParse.m +++ b/Parser/SBE37SMParse.m @@ -21,7 +21,7 @@ % % Inputs: % filename - cell array of files to import (only one supported). -% mode - Toolbox data type mode ('profile' or 'timeSeries'). +% mode - Toolbox data type mode. % % Outputs: % sample_data - Struct containing sample data. diff --git a/Parser/SBE39Parse.m b/Parser/SBE39Parse.m index 261e183e2..5eb16f13b 100644 --- a/Parser/SBE39Parse.m +++ b/Parser/SBE39Parse.m @@ -10,7 +10,7 @@ % % Inputs: % filename - name of the input file to be parsed -% mode - Toolbox data type mode ('profile' or 'timeSeries'). +% mode - Toolbox data type mode. % % Outputs: % sample_data - struct containing the sample data diff --git a/Parser/SBE3x.m b/Parser/SBE3x.m index fcaca5aa3..6bb701c6f 100644 --- a/Parser/SBE3x.m +++ b/Parser/SBE3x.m @@ -61,7 +61,7 @@ % % Inputs: % filename - name of the input file to be parsed -% mode - Toolbox data type mode ('profile' or 'timeSeries'). +% mode - Toolbox data type mode. % % Outputs: % sample_data - contains a time vector (in matlab numeric format), and a diff --git a/Parser/SBE56Parse.m b/Parser/SBE56Parse.m index 826e04c63..cf7b05e52 100644 --- a/Parser/SBE56Parse.m +++ b/Parser/SBE56Parse.m @@ -18,7 +18,7 @@ % % Inputs: % filename - cell array of files to import (only one supported). -% mode - Toolbox data type mode ('profile' or 'timeSeries'). +% mode - Toolbox data type mode. % % Outputs: % sample_data - Struct containing sample data. @@ -109,7 +109,7 @@ else % have csv file % use SBE56 specific csv data reader function - [data, comment, csvHeaderLines] = readSBE56csv(filename, mode); + [data, comment, csvHeaderLines] = readSBE56csv(filename); instHeader = parseInstrumentHeader(csvHeaderLines); procHeader = struct; end @@ -394,7 +394,7 @@ end %% -function [data, comment, csvHeaderLines] = readSBE56csv(filename, mode) +function [data, comment, csvHeaderLines] = readSBE56csv(filename) %READSBE56CSV % So far a typical SBE56 csv file has a number of header lines with '%' as diff --git a/Parser/StarmonMiniParse.m b/Parser/StarmonMiniParse.m index 25ba5a962..58a1f18e3 100644 --- a/Parser/StarmonMiniParse.m +++ b/Parser/StarmonMiniParse.m @@ -10,7 +10,7 @@ % % Inputs: % filename - cell array of files to import (only one supported). -% mode - Toolbox data type mode ('profile' or 'timeSeries'). +% mode - Toolbox data type mode. % % Outputs: % sample_data - Struct containing sample data. diff --git a/Parser/VemcoParse.m b/Parser/VemcoParse.m index 4ae36ba16..3c1e7f1c0 100644 --- a/Parser/VemcoParse.m +++ b/Parser/VemcoParse.m @@ -15,7 +15,7 @@ % % Inputs: % filename - cell array of files to import (only one supported). -% mode - Toolbox data type mode ('profile' or 'timeSeries'). +% mode - Toolbox data type mode. % % Outputs: % sample_data - Struct containing sample data. diff --git a/Parser/WQMParse.m b/Parser/WQMParse.m index a36d8bf1d..4c5479463 100644 --- a/Parser/WQMParse.m +++ b/Parser/WQMParse.m @@ -4,7 +4,7 @@ % % Inputs: % filename - name of the input file to be parsed -% mode - Toolbox data type mode ('profile' or 'timeSeries'). +% mode - Toolbox data type mode. % % Outputs: % sample_data - contains a time vector (in matlab numeric format), and a diff --git a/Parser/WetStarParse.m b/Parser/WetStarParse.m index 0f7031e1c..a50e1e9c4 100644 --- a/Parser/WetStarParse.m +++ b/Parser/WetStarParse.m @@ -5,7 +5,7 @@ % % Inputs: % filename - name of the input file to be parsed -% mode - Toolbox data type mode ('profile' or 'timeSeries'). +% mode - Toolbox data type mode. % % Outputs: % sample_data - contains a time vector (in matlab numeric format), and a diff --git a/Parser/XRParse.m b/Parser/XRParse.m index 6ce3a61e0..72603dd78 100644 --- a/Parser/XRParse.m +++ b/Parser/XRParse.m @@ -9,7 +9,7 @@ % % Inputs: % filename - Cell array containing the name of the file to parse. -% mode - Toolbox data type mode ('profile' or 'timeSeries'). +% mode - Toolbox data type mode. % % Outputs: % sample_data - Struct containing imported sample data. diff --git a/Parser/YSI6SeriesParse.m b/Parser/YSI6SeriesParse.m index 38bbd563d..28fbd56a5 100644 --- a/Parser/YSI6SeriesParse.m +++ b/Parser/YSI6SeriesParse.m @@ -10,7 +10,7 @@ % Inputs: % filename - Cell array of input files; all but the first entry are % ignored. -% mode - Toolbox data type mode ('profile' or 'timeSeries'). +% mode - Toolbox data type mode. % Outputs: % sample_data - Struct containing sample data. diff --git a/Parser/aquadoppProfilerParse.m b/Parser/aquadoppProfilerParse.m index b4293ea73..e3b8a6bc4 100644 --- a/Parser/aquadoppProfilerParse.m +++ b/Parser/aquadoppProfilerParse.m @@ -7,7 +7,7 @@ % Inputs: % filename - Cell array containing the name of the raw aquadopp profiler % file to parse. -% tMode - Toolbox data type mode ('profile' or 'timeSeries'). +% tMode - Toolbox data type mode. % % Outputs: % sample_data - Struct containing sample data. diff --git a/Parser/aquadoppVelocityParse.m b/Parser/aquadoppVelocityParse.m index 5bf7d500c..9d9dd087f 100644 --- a/Parser/aquadoppVelocityParse.m +++ b/Parser/aquadoppVelocityParse.m @@ -6,7 +6,7 @@ % Inputs: % filename - Cell array containing the name of the raw aquadopp velocity % file to parse. -% mode - Toolbox data type mode ('profile' or 'timeSeries'). +% mode - Toolbox data type mode. % % Outputs: % sample_data - Struct containing sample data. diff --git a/Parser/aquatecParse.m b/Parser/aquatecParse.m index 339286ab4..ea1f3838b 100644 --- a/Parser/aquatecParse.m +++ b/Parser/aquatecParse.m @@ -24,8 +24,8 @@ % If the logger was configured to use burst mode, the bursts are averaged. % % Inputs: -% filename - cell array of filename names (Only supports one currently). -% mode - Toolbox data type mode ('profile' or 'timeSeries'). +% filename - cell array of filename names (Only supports one currently). +% mode - Toolbox data type mode. % % Outputs: % sample_data - struct containing sample data. diff --git a/Parser/awacParse.m b/Parser/awacParse.m index 09ed00e23..36974ca05 100644 --- a/Parser/awacParse.m +++ b/Parser/awacParse.m @@ -17,7 +17,7 @@ % Inputs: % filename - Cell array containing the name of the raw AWAC file % to parse. -% tMode - Toolbox data type mode ('profile' or 'timeSeries'). +% tMode - Toolbox data type mode. % % Outputs: % sample_data - Struct containing sample data; If wave data is present, diff --git a/Parser/continentalParse.m b/Parser/continentalParse.m index 79c37b91e..cf7b50145 100644 --- a/Parser/continentalParse.m +++ b/Parser/continentalParse.m @@ -7,7 +7,7 @@ % Inputs: % filename - Cell array containing the name of the raw continental file % to parse. -% tMode - Toolbox data type mode ('profile' or 'timeSeries'). +% tMode - Toolbox data type mode. % % Outputs: % sample_data - Struct containing sample data. diff --git a/Parser/convertSBEcnvVar.m b/Parser/convertSBEcnvVar.m index 3f912128e..69d3b99b7 100644 --- a/Parser/convertSBEcnvVar.m +++ b/Parser/convertSBEcnvVar.m @@ -11,7 +11,7 @@ % timeOffset - offset to be applied to time value in SeaBird file. % instHeader - Struct containing instrument header. % procHeader - Struct containing processed header. -% mode - Toolbox data type mode ('profile' or 'timeSeries'). +% mode - Toolbox data type mode. % % Outputs: % name - IMOS parameter code. diff --git a/Parser/infinitySDLoggerParse.m b/Parser/infinitySDLoggerParse.m index 156c9edbc..bc60a6d9b 100644 --- a/Parser/infinitySDLoggerParse.m +++ b/Parser/infinitySDLoggerParse.m @@ -4,7 +4,7 @@ % % Inputs: % filename - Cell array containing the name of the file to parse. -% mode - Toolbox data type mode ('profile' or 'timeSeries'). +% mode - Toolbox data type mode. % % Outputs: % sample_data - Struct containing imported sample data. diff --git a/Parser/netcdfParse.m b/Parser/netcdfParse.m index c8d526576..80ee30af7 100644 --- a/Parser/netcdfParse.m +++ b/Parser/netcdfParse.m @@ -5,7 +5,7 @@ % % Inputs: % filename - cell array of file names (only one supported). -% mode - Toolbox data type mode ('profile' or 'timeSeries'). +% mode - Toolbox data type mode. % % Outputs: % sample_data - struct containing the imported data set. diff --git a/Parser/readBB9raw.m b/Parser/readBB9raw.m index 348a800c3..414bdfd8f 100644 --- a/Parser/readBB9raw.m +++ b/Parser/readBB9raw.m @@ -6,7 +6,7 @@ % Inputs: % filename - name of the input file to be parsed % deviceInfo - infos retrieved from the relevant device file -% mode - Toolbox data type mode ('profile' or 'timeSeries'). +% mode - Toolbox data type mode. % % Outputs: % sample_data - contains a time vector (in matlab numeric format), and a diff --git a/Parser/readECOraw.m b/Parser/readECOraw.m index 63f1585f4..6b924cc51 100644 --- a/Parser/readECOraw.m +++ b/Parser/readECOraw.m @@ -5,7 +5,7 @@ % Inputs: % filename - name of the input file to be parsed % deviceInfo - infos retrieved from the relevant device file -% mode - Toolbox data type mode ('profile' or 'timeSeries'). +% mode - Toolbox data type mode. % % Outputs: % sample_data - contains a time vector (in matlab numeric format), and a diff --git a/Parser/readSBE19cnv.m b/Parser/readSBE19cnv.m index 9e1a7fd0b..dc1e753bf 100644 --- a/Parser/readSBE19cnv.m +++ b/Parser/readSBE19cnv.m @@ -9,7 +9,7 @@ % dataLines - Cell array of strings, the data lines in the original file. % instHeader - Struct containing instrument header. % procHeader - Struct containing processed header. -% mode - Toolbox data type mode ('profile' or 'timeSeries'). +% mode - Toolbox data type mode. % % Outputs: % data - Struct containing variable data. diff --git a/Parser/readSBE37cnv.m b/Parser/readSBE37cnv.m index 78079a37d..35f342ab8 100644 --- a/Parser/readSBE37cnv.m +++ b/Parser/readSBE37cnv.m @@ -9,7 +9,7 @@ % dataLines - Cell array of strings, the data lines in the original file. % instHeader - Struct containing instrument header. % procHeader - Struct containing processed header. -% mode - Toolbox data type mode ('profile' or 'timeSeries'). +% mode - Toolbox data type mode. % % Outputs: % data - Struct containing variable data. diff --git a/Parser/readWQMdat.m b/Parser/readWQMdat.m index 8ef20e480..860c8d617 100644 --- a/Parser/readWQMdat.m +++ b/Parser/readWQMdat.m @@ -39,7 +39,7 @@ % % Inputs: % filename - name of the input file to be parsed -% mode - Toolbox data type mode ('profile' or 'timeSeries'). +% mode - Toolbox data type mode. % % Outputs: % sample_data - contains a time vector (in matlab numeric format), and a diff --git a/Parser/readWQMraw.m b/Parser/readWQMraw.m index ee435f6ce..f7f6fb34a 100644 --- a/Parser/readWQMraw.m +++ b/Parser/readWQMraw.m @@ -6,7 +6,7 @@ % % Inputs: % filename - name of the input file to be parsed -% mode - Toolbox data type mode ('profile' or 'timeSeries'). +% mode - Toolbox data type mode. % % Outputs: % sample_data - contains a time vector (in matlab numeric format), and a diff --git a/Parser/readWetStarraw.m b/Parser/readWetStarraw.m index 9ae790171..c7c93ac0f 100644 --- a/Parser/readWetStarraw.m +++ b/Parser/readWetStarraw.m @@ -6,7 +6,7 @@ % Inputs: % filename - name of the input file to be parsed % deviceInfo - infos retrieved from the relevant device file -% mode - Toolbox data type mode ('profile' or 'timeSeries'). +% mode - Toolbox data type mode. % % Outputs: % sample_data - contains a time vector (in matlab numeric format), and a diff --git a/Parser/readXR420.m b/Parser/readXR420.m index 3a68bf295..805c0305e 100644 --- a/Parser/readXR420.m +++ b/Parser/readXR420.m @@ -8,7 +8,7 @@ % % Inputs: % filename - Cell array containing the name of the file to parse. -% mode - Toolbox data type mode ('profile' or 'timeSeries'). +% mode - Toolbox data type mode. % % Outputs: % sample_data - Struct containing imported sample data. @@ -283,7 +283,7 @@ end end - otherwise + case 'timeSeries' sample_data.dimensions{1}.name = 'TIME'; sample_data.dimensions{1}.typeCastFunc = str2func(netcdf3ToMatlabType(imosParameters(sample_data.dimensions{1}.name, 'type'))); sample_data.dimensions{1}.data = sample_data.dimensions{1}.typeCastFunc(data.time); diff --git a/Parser/readXR620.m b/Parser/readXR620.m index 18ef90359..c82471642 100644 --- a/Parser/readXR620.m +++ b/Parser/readXR620.m @@ -10,7 +10,7 @@ % % Inputs: % filename - Cell array containing the name of the file to parse. -% mode - Toolbox data type mode ('profile' or 'timeSeries'). +% mode - Toolbox data type mode. % % Outputs: % sample_data - Struct containing imported sample data. @@ -475,8 +475,7 @@ end end - otherwise - + case 'timeSeries' sample_data.dimensions{1}.name = 'TIME'; sample_data.dimensions{1}.typeCastFunc = str2func(netcdf3ToMatlabType(imosParameters(sample_data.dimensions{1}.name, 'type'))); sample_data.dimensions{1}.data = sample_data.dimensions{1}.typeCastFunc(data.time); diff --git a/Parser/sensusUltraParse.m b/Parser/sensusUltraParse.m index b3f26b49f..a5700c7e1 100644 --- a/Parser/sensusUltraParse.m +++ b/Parser/sensusUltraParse.m @@ -4,7 +4,7 @@ % % Inputs: % filename - Cell array containing the name of the file to parse. -% mode - Toolbox data type mode ('profile' or 'timeSeries'). +% mode - Toolbox data type mode. % % Outputs: % sample_data - Struct containing imported sample data. diff --git a/Parser/signatureParse.m b/Parser/signatureParse.m index 48947e817..528bc5dd3 100644 --- a/Parser/signatureParse.m +++ b/Parser/signatureParse.m @@ -6,7 +6,7 @@ % Inputs: % filename - Cell array containing the name of the raw signature % file to parse. -% tMode - Toolbox data type mode ('profile' or 'timeSeries'). +% tMode - Toolbox data type mode. % % Outputs: % sample_data - Struct containing sample data. diff --git a/Parser/workhorseParse.m b/Parser/workhorseParse.m index 43f3f9e2a..36c7b6cdc 100644 --- a/Parser/workhorseParse.m +++ b/Parser/workhorseParse.m @@ -21,7 +21,7 @@ % % Inputs: % filename - raw binary data file retrieved from a Workhorse. -% tMode - Toolbox data type mode ('profile' or 'timeSeries'). +% tMode - Toolbox data type mode. % % Outputs: % sample_data - sample_data struct containing the data retrieved from the diff --git a/Preprocessing/depthPP.m b/Preprocessing/depthPP.m index f6fdb26e8..1b746a0d3 100644 --- a/Preprocessing/depthPP.m +++ b/Preprocessing/depthPP.m @@ -557,9 +557,8 @@ end end - % get the toolbox execution mode. Values can be 'timeSeries' and 'profile'. - % If no value is set then default mode is 'timeSeries' - mode = lower(readProperty('toolbox.mode')); + % get the toolbox execution mode + mode = readProperty('toolbox.mode'); % add depth data as new variable in data set sample_data{k} = addVar(... diff --git a/Util/getBiggestMonitor.m b/Util/getBiggestMonitor.m new file mode 100644 index 000000000..61da40267 --- /dev/null +++ b/Util/getBiggestMonitor.m @@ -0,0 +1,42 @@ +function [ iBigMonitor ] = getBiggestMonitor() +%GETBIGGESTMONITOR Returns the logical index of your biggest monitor +% + +monitorPos = get(0,'MonitorPosition'); + +switch computer + case {'PCWIN', 'PCWIN64'} + % [xmin2,ymin2,xmax2,ymax2; + % xmin1,ymin1,xmax1,ymax1] + % The last row corresponds to device 1. The monitor labeled as device 1 in the Windows control + % panel remains the reference monitor that defines the position of the + % origin. The values for minimum and maximum are relative to the origin. + width = monitorPos(:, 3)-monitorPos(:, 1); + + case 'GLNXA64' + % [xP yP widthP heightP; + % xS yS widthS heightS] + % The upper-left corner of a rectangle enclosing the system monitors forms the origin. + % Where the values represent the offset from the left (x), + % the offset from the top (y), and the width and + % height of the monitor. + width = monitorPos(:, 3); + + case 'MACI64' + % [x,y,width,height-menuHieght] + % MATLAB on Macintosh systems recognize only the main monitor. + % Where the values are x = 0, y =0, monitor width, and monitor height minus the height of + % the menubar. The main monitor is determined by which display has the menu bar. + width = monitorPos(:, 3); +end + +iBigMonitor = width == max(width); + +% in case exactly same biggest monitors more than once we return the first one +if sum(iBigMonitor)>1 + firstBigMonitor = find(iBigMonitor, 1, 'first'); + iBigMonitor(:) = false; + iBigMonitor(firstBigMonitor) = true; +end + +end \ No newline at end of file diff --git a/Util/getRectMonitor.m b/Util/getRectMonitor.m new file mode 100644 index 000000000..9ae04940d --- /dev/null +++ b/Util/getRectMonitor.m @@ -0,0 +1,67 @@ +function [ monitorRect ] = getRectMonitor() +%GETRECTMONITOR Returns a 4 element vector rect = [left, bottom, width, height] +%where left and bottom define the distance from the lower-left corner of the biggest screen to the lower-left +%corner of the full figure window. width and height define the dimensions of the window. See the Units property +%for information on the units used in this specification. The left and bottom elements +%can be negative on systems that have more than one monitor. +% + +monitorRect = get(0,'MonitorPosition'); + +switch computer + case {'PCWIN', 'PCWIN64'} + % we need to convert from: + % [xmin2,ymin2,xmax2,ymax2; + % xmin1,ymin1,xmax1,ymax1] + % The last row corresponds to device 1. The monitor labeled as device 1 in the Windows control + % panel remains the reference monitor that defines the position of the + % origin. The values for minimum and maximum are relative to the origin. + xMin = monitorRect(:, 1); + yMin = monitorRect(:, 2); + xMax = monitorRect(:, 3); + yMax = monitorRect(:, 4); + + width = xMax - xMin + 1; + height = yMax - yMin + 1; + + heightFullRect = max(yMax) - min(yMin) + 1; + + left = xMin - 1; + bottom = heightFullRect - (yMin - 1 + height); + + case 'GLNXA64' + % we need to convert from: + % [xP yP widthP heightP; + % xS yS widthS heightS] + % The upper-left corner of a rectangle enclosing the system monitors forms the origin. + % Where the values represent the offset from the left (x), + % the offset from the top (y), and the width and + % height of the monitor. + xP = monitorRect(:, 1); + yP = monitorRect(:, 2); + widthP = monitorRect(:, 3); + heightP = monitorRect(:, 4); + + heightFullRect = max(yP + heightP); + + left = xP; + bottom = heightFullRect - (yP + heightP); + width = widthP; + height = heightP; + + case 'MACI64' + % we need to convert from: + % [x,y,width,height-menuHieght] + % MATLAB on Macintosh systems recognize only the main monitor. + % Where the values are x = 0, y =0, monitor width, and monitor height minus the height of + % the menubar. The main monitor is determined by which display has the menu bar. + left = monitorRect(:, 1); + bottom = monitorRect(:, 2); + width = monitorRect(:, 3); + height = monitorRect(:, 4); + +end + +monitorRect = [left, bottom, width, height]; + +end \ No newline at end of file diff --git a/Util/populateMetadata.m b/Util/populateMetadata.m index 8016c34ad..98ee3b48d 100644 --- a/Util/populateMetadata.m +++ b/Util/populateMetadata.m @@ -48,9 +48,8 @@ if ~isstruct(sample_data), error('sample_data must be a struct'); end - % get the toolbox execution mode. Values can be 'timeSeries' and 'profile'. - % If no value is set then default mode is 'timeSeries' - mode = lower(readProperty('toolbox.mode')); + % get the toolbox execution mode + mode = readProperty('toolbox.mode'); idDepth = 0; idHeight = 0; @@ -308,7 +307,7 @@ case 'profile' sample_data.variables{ivLat}.data = sample_data.variables{ivLat}.typeCastFunc(ones(size(sample_data.variables{ivLat}.data))*sample_data.geospatial_lat_min); - otherwise + case 'timeSeries' if length(sample_data.variables{ivLat}.data) == 1 sample_data.variables{ivLat}.data = sample_data.variables{ivLat}.typeCastFunc(sample_data.geospatial_lat_min); end @@ -326,7 +325,7 @@ case 'profile' sample_data.variables{ivLon}.data = sample_data.variables{ivLon}.typeCastFunc(ones(size(sample_data.variables{ivLon}.data))*sample_data.geospatial_lon_min); - otherwise + case 'timeSeries' if length(sample_data.variables{ivLon}.data) == 1 sample_data.variables{ivLon}.data = sample_data.variables{ivLon}.typeCastFunc(sample_data.geospatial_lon_min); end @@ -344,7 +343,7 @@ sample_data.variables{ivNomDepth}.data = sample_data.variables{ivNomDepth}.typeCastFunc(sample_data.instrument_nominal_depth); end -% otherwise +% case 'profile' % sample_data.variables{ivNomDepth}.data = sample_data.variables{ivNomDepth}.typeCastFunc(ones(size(sample_data.variables{ivNomDepth}.data))*sample_data.instrument_nominal_depth); end @@ -361,7 +360,7 @@ sample_data.variables{ivBotDepth}.data = sample_data.variables{ivBotDepth}.typeCastFunc(ones(size(sample_data.variables{ivBotDepth}.data))*sample_data.site_nominal_depth); end -% otherwise +% case 'timeSeries' % if ~isempty(sample_data.site_depth_at_deployment) % sample_data.variables{ivBotDepth}.data = sample_data.variables{ivBotDepth}.typeCastFunc(ones(size(sample_data.variables{ivBotDepth}.data))*sample_data.site_depth_at_deployment); % elseif ~isempty(sample_data.site_nominal_depth) diff --git a/Util/updateIf.m b/Util/updateIf.m new file mode 100644 index 000000000..265ce1324 --- /dev/null +++ b/Util/updateIf.m @@ -0,0 +1,55 @@ +function value = updateIf(testValue, trueValue, falseValue) +%UPDATEIF Return trueValue if testValue is true, otherwise return +%falseValue. Useful in template file to perform some IF statements +% +% +% Inputs: +% +% testValue - object checked if true +% trueValue - object to be returned if testValue is true +% falseValue - object to be returned if testValue is false +% +% Outputs: +% +% value - object returned. +% +% Author: Guillaume Galibert +% + +% +% Copyright (c) 2011, eMarine Information Infrastructure (eMII) and Integrated +% Marine Observing System (IMOS). +% All rights reserved. +% +% Redistribution and use in source and binary forms, with or without +% modification, are permitted provided that the following conditions are met: +% +% * Redistributions of source code must retain the above copyright notice, +% this list of conditions and the following disclaimer. +% * Redistributions in binary form must reproduce the above copyright +% notice, this list of conditions and the following disclaimer in the +% documentation and/or other materials provided with the distribution. +% * Neither the name of the eMII/IMOS nor the names of its contributors +% may be used to endorse or promote products derived from this software +% without specific prior written permission. +% +% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +% POSSIBILITY OF SUCH DAMAGE. +% + narginchk(3,3); + + if testValue + value = trueValue; + else + value = falseValue; + end +end diff --git a/imosToolbox.m b/imosToolbox.m index 00006a3a2..3a12f6bdb 100644 --- a/imosToolbox.m +++ b/imosToolbox.m @@ -73,7 +73,7 @@ function imosToolbox(auto, varargin) end % Set current toolbox version -toolboxVersion = ['2.5.9 - ' computer]; +toolboxVersion = ['2.5.10 - ' computer]; switch auto case 'auto', autoIMOSToolbox(toolboxVersion, varargin{:}); diff --git a/imosToolbox_Linux64.bin b/imosToolbox_Linux64.bin index 38dccbbc0..0397f9e15 100755 Binary files a/imosToolbox_Linux64.bin and b/imosToolbox_Linux64.bin differ diff --git a/imosToolbox_Win32.exe b/imosToolbox_Win32.exe index 7b2c950b4..5fc23e930 100644 Binary files a/imosToolbox_Win32.exe and b/imosToolbox_Win32.exe differ diff --git a/imosToolbox_Win64.exe b/imosToolbox_Win64.exe index 80decd20e..56959b9b6 100644 Binary files a/imosToolbox_Win64.exe and b/imosToolbox_Win64.exe differ diff --git a/toolboxProperties.txt b/toolboxProperties.txt index bf710d5df..b1184f30f 100644 --- a/toolboxProperties.txt +++ b/toolboxProperties.txt @@ -15,8 +15,7 @@ toolbox.ddb.connection = toolbox.ddb.user = toolbox.ddb.password = -% toolbox execution mode. Values can be 'timeSeries' and 'profile'. -% If no value is set then default mode is 'timeSeries' +% toolbox execution mode. Values can be 'timeSeries' or 'profile'. toolbox.mode = timeSeries % directory which contains netcdf templates