diff --git a/AutomaticQC/imosTiltVelocitySetQC.m b/AutomaticQC/imosTiltVelocitySetQC.m index c3b61875f..0130a28b2 100644 --- a/AutomaticQC/imosTiltVelocitySetQC.m +++ b/AutomaticQC/imosTiltVelocitySetQC.m @@ -176,8 +176,8 @@ if isempty(firstTiltThreshold) && auto % couldn't find this instrument so quit the test - disp(['Warning: imosTiltVelositySetQC could not be performed on ' sample_data.toolbox_input_file ... - ' instrument = "' instrument '" => Fill imosTiltVelositySetQC.txt with relevant make/model information if you wish to run this test on this dataset.']); + disp(['Warning: imosTiltVelocitySetQC could not be performed on ' sample_data.toolbox_input_file ... + ' instrument = "' instrument '" => Fill imosTiltVelocitySetQC.txt with relevant make/model information if you wish to run this test on this dataset.']); return; end @@ -188,7 +188,7 @@ names = {'firstTiltThreshold [deg]', 'firstFlagThreshold [imosQCFlag]', 'secondTiltThreshold [deg]', 'secondFlagThreshold [imosQCFlag]'}; values = {firstTiltThreshold, firstFlagThreshold, secondTiltThreshold, secondFlagThreshold}; funcs = {isdeg, isvalidQC, isdeg, isvalidQC}; - results = uiNumericalBox(names,values,funcs,'title','imosTiltVelositySetQC - Threshold Limits','panelTitle',matchedName); + results = uiNumericalBox(names,values,funcs,'title','imosTiltVelocitySetQC - Threshold Limits','panelTitle',matchedName); [firstTiltThreshold,firstFlagThreshold,secondTiltThreshold,secondFlagThreshold] = results{:}; end diff --git a/AutomaticQC/imosTimeSeriesSpikeQC.m b/AutomaticQC/imosTimeSeriesSpikeQC.m index 14e52b00f..92976bdc8 100644 --- a/AutomaticQC/imosTimeSeriesSpikeQC.m +++ b/AutomaticQC/imosTimeSeriesSpikeQC.m @@ -47,18 +47,23 @@ if (is_profile || time_missing), return, end -has_burst_duration = false; -has_burst_interval = false; -try - has_burst_duration = sample_data.meta.instrument_burst_duration; - has_burst_interval = sample_data.meta.instrument_burst_interval; -catch - try - has_burst_duration = sample_data.instrument_burst_duration; - has_burst_interval = sample_data.meta.instrument_burst_interval; - end + +if isfield(sample_data.meta,'instrument_burst_duration') + burst_duration = sample_data.meta.instrument_burst_duration; + valid_burst_duration = ~isempty(burst_duration) && ~isnan(burst_duration) && burst_duration>0; +elseif isfield(sample_data,'instrument_burst_duration') + burst_duration = sample_data.meta.instrument_burst_duration; + valid_burst_duration = ~isempty(burst_duration) && ~isnan(burst_duration) && burst_duration>0; end -has_burst = has_burst_duration || has_burst_interval; +if isfield(sample_data.meta,'instrument_burst_interval') + burst_interval = sample_data.meta.instrument_burst_interval; + valid_burst_interval = ~isempty(burst_interval) && ~isnan(burst_interval) && burst_interval>0; +elseif isfield(sample_data,'instrument_burst_interval') + burst_interval = sample_data.meta.instrument_burst_interval; + valid_burst_interval = ~isempty(burst_interval) && ~isnan(burst_interval) && burst_interval>0; +end + +has_burst = (valid_burst_duration) || (valid_burst_interval); if has_burst opts_file = ['AutomaticQC' filesep 'imosTimeSeriesSpikeQCBurst.txt']; diff --git a/Java/ddb.jar b/Java/ddb.jar index 956339409..3406c509e 100644 Binary files a/Java/ddb.jar and b/Java/ddb.jar differ diff --git a/Parser/netcdfParse.m b/Parser/netcdfParse.m index 0e1ef369e..5efaf9b7b 100644 --- a/Parser/netcdfParse.m +++ b/Parser/netcdfParse.m @@ -182,9 +182,9 @@ sample_data.meta.instrument_make = ''; sample_data.meta.instrument_model = ''; sample_data.meta.instrument_serial_no = ''; - sample_data.meta.instrument_sample_interval = NaN; - sample_data.meta.instrument_burst_duration = NaN; - sample_data.meta.instrument_burst_interval = NaN; + sample_data.meta.instrument_sample_interval = ''; + sample_data.meta.instrument_burst_duration = ''; + sample_data.meta.instrument_burst_interval = ''; sample_data.meta.featureType = ''; %special names mappings diff --git a/Util/CellUtils/inCellPartialMatchString.m b/Util/CellUtils/inCellPartialMatchString.m new file mode 100644 index 000000000..489abca29 --- /dev/null +++ b/Util/CellUtils/inCellPartialMatchString.m @@ -0,0 +1,93 @@ +function [is_complete, indexes] = inCellPartialMatchString(xcell,ycell,first_match_only) +% function [indexes,is_complete] = inCellPartialMatchString(xcell, ycell,first_match_only) +% +% Check if each string entry in ycell is within any string entry in xcell. +% +% If all the content of a ycell{n} string +% is found within the string of xcell{m} +% the m index is stored. +% +% For simple partial string matching, use the contains function +% +% See examples for usage. +% +% Inputs: +% +% xcell - a cell with items as strings. +% ycell - a string or another cell with items as strings. +% first_match_only - a boolean to skip subsequent matches of ycell in xcell. +% - Default: false +% +% Output: +% +% is_complete - a boolean to indicate that all ycell items +% were matched. +% indexes - a cell of indexes where matches occur in xcell. +% +% +% Example: +% % complete match +% xnames = {'a','ab','abc','123'}; +% ynames = {'a','3'}; +% [is_complete, indexes] = inCellPartialMatchString(xnames,ynames); +% assert(is_complete) +% assert(isequal({1,2,3,4},indexes)) +% [is_complete, indexes] = inCellPartialMatchString(xnames,ynames,true); +% assert(is_complete) +% assert(isequal({1,4},indexes)) +% +% % incomplete match +% xnames = {'a','b','c','123'}; +% ynames = {'x','y','z','3'}; +% [is_complete, indexes] = inCellPartialMatchString(xnames,ynames); +% assert(~is_complete) +% assert(isequal({4},indexes)) +% +% % no match +% xnames = {'x','y','z'}; +% ynames = {'a','b','c'}; +% [is_complete, indexes] = inCellPartialMatchString(xnames,ynames); +% assert(~is_complete) +% assert(isequal({},indexes)) + +% +% author: hugo.oliveira@utas.edu.au +% +narginchk(2, 3) +if nargin<3 + first_match_only = false; +end + +if ~iscell(ycell) + ycell = {ycell}; +end + +indexes = cell(1,numel(ycell)*numel(xcell)); +ydetection = zeros(1,numel(ycell)); + +c = 0; +for k = 1:numel(ycell) + if ~ischar(ycell{k}) + error('The second argument index `ycell{%d}` is not a string', k); + end + for kk = 1:length(xcell) + if ~ischar(xcell{kk}) + error('The first argument index `xcell{%d}` is not a string', k); + end + if contains(xcell{kk},ycell{k}) + c = c + 1; + indexes{c} = kk; + ydetection(k) = true; + if first_match_only + break + end + end + end +end + +indexes = indexes(1:c); +if isempty(indexes) + indexes = {}; +end +is_complete = all(ydetection); +end diff --git a/build.py b/build.py index 0cca300a6..0793295c2 100755 --- a/build.py +++ b/build.py @@ -66,8 +66,7 @@ def find_matlab_rootpath(arch_str): def run(command: str): """Run a command at shell/cmdline.""" - proc = sp.run(command, stdout=sp.PIPE, stderr=sp.PIPE, shell=True, check=True) - return proc.stdout.decode("utf-8").strip(), proc.stderr.decode("utf-8").strip() + return sp.run(command, shell=True, check=True) def create_java_call_sig_compile(root_path: str) -> str: @@ -287,14 +286,15 @@ def write_version(afile: str, version: str) -> None: print(repo_info) print(f"Calling {java_call}..") - stdout, stderr = run(java_call) - if stderr: + ok = run(java_call) + if not ok: raise Exception(f"{jcall} failed") print(f"Calling {mcc_call}...") for mcall in mcc_call: - stdout, stderr = run(mcall) - if stderr: + print(f"Executing {mcall}") + ok = run(mcall) + if not ok: raise Exception(f"{mcall} failed") print(f"The toolbox architecture is {ARCH_NAMES[arch]}.") diff --git a/imosToolbox.m b/imosToolbox.m index c0efcc4f8..40120ea96 100644 --- a/imosToolbox.m +++ b/imosToolbox.m @@ -37,7 +37,7 @@ function imosToolbox(auto, varargin) % % Set current toolbox version -toolboxVersion = ['2.6.7 - ' computer]; +toolboxVersion = ['2.6.8 - ' computer]; if nargin == 0, auto = 'manual'; end @@ -49,16 +49,25 @@ function imosToolbox(auto, varargin) path = ''; if ~isdeployed [path, ~, ~] = fileparts(which('imosToolbox.m')); - % set Matlab path for this session (add all recursive directories to Matlab % path) - searchPath = textscan(genpath(path), '%s', 'Delimiter', pathsep); - searchPath = searchPath{1}; - iPathToRemove = ~cellfun(@isempty, strfind(searchPath, [filesep '.'])); - searchPath(iPathToRemove) = []; - searchPath = cellfun(@(x)([x pathsep]), searchPath, 'UniformOutput', false); - searchPath = [searchPath{:}]; - addpath(searchPath); + addpath(fullfile(path,'Util/Path')); + addpath(fullfile(path,'Util/CellUtils')); + addpath(fullfile(path,'Util/Schema')); + + [~,subfolders] = FilesInFolder(path); + ignored_subfolders = {'.git','.mypy_cache','imos-toolbox/snapshot','imos-toolbox/data','imos-toolbox/dist'}; + [~,ignore_indexes] = inCellPartialMatchString(subfolders,ignored_subfolders); + valid_subfolders = popFromCell(subfolders,subfolders([ignore_indexes{:}])); + + rmpath(fullfile(path,'Util/Path')); + rmpath(fullfile(path,'Util/CellUtils')); + rmpath(fullfile(path,'Util/Schema')); + + cell_of_folders_strings = cellfun(@genpath,valid_subfolders,'UniformOutput',false); + all_folders_as_string= cat(2,cell_of_folders_strings{:}); + addpath(path); + addpath(all_folders_as_string); end if isempty(path), path = pwd; end diff --git a/imosToolbox_Linux64.bin b/imosToolbox_Linux64.bin index c8a189bfc..1fb15c1d4 100755 Binary files a/imosToolbox_Linux64.bin and b/imosToolbox_Linux64.bin differ diff --git a/imosToolbox_Win64.exe b/imosToolbox_Win64.exe index 78d77f75b..7be70bd64 100644 Binary files a/imosToolbox_Win64.exe and b/imosToolbox_Win64.exe differ