Commit d9d72e67 authored by Pierre Cazenave's avatar Pierre Cazenave

Add check to make sure the interpolated grid is NaN-free (otherwise FVCOM will...

Add check to make sure the interpolated grid is NaN-free (otherwise FVCOM will crash trying to run a model using this data)
parent 1d068528
......@@ -47,8 +47,6 @@ function fvcom = grid2fvcom(Mobj,vars,data)
%
%==========================================================================
warning off
if nargin ~= 3
error('Incorrect number of arguments')
end
......@@ -109,6 +107,9 @@ for vv=1:length(vars)
ftsin = TriScatteredInterp(data.x(:), data.y(:), currvar(:), 'natural');
fvcom.(vars{vv}).node(:,i) = ftsin(x,y);
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
warning('NaNs in the interpolated data. This won''t work with FVCOM.')
end
end
fprintf('interpolation of %s complete\n', vars{vv});
end
......
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