Commit e8f8da1a authored by Pierre Cazenave's avatar Pierre Cazenave

Undo the depth profile inversion since using the depths to interpolate means...

Undo the depth profile inversion since using the depths to interpolate means the values are reordered if necessary
parent 8f95867f
......@@ -284,11 +284,8 @@ for t = 1:nt
% range of interpolation schemes, of which pchip seems to do a
% decent job of the interpolation (at least qualitatively).
if ~isnan(tpz)
% POLCOMS (from which these AMM data are derived) starts
% its vertical layers from the seabed, FVCOM from the
% surface. Flip the POLCOMS data to match FVCOM's scheme.
fvtempz(pp, :) = interp1(tpz, fliplr(itempz(pp, :)), tfz, 'linear', 'extrap');
fvsalz(pp, :) = interp1(tpz, fliplr(isalz(pp, :)), tfz, 'linear', 'extrap');
fvtempz(pp, :) = interp1(tpz, itempz(pp, :), tfz, 'linear', 'extrap');
fvsalz(pp, :) = interp1(tpz, isalz(pp, :), tfz, 'linear', 'extrap');
else
warning('Should never see this... ') % because we test for NaNs when fetching the values.
warning('FVCOM boundary node at %f, %f is outside the AMM domain. Skipping.', fvlon(pp), fvlat(pp))
......
......@@ -331,10 +331,8 @@ for t = 1:nt
% look horrible (shaving off extremes). I think pchip is
% better.
if ~isnan(tpz)
% POLCOMS starts at the seabed, FVCOM starts at the
% surface. So, we need to flip the POLCOMS profiles.
fvtempz(pp, :) = interp1(tpz, fliplr(itempz(pp, :)), tfz, 'linear', 'extrap');
fvsalz(pp, :) = interp1(tpz, fliplr(isalz(pp, :)), tfz, 'linear', 'extrap');
fvtempz(pp, :) = interp1(tpz, itempz(pp, :), tfz, 'linear', 'extrap');
fvsalz(pp, :) = interp1(tpz, isalz(pp, :), tfz, 'linear', 'extrap');
else
warning('Should never see this... ') % because we test for NaNs when fetching the values.
warning('FVCOM boundary node at %f, %f is outside the POLCOMS domain. Skipping.', fvlon(pp), fvlat(pp))
......
......@@ -275,12 +275,9 @@ for xi = 1:nx
% Now get the POLCOMS depth at this node for the time index
% identified above.
tpz = xdepth(yi, :);
% POLCOMS starts its vertical layers from the seabed, FVCOM
% from the surface. Flip the POLCOMS data to match FVCOM's
% scheme.
ytemp(yi, :) = interp1(tpz, fliplr(xtemp(yi, :)), tfz, 'linear', 'extrap');
ytemp(yi, :) = interp1(tpz, xtemp(yi, :), tfz, 'linear', 'extrap');
ysalt(yi, :) = interp1(tpz, fliplr(xsalt(yi, :)), tfz, 'linear', 'extrap');
ysalt(yi, :) = interp1(tpz, xsalt(yi, :), tfz, 'linear', 'extrap');
end
end
pctempz(xi, :, :) = ytemp;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment