


Generate latitude used for FVCOM Coriolis file
[Mobj] = function add_coriolis(Mobj,varargin)
DESCRIPTION:
add Coriolis parameter to Matlab mesh object
INPUT
Mobj = matlab mesh object
[optional] cortype = coriolis type
'uselatitude' (default): use Mobj.lat
'constant'
[optional] fval = constant latitude for constant Coriolis
OUTPUT:
Mobj = matlab structure containing Mesh data + fvcom Coriolis
EXAMPLE USAGE
Mobj = add_coriolis(Mobj,'constant',41.0)
Mobj = add_coriolis(Mobj)
Author(s):
Geoff Cowles (University of Massachusetts Dartmouth)
Revision history
==============================================================================

0001 function [Mobj] = add_coriolis(Mobj,cortype,fval) 0002 0003 % Generate latitude used for FVCOM Coriolis file 0004 % 0005 % [Mobj] = function add_coriolis(Mobj,varargin) 0006 % 0007 % DESCRIPTION: 0008 % add Coriolis parameter to Matlab mesh object 0009 % 0010 % INPUT 0011 % Mobj = matlab mesh object 0012 % [optional] cortype = coriolis type 0013 % 'uselatitude' (default): use Mobj.lat 0014 % 'constant' 0015 % [optional] fval = constant latitude for constant Coriolis 0016 % 0017 % OUTPUT: 0018 % Mobj = matlab structure containing Mesh data + fvcom Coriolis 0019 % 0020 % EXAMPLE USAGE 0021 % Mobj = add_coriolis(Mobj,'constant',41.0) 0022 % Mobj = add_coriolis(Mobj) 0023 % 0024 % Author(s): 0025 % Geoff Cowles (University of Massachusetts Dartmouth) 0026 % 0027 % Revision history 0028 % 0029 %============================================================================== 0030 global ftbverbose 0031 subname = 'add_coriolis'; 0032 if(ftbverbose) 0033 fprintf('\n') 0034 fprintf(['begin : ' subname '\n']) 0035 end; 0036 0037 %------------------------------------------------------------------------------ 0038 % Parse arguments 0039 %------------------------------------------------------------------------------ 0040 CorType = 'uselatitude'; 0041 if(exist('cortype')) 0042 if(cortype(1:3)=='use') 0043 CorType = 'uselatitude'; 0044 if(~Mobj.have_lonlat) 0045 error('To set Coriolis with latitude, need (lon,lat) field in Mesh structure') 0046 end; 0047 else 0048 CorType = 'constant'; 0049 if(~exist('fval')) 0050 error('must provide a constant latitude for constant coriolis option'); 0051 end; 0052 end; 0053 end; 0054 0055 %------------------------------------------------------------------------------ 0056 % Set Coriolis 0057 %------------------------------------------------------------------------------ 0058 if(CorType(1:3) == 'use') 0059 if(ftbverbose); fprintf('setting Coriolis to latitude\n');end; 0060 Mobj.f = Mobj.lat; 0061 end; 0062 0063 if(CorType(1:3) == 'con') 0064 if(ftbverbose); fprintf('setting Coriolis to constant %f\n',fval); end; 0065 Mobj.f = fval*ones(Mobj.nVerts,1); 0066 end; 0067 0068 Mobj.have_cor = true; 0069 0070 if(ftbverbose) 0071 fprintf(['end : ' subname '\n']) 0072 end; 0073 0074 0075 0076