Skip to content

Commit

Permalink
.mqc and .pqc file naming convention for a file.ext changes from file…
Browse files Browse the repository at this point in the history
….mqc to file.ext.mqc for example in order to support different .pqc and .mqc files when different datasets have the same radical file name (which is the case for current and wave data from ADCP for example).
  • Loading branch information
ggalibert committed Nov 18, 2016
1 parent 633c5ab commit b06dd10
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 12 deletions.
11 changes: 9 additions & 2 deletions AutomaticQC/imosHistoricalManualSetQC.m
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,15 @@
paramsLog = [];

% read manual QC file for this dataset
[mqcPath, mqcFile, ~] = fileparts(sample_data.toolbox_input_file);
mqcFile = fullfile(mqcPath, [mqcFile, '.mqc']);
mqcFile = [sample_data.toolbox_input_file, '.mqc'];

% we need to migrate any remnants of the old file naming convention
% for .mqc files.
[mqcPath, oldMqcFile, ~] = fileparts(sample_data.toolbox_input_file);
oldMqcFile = fullfile(mqcPath, [oldMqcFile, '.mqc']);
if exist(oldMqcFile, 'file')
movefile(oldMqcFile, mqcFile);
end

if exist(mqcFile, 'file')
load(mqcFile, '-mat', 'mqc');
Expand Down
12 changes: 10 additions & 2 deletions AutomaticQC/readQCparameter.m
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,16 @@
if ~ischar(QCtest), error('QCtest must be a string'); end
if ~ischar(param), error('param must be a string'); end

[pqcPath, pqcFile, ~] = fileparts(rawDataFile);
pqcFile = fullfile(pqcPath, [pqcFile, '.pqc']);
pqcFile = [rawDataFile, '.pqc'];

% we need to migrate any remnants of the old file naming convention
% for .pqc files.
[pqcPath, oldPqcFile, ~] = fileparts(rawDataFile);
oldPqcFile = fullfile(pqcPath, [oldPqcFile, '.pqc']);
if exist(oldPqcFile, 'file')
movefile(oldPqcFile, pqcFile);
end

pqc = struct([]);

if exist(pqcFile, 'file')
Expand Down
12 changes: 10 additions & 2 deletions AutomaticQC/writeQCparameter.m
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,16 @@ function writeQCparameter(rawDataFile, QCtest, param, value)
if ~ischar(QCtest), error('QCtest must be a string'); end
if ~ischar(param), error('param must be a string'); end

[pqcPath, pqcFile, ~] = fileparts(rawDataFile);
pqcFile = fullfile(pqcPath, [pqcFile, '.pqc']);
pqcFile = [rawDataFile, '.pqc'];

% we need to migrate any remnants of the old file naming convention
% for .pqc files.
[pqcPath, oldPqcFile, ~] = fileparts(rawDataFile);
oldPqcFile = fullfile(pqcPath, [oldPqcFile, '.pqc']);
if exist(oldPqcFile, 'file')
movefile(oldPqcFile, pqcFile);
end

pqc = struct([]);

if exist(pqcFile, 'file'), load(pqcFile, '-mat', 'pqc'); end
Expand Down
34 changes: 28 additions & 6 deletions FlowManager/displayManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -478,8 +478,16 @@ function dataSelectCallback(ax, type, range)
flags = flagFunc(panel, graphs, sample_data{setIdx}, vars);

% write/update manual QC file for this dataset
[mqcPath, mqcFile, ~] = fileparts(sample_data{setIdx}.toolbox_input_file);
mqcFile = fullfile(mqcPath, [mqcFile, '.mqc']);
mqcFile = [sample_data{setIdx}.toolbox_input_file, '.mqc'];

% we need to check first that there is not any remnants from
% the old .mqc file naming convention
[mqcPath, oldMqcFile, ~] = fileparts(sample_data{setIdx}.toolbox_input_file);
oldMqcFile = fullfile(mqcPath, [oldMqcFile, '.mqc']);
if exist(oldMqcFile, 'file')
movefile(oldMqcFile, mqcFile);
end

mqc = struct([]);

if exist(mqcFile, 'file'), load(mqcFile, '-mat', 'mqc'); end
Expand Down Expand Up @@ -552,8 +560,15 @@ function resetManQCCallback()
end
end

[mqcPath, mqcFile, ~] = fileparts(sample_data{resetIdx(j)}.toolbox_input_file);
mqcFile = fullfile(mqcPath, [mqcFile, '.mqc']);
mqcFile = [sample_data{resetIdx(j)}.toolbox_input_file, '.mqc'];

% we need to migrate any remnants of the old file naming convention
% for .mqc files.
[mqcPath, oldMqcFile, ~] = fileparts(sample_data{resetIdx(j)}.toolbox_input_file);
oldMqcFile = fullfile(mqcPath, [oldMqcFile, '.mqc']);
if exist(oldMqcFile, 'file')
movefile(oldMqcFile, mqcFile);
end

if exist(mqcFile, 'file')
delete(mqcFile);
Expand Down Expand Up @@ -594,8 +609,15 @@ function resetPropQCCallback()
end
end

[pqcPath, pqcFile, ~] = fileparts(sample_data{resetIdx(j)}.toolbox_input_file);
pqcFile = fullfile(pqcPath, [pqcFile, '.pqc']);
pqcFile = [sample_data{resetIdx(j)}.toolbox_input_file, '.pqc'];

% we need to migrate any remnants of the old file naming convention
% for .pqc files.
[pqcPath, oldPqcFile, ~] = fileparts(sample_data{resetIdx(j)}.toolbox_input_file);
oldPqcFile = fullfile(pqcPath, [oldPqcFile, '.pqc']);
if exist(oldPqcFile, 'file')
movefile(oldPqcFile, pqcFile);
end

if exist(pqcFile, 'file')
delete(pqcFile);
Expand Down

0 comments on commit b06dd10

Please sign in to comment.