aodn/imos-toolbox

depthPP bug

Closed this issue · 1 comments

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

Confirmed and I agree - syntax error. The fix is on the way for the current release which is waiting #732 to be merged.