Commit 4abd31fc authored by Pierre Cazenave's avatar Pierre Cazenave

Add better checks for NaNs in the interpolated data

parent 448389f6
...@@ -107,8 +107,13 @@ for vv=1:length(vars) ...@@ -107,8 +107,13 @@ for vv=1:length(vars)
ftsin = TriScatteredInterp(data.x(:), data.y(:), currvar(:), 'natural'); ftsin = TriScatteredInterp(data.x(:), data.y(:), currvar(:), 'natural');
fvcom.(vars{vv}).node(:,i) = ftsin(x,y); fvcom.(vars{vv}).node(:,i) = ftsin(x,y);
fvcom.(vars{vv}).data(:,i) = ftsin(xc,yc); fvcom.(vars{vv}).data(:,i) = ftsin(xc,yc);
if sum(isnan(fvcom.(vars{vv}).node(:,i))) > 0 || sum(isnan(fvcom.(vars{vv}).data(:,i))) > 0 nnans(1) = sum(isnan(fvcom.(vars{vv}).node(:,i)));
warning('NaNs in the interpolated data. This won''t work with FVCOM.') nnans(2) = sum(isnan(fvcom.(vars{vv}).data(:,i)));
if nnans(1) > 0
warning('%i NaNs in the interpolated node data. This won''t work with FVCOM.', nnans(1))
if nnans(2) > 0
warning('%i NaNs in the interpolated element data. This won''t work with FVCOM.', nnans(2))
end end
end end
fprintf('interpolation of %s complete\n', vars{vv}); fprintf('interpolation of %s complete\n', vars{vv});
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