Skip to content

Commit

Permalink
Fix case in getPresRelForGSW.m and rinkoDoPP.m for when TEMP is not a…
Browse files Browse the repository at this point in the history
…vailable in the dataset. What we need access to, is the main dimension of the dataset.
  • Loading branch information
ggalibert committed Sep 28, 2017
1 parent b2b9950 commit f65bbdf
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 4 deletions.
20 changes: 18 additions & 2 deletions Preprocessing/rinkoDoPP.m
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,24 @@
end

else
tempIdx = getVar(sam.variables, 'TEMP');
presRel = sam.instrument_nominal_depth * ones(size(sam.variables{tempIdx}.data));
% get the toolbox execution mode
mode = readProperty('toolbox.mode');
switch mode
case 'profile'
dimIdx = getVar(sam.dimensions, 'DEPTH');
if dimIdx == 0
dimIdx = getVar(sam.dimensions, 'MAXZ');
end

case 'timeSeries'
dimIdx = getVar(sam.dimensions, 'TIME');

otherwise
return;

end

presRel = sam.instrument_nominal_depth * ones(size(sam.dimensions{dimIdx}.data));
presName = 'instrument_nominal_depth (assuming 1 m ~ 1 dbar)';
end
end
Expand Down
21 changes: 19 additions & 2 deletions Util/getPresRelForGSW.m
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,25 @@
presName = 'DEPTH';
else
% with nominal depth information
tempIdx = getVar(sam.variables, 'TEMP');
depth = sam.instrument_nominal_depth * ones(size(sam.variables{tempIdx}.data));

% get the toolbox execution mode
mode = readProperty('toolbox.mode');
switch mode
case 'profile'
dimIdx = getVar(sam.dimensions, 'DEPTH');
if dimIdx == 0
dimIdx = getVar(sam.dimensions, 'MAXZ');
end

case 'timeSeries'
dimIdx = getVar(sam.dimensions, 'TIME');

otherwise
return;

end

depth = sam.instrument_nominal_depth * ones(size(sam.dimensions{dimIdx}.data));
presName = 'instrument_nominal_depth';
end

Expand Down

0 comments on commit f65bbdf

Please sign in to comment.