Commit f0ba4d90 authored by Pierre Cazenave's avatar Pierre Cazenave

Add the required fields to the Mobj help. Also add an example usage section....

Add the required fields to the Mobj help. Also add an example usage section. Finally, tidy up some of the fprintf statements
parent 6773088b
...@@ -9,9 +9,14 @@ function fvcom = grid2fvcom(Mobj,vars,data) ...@@ -9,9 +9,14 @@ function fvcom = grid2fvcom(Mobj,vars,data)
% V10 values onto the specified FVCOM grid file. % V10 values onto the specified FVCOM grid file.
% %
% INPUT: % INPUT:
% Mobj - MATLAB mesh object % Mobj - MATLAB mesh object with the following fields:
% vars - a cell array of the variables to be interpolated on the FVCOM % x, y, lon, lat - cartesian and spherical node coordinates. These
% grid in Mobj (e.g. uwnd, U10, vwnd, V10 etc.). % are transferred to the NetCDF file only and are not used in the
% interpolation at all.
% nVerts - number of vertices (nodes) in the unstructured grid.
% nElems - number of elements in the unstructured grid.
% vars - a cell array of the variable names to be interpolated on the
% FVCOM grid in Mobj (e.g. uwnd, U10, vwnd, V10 etc.).
% data - a struct which contains the following arrays: % data - a struct which contains the following arrays:
% x - x data (probably best in cartesian for the interpolation) % x - x data (probably best in cartesian for the interpolation)
% y - y data (probably best in cartesian for the interpolation) % y - y data (probably best in cartesian for the interpolation)
...@@ -23,8 +28,13 @@ function fvcom = grid2fvcom(Mobj,vars,data) ...@@ -23,8 +28,13 @@ function fvcom = grid2fvcom(Mobj,vars,data)
% %
% OUTPUT: % OUTPUT:
% fvcom - struct of the interpolated data values at the model nodes and % fvcom - struct of the interpolated data values at the model nodes and
% element centres. Also includes any variables which were in the input % element centres. Also includes any variables which were in the
% struct but which have not been interpolated (e.g. time). % input struct but which have not been interpolated (e.g. time).
%
% EXAMPLE USAGE:
% interpfields = {'uwnd', 'vwnd', 'slp', 'nshf', 'nlwrs', 'nswrs', ...
% 'P_E', 'Et', 'time', 'lon', 'lat', 'x', 'y'};
% forcing_interp = grid2fvcom(Mobj, interpfields, forcing);
% %
% NOTE: % NOTE:
% The shape of the returned arrays for rhum and slp (via % The shape of the returned arrays for rhum and slp (via
...@@ -32,6 +42,8 @@ function fvcom = grid2fvcom(Mobj,vars,data) ...@@ -32,6 +42,8 @@ function fvcom = grid2fvcom(Mobj,vars,data)
% (they appear to be projected onto a different grid). Unless you % (they appear to be projected onto a different grid). Unless you
% desperately need them, I would suggest omitting them from the % desperately need them, I would suggest omitting them from the
% interpolation here as this assumes the arrays are all the same size. % interpolation here as this assumes the arrays are all the same size.
% Alternatively, give data.xalt and data.yalt to specify the alternative
% grid.
% %
% Author(s): % Author(s):
% Pierre Cazenave (Plymouth Marine Laboratory) % Pierre Cazenave (Plymouth Marine Laboratory)
...@@ -62,9 +74,8 @@ end ...@@ -62,9 +74,8 @@ end
subname = 'grid2fvcom'; subname = 'grid2fvcom';
global ftbverbose; global ftbverbose;
if(ftbverbose) if ftbverbose
fprintf('\n') fprintf('\nbegin : %s \n', subname)
fprintf(['begin : ' subname '\n'])
end end
%-------------------------------------------------------------------------- %--------------------------------------------------------------------------
...@@ -139,5 +150,5 @@ for vv=1:length(vars) ...@@ -139,5 +150,5 @@ for vv=1:length(vars)
end end
if ftbverbose; if ftbverbose;
fprintf(['end : ' subname '\n']) fprintf('end : %s \n', subname)
end 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