aodn / imos-toolbox

Graphical tool for QC'ing and NetCDF'ing oceanographic datasets
GNU General Public License v3.0
45 stars 30 forks source link

depthPP bug #733

Closed BecCowley closed 3 years ago

BecCowley commented 3 years ago

Found this error in the depthPP.m routine that occurs when the instrument has depth calculated on board and imported. The variable therefore exists. If the DEPTH is bad and requires overwriting, then lines 848-857 are used. Perhaps no-one has had this happen before?

Current:

if depthIdx(iCurSam)
    % update existing depth data in data set
    sample_data{iCurSam}.(depthVarType).data = computedDepth;

    depthComment = sample_data{iCurSam}.(depthVarType).comment;
    if isempty(depthComment)
        sample_data{iCurSam}.(depthVarType).comment = computedDepthComment;
    else
        sample_data{iCurSam}.(depthVarType).comment = [comment ' ' computedDepthComment];
    end

Updated version, add variable index - {depthIdx(iCurSam)}:

if depthIdx(iCurSam)
    % update existing depth data in data set
    sample_data{iCurSam}.(depthVarType){depthIdx(iCurSam)}.data = computedDepth;

    depthComment = sample_data{iCurSam}.(depthVarType){depthIdx(iCurSam)}.comment;
    if isempty(depthComment)
        sample_data{iCurSam}.(depthVarType){depthIdx(iCurSam)}.comment = computedDepthComment;
    else
        sample_data{iCurSam}.(depthVarType){depthIdx(iCurSam)}.comment = [comment ' ' computedDepthComment];
    end
ocehugo commented 3 years ago

Confirmed and I agree - syntax error. The fix is on the way for the current release which is waiting https://github.com/aodn/imos-toolbox/pull/732 to be merged.