Commit 40602d75 authored by Pierre Cazenave's avatar Pierre Cazenave
Browse files

Add updated documentation for the newly added and amended function

parent 75844713
......@@ -24,8 +24,8 @@
<h2>Subsequent directories:</h2>
<ul style="list-style-image:url(../matlabicon.gif)">
<li>mat</li><li>plots</li><li>surface_plots</li><li>timeseries</li><li>transect_plots</li></ul>
<li>plots</li><li>surface_plots</li><li>transect_plots</li></ul>
<hr><address>Generated on Tue 18-Dec-2012 12:37:29 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" title="Matlab Documentation in HTML">m2html</a></strong> &copy; 2005</address>
<hr><address>Generated on Mon 04-Feb-2013 14:22:26 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" title="Matlab Documentation in HTML">m2html</a></strong> &copy; 2005</address>
</body>
</html>
\ No newline at end of file
......@@ -51,10 +51,12 @@
Author(s):
Geoff Cowles (University of Massachusetts Dartmouth)
Pierre Cazenave (Plymouth Marine Laboratory)
Karen Thurston (National Oceanography Centre, Liverpool)
Revision history
Modifed from add_sponge_nodes to read in nodes from a supplied list.
2012-11-26 Add ability to turn off the figures.
2013-01-18 Added support for variable sponge radius
==============================================================================</pre></div>
......@@ -97,69 +99,76 @@ This function is called by:
0024 <span class="comment">% Author(s):</span>
0025 <span class="comment">% Geoff Cowles (University of Massachusetts Dartmouth)</span>
0026 <span class="comment">% Pierre Cazenave (Plymouth Marine Laboratory)</span>
0027 <span class="comment">%</span>
0028 <span class="comment">% Revision history</span>
0029 <span class="comment">% Modifed from add_sponge_nodes to read in nodes from a supplied list.</span>
0030 <span class="comment">% 2012-11-26 Add ability to turn off the figures.</span>
0031 <span class="comment">%</span>
0032 <span class="comment">%==============================================================================</span>
0033 subname = <span class="string">'add_sponge_nodes'</span>;
0034
0035 <span class="keyword">global</span> ftbverbose
0036 <span class="keyword">if</span>(ftbverbose)
0037 fprintf(<span class="string">'\n'</span>)
0038 fprintf([<span class="string">'begin : '</span> subname <span class="string">'\n'</span>])
0039 <span class="keyword">end</span>
0040
0041 <span class="comment">% Do we want a figure showing how we're getting along?</span>
0042 <span class="keyword">if</span> nargin == 5
0043 plotFig = 0;
0044 <span class="keyword">end</span>
0045
0046 <span class="comment">%------------------------------------------------------------------------------</span>
0047 <span class="comment">% Plot the mesh</span>
0027 <span class="comment">% Karen Thurston (National Oceanography Centre, Liverpool)</span>
0028 <span class="comment">%</span>
0029 <span class="comment">% Revision history</span>
0030 <span class="comment">% Modifed from add_sponge_nodes to read in nodes from a supplied list.</span>
0031 <span class="comment">% 2012-11-26 Add ability to turn off the figures.</span>
0032 <span class="comment">% 2013-01-18 Added support for variable sponge radius</span>
0033 <span class="comment">%</span>
0034 <span class="comment">%==============================================================================</span>
0035 subname = <span class="string">'add_sponge_nodes'</span>;
0036
0037 <span class="keyword">global</span> ftbverbose
0038 <span class="keyword">if</span>(ftbverbose)
0039 fprintf(<span class="string">'\n'</span>)
0040 fprintf([<span class="string">'begin : '</span> subname <span class="string">'\n'</span>])
0041 <span class="keyword">end</span>
0042
0043 <span class="comment">% Do we want a figure showing how we're getting along?</span>
0044 <span class="keyword">if</span> nargin == 5
0045 plotFig = 0;
0046 <span class="keyword">end</span>
0047
0048 <span class="comment">%------------------------------------------------------------------------------</span>
0049 <span class="keyword">if</span> plotFig == 1
0050 <span class="keyword">if</span>(lower(Mobj.nativeCoords(1:3)) == <span class="string">'car'</span>)
0051 x = Mobj.x;
0052 y = Mobj.y;
0053 <span class="keyword">else</span>
0054 x = Mobj.lon;
0055 y = Mobj.lat;
0056 <span class="keyword">end</span>
0057
0058 figure
0059 patch(<span class="string">'Vertices'</span>,[x,y],<span class="string">'Faces'</span>,Mobj.tri,<span class="keyword">...</span>
0060 <span class="string">'Cdata'</span>,Mobj.h,<span class="string">'edgecolor'</span>,<span class="string">'k'</span>,<span class="string">'facecolor'</span>,<span class="string">'interp'</span>);
0061 hold on;
0062 plot(x(SpongeList),y(SpongeList),<span class="string">'wx'</span>)
0063 axis(<span class="string">'equal'</span>,<span class="string">'tight'</span>)
0064 <span class="keyword">end</span>
0065
0066 npts = size(SpongeList,2);
0067
0068 <span class="keyword">if</span>(npts == 0)
0069 fprintf(<span class="string">'No points in given list'</span>)
0070 fprintf([<span class="string">'end : '</span> subname <span class="string">'\n'</span>])
0071 <span class="keyword">return</span>
0072 <span class="keyword">end</span>
0073 <span class="keyword">if</span>(ftbverbose)
0074 fprintf(<span class="string">'%d points provided\n'</span>,npts)
0049 <span class="comment">% Plot the mesh</span>
0050 <span class="comment">%------------------------------------------------------------------------------</span>
0051
0052 <span class="keyword">if</span> plotFig == 1
0053 <span class="keyword">if</span>(lower(Mobj.nativeCoords(1:3)) == <span class="string">'car'</span>)
0054 x = Mobj.x;
0055 y = Mobj.y;
0056 <span class="keyword">else</span>
0057 x = Mobj.lon;
0058 y = Mobj.lat;
0059 <span class="keyword">end</span>
0060
0061 figure
0062 patch(<span class="string">'Vertices'</span>,[x,y],<span class="string">'Faces'</span>,Mobj.tri,<span class="keyword">...</span>
0063 <span class="string">'Cdata'</span>,Mobj.h,<span class="string">'edgecolor'</span>,<span class="string">'k'</span>,<span class="string">'facecolor'</span>,<span class="string">'interp'</span>);
0064 hold on;
0065 plot(x(SpongeList),y(SpongeList),<span class="string">'wx'</span>)
0066 axis(<span class="string">'equal'</span>,<span class="string">'tight'</span>)
0067 <span class="keyword">end</span>
0068
0069 npts = length(SpongeList);
0070
0071 <span class="keyword">if</span>(npts == 0)
0072 fprintf(<span class="string">'No points in given list'</span>)
0073 fprintf([<span class="string">'end : '</span> subname <span class="string">'\n'</span>])
0074 <span class="keyword">return</span>
0075 <span class="keyword">end</span>
0076
0077 <span class="comment">% add to mesh object</span>
0078 Mobj.nSponge = Mobj.nSponge + 1;
0079 Mobj.nSpongeNodes(Mobj.nSponge) = npts;
0080 Mobj.sponge_nodes(Mobj.nSponge,1:npts) = SpongeList;
0081 Mobj.sponge_name{Mobj.nSponge} = SpongeName;
0082 Mobj.sponge_rad(Mobj.nSponge) = SpongeRadius;
0083 Mobj.sponge_fac(Mobj.nSponge) = SpongeCoeff;
0084
0085 <span class="keyword">if</span>(ftbverbose)
0086 fprintf([<span class="string">'end : '</span> subname <span class="string">'\n'</span>])
0087 <span class="keyword">end</span>
0088
0089</pre></div>
<hr><address>Generated on Tue 18-Dec-2012 12:37:31 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" title="Matlab Documentation in HTML">m2html</a></strong> &copy; 2005</address>
0076 <span class="keyword">if</span>(ftbverbose)
0077 fprintf(<span class="string">'%d points provided\n'</span>,npts)
0078 <span class="keyword">end</span>
0079
0080 <span class="comment">% add to mesh object</span>
0081 Mobj.nSponge = Mobj.nSponge + 1;
0082 Mobj.nSpongeNodes(Mobj.nSponge) = npts;
0083 Mobj.sponge_nodes(Mobj.nSponge,1:npts) = SpongeList;
0084 Mobj.sponge_name{Mobj.nSponge} = SpongeName;
0085 Mobj.sponge_fac(Mobj.nSponge) = SpongeCoeff;
0086
0087 <span class="keyword">if</span> max(size(SpongeRadius))==1 <span class="comment">% if you have a constant sponge radius</span>
0088 Mobj.sponge_rad(Mobj.nSponge) = SpongeRadius;
0089 <span class="keyword">else</span> <span class="comment">% if you have a variable sponge radius</span>
0090 Mobj.sponge_rad(Mobj.nSponge,1:npts) = SpongeRadius;
0091 <span class="keyword">end</span>
0092
0093 <span class="keyword">if</span>(ftbverbose)
0094 fprintf([<span class="string">'end : '</span> subname <span class="string">'\n'</span>])
0095 <span class="keyword">end</span>
0096</pre></div>
<hr><address>Generated on Mon 04-Feb-2013 14:22:28 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" title="Matlab Documentation in HTML">m2html</a></strong> &copy; 2005</address>
</body>
</html>
\ No newline at end of file
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<title>Description of calc_sponge_radius</title>
<meta name="keywords" content="calc_sponge_radius">
<meta name="description" content="Calculate a variable sponge radius based on distance to the boundary">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="generator" content="m2html v1.5 &copy; 2003-2005 Guillaume Flandin">
<meta name="robots" content="index, follow">
<link type="text/css" rel="stylesheet" href="../m2html.css">
</head>
<body>
<a name="_top"></a>
<div><a href="../index.html">Home</a> &gt; <a href="index.html">fvcom_prepro</a> &gt; calc_sponge_radius.m</div>
<!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png">&nbsp;Master index</a></td>
<td align="right"><a href="index.html">Index for fvcom_prepro&nbsp;<img alt=">" border="0" src="../right.png"></a></td></tr></table>-->
<h1>calc_sponge_radius
</h1>
<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>Calculate a variable sponge radius based on distance to the boundary</strong></div>
<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>function [spongeRadius] = calc_sponge_radius(Mobj,Nlist) </strong></div>
<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre class="comment"> Calculate a variable sponge radius based on distance to the boundary
node's furthest neighbour.
(Adapted from Phil Hall's 'produce_netcdf_input_data.py')
spongeRadius = calc_sponge_radius(Mobj,Nlist)
DESCRIPTION
Calculates the sponge radius for each node on the open boundary, based
on the minimum of either the distance to the node's furthest
neighbour, or 100 km.
INPUT
Mobj = Matlab mesh object
Nlist = List of nodes
OUTPUT
spongeRadius = List of variable sponge radii
EXAMPLE USAGE
spongeRadius = calc_sponge_radius(Mobj,Nlist)
Author(s)
Karen Thurston (National Oceanography Centre, Liverpool)
==========================================================================</pre></div>
<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../matlabicon.gif)">
</ul>
This function is called by:
<ul style="list-style-image:url(../matlabicon.gif)">
</ul>
<!-- crossreference -->
<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function [spongeRadius] = calc_sponge_radius(Mobj,Nlist) </a>
0002
0003 <span class="comment">% Calculate a variable sponge radius based on distance to the boundary</span>
0004 <span class="comment">% node's furthest neighbour.</span>
0005 <span class="comment">% (Adapted from Phil Hall's 'produce_netcdf_input_data.py')</span>
0006 <span class="comment">%</span>
0007 <span class="comment">% spongeRadius = calc_sponge_radius(Mobj,Nlist)</span>
0008 <span class="comment">%</span>
0009 <span class="comment">% DESCRIPTION</span>
0010 <span class="comment">% Calculates the sponge radius for each node on the open boundary, based</span>
0011 <span class="comment">% on the minimum of either the distance to the node's furthest</span>
0012 <span class="comment">% neighbour, or 100 km.</span>
0013 <span class="comment">%</span>
0014 <span class="comment">% INPUT</span>
0015 <span class="comment">% Mobj = Matlab mesh object</span>
0016 <span class="comment">% Nlist = List of nodes</span>
0017 <span class="comment">%</span>
0018 <span class="comment">% OUTPUT</span>
0019 <span class="comment">% spongeRadius = List of variable sponge radii</span>
0020 <span class="comment">%</span>
0021 <span class="comment">% EXAMPLE USAGE</span>
0022 <span class="comment">% spongeRadius = calc_sponge_radius(Mobj,Nlist)</span>
0023 <span class="comment">%</span>
0024 <span class="comment">% Author(s)</span>
0025 <span class="comment">% Karen Thurston (National Oceanography Centre, Liverpool)</span>
0026 <span class="comment">%</span>
0027 <span class="comment">%==========================================================================</span>
0028 subname = <span class="string">'calc_sponge_radius'</span>;
0029 <span class="keyword">global</span> ftbverbose
0030 <span class="keyword">if</span>(ftbverbose)
0031 fprintf(<span class="string">'\n'</span>)
0032 fprintf([<span class="string">'begin : '</span> subname <span class="string">'\n'</span>])
0033 <span class="keyword">end</span>
0034
0035 <span class="comment">%--------------------------------------------------------------------------</span>
0036 <span class="comment">% Get a unique list and make sure they are in the range of node numbers</span>
0037 <span class="comment">%--------------------------------------------------------------------------</span>
0038 Nlist = unique(Nlist);
0039
0040 spongeRadius = 100000+zeros(size(Nlist));
0041
0042 <span class="comment">% For each node on the open boundary</span>
0043 <span class="keyword">for</span> i =1:length(Nlist)
0044 <span class="comment">% Find the neighbouring nodes</span>
0045 [r,c]=find(Mobj.tri==Nlist(i));
0046 neighbours = unique(Mobj.tri(r,:));
0047
0048 <span class="comment">% Remove the node of interest from the neighbours list</span>
0049 n = find(neighbours~=Nlist(i));
0050 neighbours = neighbours(n);
0051
0052 <span class="comment">% Calculate the arc length (in degrees) between the node and its</span>
0053 <span class="comment">% neighbours</span>
0054 arclen = distance(Mobj.lat(Nlist(i)),Mobj.lon(Nlist(i)),<span class="keyword">...</span>
0055 Mobj.lat(neighbours),Mobj.lon(neighbours));
0056
0057 <span class="comment">% Convert from degrees to whole metres</span>
0058 arclen = ceil(1000*deg2km(arclen));
0059
0060 <span class="comment">% If the smallest distance is less than 100km, keep it</span>
0061 <span class="keyword">if</span> min(arclen)&lt;spongeRadius(i)
0062 spongeRadius(i)=min(arclen);
0063 <span class="keyword">end</span>
0064 <span class="keyword">end</span>
0065
0066 <span class="keyword">if</span>(ftbverbose)
0067 fprintf([<span class="string">'end : '</span> subname <span class="string">'\n'</span>])
0068 <span class="keyword">end</span>
0069</pre></div>
<hr><address>Generated on Mon 04-Feb-2013 14:22:28 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" title="Matlab Documentation in HTML">m2html</a></strong> &copy; 2005</address>
</body>
</html>
\ No newline at end of file
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<title>Description of get_AMM</title>
<meta name="keywords" content="get_AMM">
<meta name="description" content="Extract boundary forcing information from NOC Operational Tide Surge">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="generator" content="m2html v1.5 &copy; 2003-2005 Guillaume Flandin">
<meta name="robots" content="index, follow">
<link type="text/css" rel="stylesheet" href="../m2html.css">
</head>
<body>
<a name="_top"></a>
<div><a href="../index.html">Home</a> &gt; <a href="index.html">fvcom_prepro</a> &gt; get_AMM.m</div>
<!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png">&nbsp;Master index</a></td>
<td align="right"><a href="index.html">Index for fvcom_prepro&nbsp;<img alt=">" border="0" src="../right.png"></a></td></tr></table>-->
<h1>get_AMM
</h1>
<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>Extract boundary forcing information from NOC Operational Tide Surge</strong></div>
<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>function [Mobj] = get_AMM(Mobj,StartDate,EndDate,ModelFolder) </strong></div>
<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre class="comment"> Extract boundary forcing information from NOC Operational Tide Surge
Model output output
function get_AMM(Mobj,StartDate,EndDate,ModelFolder)
DESCRIPTION:
Extract boundary forcing information from NOC Operational Tide Surge
Model output and interpolate to FVCOM open boundary nodes.
INPUT
Mobj = Matlab mesh object
StartDate = Start date and time for FVCOM run
EndDate = End date and time for FVCOM run
ModelFolder = Location of AMM/S12 hourly outputs
OUTPUT:
Mobj.surfaceElevation = Addition to Matlab mesh object
EXAMPLE USAGE
function get_AMM(Mobj,StartDate,EndDate,ModelFolder)
Author(s):
Karen Thurston (National Oceanography Centre Liverpool)
Revision history
2012-12-04 First version.
==============================================================================</pre></div>
<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../matlabicon.gif)">
</ul>
This function is called by:
<ul style="list-style-image:url(../matlabicon.gif)">
</ul>
<!-- crossreference -->
<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function [Mobj] = get_AMM(Mobj,StartDate,EndDate,ModelFolder)</a>
0002
0003 <span class="comment">% Extract boundary forcing information from NOC Operational Tide Surge</span>
0004 <span class="comment">% Model output output</span>
0005 <span class="comment">%</span>
0006 <span class="comment">% function get_AMM(Mobj,StartDate,EndDate,ModelFolder)</span>
0007 <span class="comment">%</span>
0008 <span class="comment">% DESCRIPTION:</span>
0009 <span class="comment">% Extract boundary forcing information from NOC Operational Tide Surge</span>
0010 <span class="comment">% Model output and interpolate to FVCOM open boundary nodes.</span>
0011 <span class="comment">%</span>
0012 <span class="comment">% INPUT</span>
0013 <span class="comment">% Mobj = Matlab mesh object</span>
0014 <span class="comment">% StartDate = Start date and time for FVCOM run</span>
0015 <span class="comment">% EndDate = End date and time for FVCOM run</span>
0016 <span class="comment">% ModelFolder = Location of AMM/S12 hourly outputs</span>
0017 <span class="comment">%</span>
0018 <span class="comment">% OUTPUT:</span>
0019 <span class="comment">% Mobj.surfaceElevation = Addition to Matlab mesh object</span>
0020 <span class="comment">%</span>
0021 <span class="comment">% EXAMPLE USAGE</span>
0022 <span class="comment">% function get_AMM(Mobj,StartDate,EndDate,ModelFolder)</span>
0023 <span class="comment">%</span>
0024 <span class="comment">% Author(s):</span>
0025 <span class="comment">% Karen Thurston (National Oceanography Centre Liverpool)</span>
0026 <span class="comment">%</span>
0027 <span class="comment">% Revision history</span>
0028 <span class="comment">% 2012-12-04 First version.</span>
0029 <span class="comment">%</span>
0030 <span class="comment">%==============================================================================</span>
0031 subname = <span class="string">'get_AMM'</span>;
0032 <span class="keyword">global</span> ftbverbose;
0033 <span class="keyword">if</span>(ftbverbose);
0034 fprintf(<span class="string">'\n'</span>)
0035 fprintf([<span class="string">'begin : '</span> subname <span class="string">'\n'</span>])
0036 <span class="keyword">end</span>;
0037
0038 <span class="comment">%% Put the open boundary nodes into a single array for convenience</span>
0039 count = 0;
0040 ObcNodes = nan(1,sum(Mobj.nObcNodes));
0041 <span class="keyword">for</span> ob=1:Mobj.nObs
0042 nObcs = Mobj.nObcNodes(ob);
0043 <span class="keyword">for</span> j=1:nObcs
0044 count = count + 1;
0045 ObcNodes(count) = Mobj.obc_nodes(ob,j); <span class="comment">% set the open boundary nodes</span>
0046 <span class="keyword">end</span>
0047 <span class="keyword">end</span>
0048
0049 <span class="comment">% Create an array of hourly timesteps</span>
0050 timesteps = datevec(datenum(StartDate):1/24:datenum(EndDate));
0051
0052 <span class="comment">% Initialise an array for the sea surface elevation</span>
0053 SurfaceElevation = nan(count,size(timesteps,1));
0054
0055 <span class="comment">% For each timestep, find the appropriate AMM/S12 file and extract the</span>
0056 <span class="comment">% surface elevation</span>
0057 <span class="keyword">for</span> i=1:size(timesteps,1)
0058 <span class="comment">% Create AMM/S12 output filename from date</span>
0059 <span class="comment">% First, accommodate Operational Model idiosyncracy about output times</span>
0060 <span class="keyword">if</span> timesteps(i,3)==1 &amp;&amp; sum(timesteps(i,4:6)) == 0
0061 tempdate = datevec(addtodate(datenum(timesteps(i,:)),-1,<span class="string">'month'</span>));
0062 AMMfile=[ModelFolder,num2str(tempdate(1)),<span class="string">'-'</span>,num2str(tempdate(2),<span class="string">'%02i'</span>),<span class="string">'.nc'</span>];
0063 <span class="keyword">else</span>
0064 AMMfile=[ModelFolder,num2str(timesteps(i,1)),<span class="string">'-'</span>,num2str(timesteps(i,2),<span class="string">'%02i'</span>),<span class="string">'.nc'</span>];
0065 <span class="keyword">end</span>
0066
0067 <span class="comment">% Convert FVCOM timestep into AMM/S12 output (seconds since</span>
0068 <span class="comment">% 20071101:000000)</span>
0069 AMM_time = etime(timesteps(i,:),[2007,11,01,0,0,0]);
0070
0071 <span class="comment">% Load the timeseries from the AMM/S12 output file</span>
0072 AMM_timeseries = ncread(AMMfile,<span class="string">'time'</span>);
0073
0074 <span class="comment">% Locate the appropriate timestep number</span>
0075 AMM_timestep = find(AMM_timeseries==AMM_time);
0076
0077 <span class="comment">% Load the sea surface elevation ouptut, lat and lon</span>
0078 AMM_elev = ncread(AMMfile,<span class="string">'zet'</span>,[1 1 AMM_timestep],[Inf Inf 1])';
0079 AMM_lat = ncread(AMMfile,<span class="string">'lat'</span>);
0080 AMM_lon = ncread(AMMfile,<span class="string">'lon'</span>);
0081
0082 <span class="comment">% Interpolate the sea surface elevation output to the open boundary</span>
0083 <span class="comment">% nodes</span>
0084 [X,Y]=meshgrid(AMM_lon,AMM_lat);
0085 SurfaceElevation(:,i) = interp2(X,Y,AMM_elev,Mobj.lon(ObcNodes),<span class="keyword">...</span>
0086 Mobj.lat(ObcNodes));
0087 <span class="keyword">end</span>
0088
0089 Mobj.surfaceElevation = SurfaceElevation;
0090
0091 <span class="keyword">if</span>(ftbverbose);
0092 fprintf([<span class="string">'end : '</span> subname <span class="string">'\n'</span>]);
0093 <span class="keyword">end</span></pre></div>
<hr><address>Generated on Mon 04-Feb-2013 14:22:28 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" title="Matlab Documentation in HTML">m2html</a></strong> &copy; 2005</address>
</body>
</html>
\ No newline at end of file
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<title>Description of get_HYCOM_forcing</title>
<meta name="keywords" content="get_HYCOM_forcing">
<meta name="description" content="Get mean flow, temperature and salinity data from HYCOM model outputs">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="generator" content="m2html v1.5 &copy; 2003-2005 Guillaume Flandin">
<meta name="robots" content="index, follow">
<link type="text/css" rel="stylesheet" href="../m2html.css">
</head>
<body>
<a name="_top"></a>
<div><a href="../index.html">Home</a> &gt; <a href="index.html">fvcom_prepro</a> &gt; get_HYCOM_forcing.m</div>
<!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png">&nbsp;Master index</a></td>
<td align="right"><a href="index.html">Index for fvcom_prepro&nbsp;<img alt=">" border="0" src="../right.png"></a></td></tr></table>-->
<h1>get_HYCOM_forcing
</h1>
<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>Get mean flow, temperature and salinity data from HYCOM model outputs</strong></div>
<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>function data = get_HYCOM_forcing(Mobj, modelTime) </strong></div>
<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre class="comment"> Get mean flow, temperature and salinity data from HYCOM model outputs
through their OPeNDAP server.
data = get_HYCOM_forcing(Mobj, modelTime)
DESCRIPTION:
Using OPeNDAP, extract the necessary parameters to create an FVCOM
forcing file. Requires the OPeNDAP toolbox (see below for where to get
it).
INPUT:
Mobj - MATLAB mesh object
modelTime - Modified Julian Date start and end times
OUTPUT:
data - struct of the data necessary to force FVCOM. These can be
interpolated onto an unstructured grid in Mobj using
grid2fvcom.m.
The parameters which are obtained from the HYCOM data are:
- temperature
- salinity
- u flow component
- v flow component
- sea surface height (ssh)
REQUIRES:
The OPeNDAP toolbox:
http://www.opendap.org/pub/contributed/source/ml-toolbox/
Author(s)
Pierre Cazenave (Plymouth Marine Laboratory)
Revision history:
2013-01-31 First version.
==========================================================================</pre></div>
<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../matlabicon.gif)">
</ul>
This function is called by:
<ul style="list-style-image:url(../matlabicon.gif)">
</ul>
<!-- crossreference -->
<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function data = get_HYCOM_forcing(Mobj, modelTime)</a>
0002 <span class="comment">% Get mean flow, temperature and salinity data from HYCOM model outputs</span>
0003 <span class="comment">% through their OPeNDAP server.</span>
0004 <span class="comment">%</span>
0005 <span class="comment">% data = get_HYCOM_forcing(Mobj, modelTime)</span>
0006 <span class="comment">%</span>
0007 <span class="comment">% DESCRIPTION:</span>
0008 <span class="comment">% Using OPeNDAP, extract the necessary parameters to create an FVCOM</span>
0009 <span class="comment">% forcing file. Requires the OPeNDAP toolbox (see below for where to get</span>
0010 <span class="comment">% it).</span>
0011 <span class="comment">%</span>
0012 <span class="comment">% INPUT:</span>
0013 <span class="comment">% Mobj - MATLAB mesh object</span>
0014 <span class="comment">% modelTime - Modified Julian Date start and end times</span>
0015 <span class="comment">%</span>
0016 <span class="comment">% OUTPUT:</span>
0017 <span class="comment">% data - struct of the data necessary to force FVCOM. These can be</span>
0018 <span class="comment">% interpolated onto an unstructured grid in Mobj using</span>
0019 <span class="comment">% grid2fvcom.m.</span>
0020 <span class="comment">%</span>
0021 <span class="comment">% The parameters which are obtained from the HYCOM data are:</span>
0022 <span class="comment">% - temperature</span>
0023 <span class="comment">% - salinity</span>
0024 <span class="comment">% - u flow component</span>
0025 <span class="comment">% - v flow component</span>
0026 <span class="comment">% - sea surface height (ssh)</span>
0027 <span class="comment">%</span>
0028 <span class="comment">% REQUIRES:</span>
0029 <span class="comment">% The OPeNDAP toolbox:</span>
0030 <span class="comment">% http://www.opendap.org/pub/contributed/source/ml-toolbox/</span>
0031 <span class="comment">%</span>
0032 <span class="comment">% Author(s)</span>
0033 <span class="comment">% Pierre Cazenave (Plymouth Marine Laboratory)</span>
00