Commit eb37fbcc authored by Pierre Cazenave's avatar Pierre Cazenave

Update the documentation for the latest release.

parent bd1b624c
......@@ -59,6 +59,6 @@ This function is called by:
0007 <span class="comment">% Revision history</span>
0008 <span class="comment">%</span>
0009 <span class="comment">%==============================================================================</span></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>
<hr><address>Generated on Tue 29-Jul-2014 15:11:16 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
......@@ -184,6 +184,6 @@ This function is called by:
0120 <span class="comment">% vector plots requires correct lat and lon for u and v positions: FVCOM.xc</span>
0121 <span class="comment">% and FVCOM.yc. Remember to extract them</span>
0122 PLotoutV=do_vector_plot(plotOPTS,FVCOM)</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>
<hr><address>Generated on Tue 29-Jul-2014 15:11:16 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
......@@ -19,11 +19,11 @@
<center>
<img src="graph.png" usemap="#mainmap" alt="Dependency Graph for fvcom_postproc" border="2" style="color:#000;">
<map name="mainmap">
<area shape="poly" id="node1" href="README.html" title="README" alt="" coords="144,31 141,23 131,16 116,10 96,6 75,5 53,6 34,10 18,16 8,23 5,31 8,39 18,46 34,51 53,55 75,56 96,55 116,51 131,46 141,39">
<area shape="poly" id="node2" href="example_surface_plot.html" title="example_surface_plot" alt="" coords="426,31 420,23 402,16 373,10 337,6 297,5 257,6 221,10 193,16 174,23 168,31 174,39 193,46 221,51 257,55 297,56 337,55 373,51 402,46 420,39">
<area shape="poly" id="node1" href="README.html" title="README" alt="" coords="133,29,130,22,121,15,107,10,89,7,69,5,50,7,32,10,17,15,8,22,5,29,8,37,17,43,32,49,50,52,69,53,89,52,107,49,121,43,130,37">
<area shape="poly" id="node2" href="example_surface_plot.html" title="example_surface_plot" alt="" coords="395,29,389,22,372,15,346,10,313,7,276,5,239,7,206,10,180,15,163,22,157,29,163,37,180,43,206,49,239,52,276,53,313,52,346,49,372,43,389,37">
</map>
</center>
<hr><address>Generated on Tue 04-Jun-2013 12:12:56 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 Tue 29-Jul-2014 15:11:01 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
<area shape="poly" id="node1" href="README.html" title="README" alt="" coords="144,31 141,23 131,16 116,10 96,6 75,5 53,6 34,10 18,16 8,23 5,31 8,39 18,46 34,51 53,55 75,56 96,55 116,51 131,46 141,39">
<area shape="poly" id="node2" href="example_surface_plot.html" title="example_surface_plot" alt="" coords="426,31 420,23 402,16 373,10 337,6 297,5 257,6 221,10 193,16 174,23 168,31 174,39 193,46 221,51 257,55 297,56 337,55 373,51 402,46 420,39">
<area shape="poly" id="node1" href="README.html" title="README" alt="" coords="133,29,130,22,121,15,107,10,89,7,69,5,50,7,32,10,17,15,8,22,5,29,8,37,17,43,32,49,50,52,69,53,89,52,107,49,121,43,130,37">
<area shape="poly" id="node2" href="example_surface_plot.html" title="example_surface_plot" alt="" coords="395,29,389,22,372,15,346,10,313,7,276,5,239,7,206,10,180,15,163,22,157,29,163,37,180,43,206,49,239,52,276,53,313,52,346,49,372,43,389,37">
doc/fvcom_postproc/graph.png

8.32 KB | W: | H:

doc/fvcom_postproc/graph.png

8.02 KB | W: | H:

doc/fvcom_postproc/graph.png
doc/fvcom_postproc/graph.png
doc/fvcom_postproc/graph.png
doc/fvcom_postproc/graph.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -29,6 +29,6 @@
<ul style="list-style-image:url(../simulinkicon.gif)">
<li>View the <a href="graph.html">Graph</a>.</li>
</ul>
<hr><address>Generated on Tue 04-Jun-2013 12:12:54 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 Tue 29-Jul-2014 15:10:59 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
......@@ -73,6 +73,6 @@ This function is called by:
0014 <span class="comment">% Revision history</span>
0015 <span class="comment">%</span>
0016 <span class="comment">%==============================================================================</span></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>
<hr><address>Generated on Tue 29-Jul-2014 15:11:16 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
......@@ -62,7 +62,7 @@ This function calls:
</ul>
This function is called by:
<ul style="list-style-image:url(../matlabicon.gif)">
<li><a href="example.html" class="code" title="">example</a> example demonstrating reading in a 2DM file and constructing a model</li></ul>
<li><a href="example.html" class="code" title="">example</a> example demonstrating reading in a 2DM file and constructing a model</li><li><a href="read_grid_mesh.html" class="code" title="function [Mobj] = read_grid_mesh(varargin)">read_grid_mesh</a> Read .grid mesh files into Matlab mesh object</li></ul>
<!-- crossreference -->
......@@ -144,6 +144,6 @@ This function is called by:
0074
0075
0076</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>
<hr><address>Generated on Tue 29-Jul-2014 15:11:16 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
......@@ -160,6 +160,6 @@ This function is called by:
0088 fprintf([<span class="string">'end : '</span> subname <span class="string">'\n'</span>])
0089 <span class="keyword">end</span>;
0090</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>
<hr><address>Generated on Tue 29-Jul-2014 15:11:16 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,13 @@
Author(s):
Geoff Cowles (University of Massachusetts Dartmouth)
Pierre Cazenave (Plymouth Marine Laboratory)
Karen Amoudry (National Oceanography Centre, Liverpool)
Revision history:
2012-11-26 Add ability to turn off the figures.
2013-01-02 KJA bug fix: amended usage of 'unique' in line 53 to
prevent it from sorting the values it returns. Amended by Pierre to
support pre-2012 versions of MATLAB whilst giving the same result.
==========================================================================</pre></div>
......@@ -97,69 +100,75 @@ 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>
0027 <span class="comment">% Karen Amoudry (National Oceanography Centre, Liverpool)</span>
0028 <span class="comment">%</span>
0029 <span class="comment">% Revision history:</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_obc_nodes'</span>;
0034 <span class="keyword">global</span> ftbverbose
0035 <span class="keyword">if</span>(ftbverbose)
0036 fprintf(<span class="string">'\n'</span>)
0037 fprintf([<span class="string">'begin : '</span> subname <span class="string">'\n'</span>])
0038 <span class="keyword">end</span>
0039
0040 <span class="comment">% Do we want a figure showing how we're getting along?</span>
0041 <span class="keyword">if</span> nargin == 4
0042 plotFig = 0;
0043 <span class="keyword">end</span>
0044
0045 <span class="comment">%--------------------------------------------------------------------------</span>
0046 <span class="comment">% Get a unique list and make sure they are in the range of node numbers</span>
0047 <span class="comment">%--------------------------------------------------------------------------</span>
0048 Nlist = unique(Nlist);
0049
0050 <span class="keyword">if</span>(max(Nlist) &gt; Mobj.nVerts);
0051 fprintf(<span class="string">'your open boundary node number exceed the total number of nodes in the domain\n'</span>);
0052 error(<span class="string">'stopping...\n'</span>)
0053 <span class="keyword">end</span>
0054
0055 <span class="comment">%--------------------------------------------------------------------------</span>
0056 <span class="comment">% Plot the mesh</span>
0057 <span class="comment">%--------------------------------------------------------------------------</span>
0058 <span class="keyword">if</span> plotFig == 1
0059 <span class="keyword">if</span> strcmpi(Mobj.nativeCoords(1:3), <span class="string">'car'</span>)
0060 x = Mobj.x;
0061 y = Mobj.y;
0062 <span class="keyword">else</span>
0063 x = Mobj.lon;
0064 y = Mobj.lat;
0065 <span class="keyword">end</span>
0066
0067 figure
0068 patch(<span class="string">'Vertices'</span>,[x,y],<span class="string">'Faces'</span>,Mobj.tri,<span class="keyword">...</span>
0069 <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>);
0070 hold on;
0071 whos Nlist
0072 plot(x(Nlist),y(Nlist),<span class="string">'ro'</span>);
0073 axis(<span class="string">'equal'</span>,<span class="string">'tight'</span>)
0074 title(<span class="string">'open boundary nodes'</span>);
0075 <span class="keyword">end</span>
0076
0077 <span class="comment">% add to mesh object</span>
0078 npts = numel(Nlist);
0079 Mobj.nObs = Mobj.nObs + 1;
0080 Mobj.nObcNodes(Mobj.nObs) = npts;
0081 Mobj.obc_nodes(Mobj.nObs,1:npts) = Nlist;
0082 Mobj.obc_name{Mobj.nObs} = ObcName;
0083 Mobj.obc_type(Mobj.nObs) = ObcType;
0084
0085
0086 <span class="keyword">if</span>(ftbverbose)
0087 fprintf([<span class="string">'end : '</span> subname <span class="string">'\n'</span>])
0088 <span class="keyword">end</span>
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>
0031 <span class="comment">% 2013-01-02 KJA bug fix: amended usage of 'unique' in line 53 to</span>
0032 <span class="comment">% prevent it from sorting the values it returns. Amended by Pierre to</span>
0033 <span class="comment">% support pre-2012 versions of MATLAB whilst giving the same result.</span>
0034 <span class="comment">%</span>
0035 <span class="comment">%==========================================================================</span>
0036 subname = <span class="string">'add_obc_nodes'</span>;
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 == 4
0045 plotFig = 0;
0046 <span class="keyword">end</span>
0047
0048 <span class="comment">%--------------------------------------------------------------------------</span>
0049 <span class="comment">% Get a unique list and make sure they are in the range of node numbers</span>
0050 <span class="comment">%--------------------------------------------------------------------------</span>
0051 <span class="comment">% Make this works in versions of MATLAB older than 2012a (newer versions</span>
0052 <span class="comment">% can just use unique(A, 'stable'), but checking versions is a pain).</span>
0053 [~, Nidx] = unique(Nlist);
0054 Nlist = Nlist(sort(Nidx));
0055
0056 <span class="keyword">if</span> max(Nlist) &gt; Mobj.nVerts
0057 fprintf(<span class="string">'your open boundary node number exceed the total number of nodes in the domain\n'</span>);
0058 error(<span class="string">'stopping...'</span>)
0059 <span class="keyword">end</span>
0060
0061 <span class="comment">%--------------------------------------------------------------------------</span>
0062 <span class="comment">% Plot the mesh</span>
0063 <span class="comment">%--------------------------------------------------------------------------</span>
0064 <span class="keyword">if</span> plotFig == 1
0065 <span class="keyword">if</span> strcmpi(Mobj.nativeCoords(1:3), <span class="string">'car'</span>)
0066 x = Mobj.x;
0067 y = Mobj.y;
0068 <span class="keyword">else</span>
0069 x = Mobj.lon;
0070 y = Mobj.lat;
0071 <span class="keyword">end</span>
0072
0073 figure
0074 patch(<span class="string">'Vertices'</span>,[x,y],<span class="string">'Faces'</span>,Mobj.tri,<span class="keyword">...</span>
0075 <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>);
0076 hold on;
0077 whos Nlist
0078 plot(x(Nlist),y(Nlist),<span class="string">'ro'</span>);
0079 axis(<span class="string">'equal'</span>,<span class="string">'tight'</span>)
0080 title(<span class="string">'open boundary nodes'</span>);
0081 <span class="keyword">end</span>
0082
0083 <span class="comment">% add to mesh object</span>
0084 npts = numel(Nlist);
0085 Mobj.nObs = Mobj.nObs + 1;
0086 Mobj.nObcNodes(Mobj.nObs) = npts;
0087 Mobj.obc_nodes(Mobj.nObs,1:npts) = Nlist;
0088 Mobj.obc_name{Mobj.nObs} = ObcName;
0089 Mobj.obc_type(Mobj.nObs) = ObcType;
0090
0091
0092 <span class="keyword">if</span>(ftbverbose)
0093 fprintf([<span class="string">'end : '</span> subname <span class="string">'\n'</span>])
0094 <span class="keyword">end</span>
0095</pre></div>
<hr><address>Generated on Tue 29-Jul-2014 15:11:16 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
......@@ -46,12 +46,14 @@
Author(s):
Geoff Cowles (University of Massachusetts Dartmouth)
Pierre Cazenave (Plymouth Marine Laboratory)
Note:
Uses ginput2 which allows zooming before selecting points and displays
clicked points realtime
Revision history
2014-05-20 Set boolean flag to true to indicate rivers.
==============================================================================</pre></div>
......@@ -89,78 +91,81 @@ This function is called by:
0019 <span class="comment">%</span>
0020 <span class="comment">% Author(s):</span>
0021 <span class="comment">% Geoff Cowles (University of Massachusetts Dartmouth)</span>
0022 <span class="comment">%</span>
0023 <span class="comment">% Note:</span>
0024 <span class="comment">% Uses ginput2 which allows zooming before selecting points and displays</span>
0025 <span class="comment">% clicked points realtime</span>
0026 <span class="comment">%</span>
0027 <span class="comment">% Revision history</span>
0028 <span class="comment">%</span>
0029 <span class="comment">%==============================================================================</span>
0030 subname = <span class="string">'add_river_nodes'</span>;
0031 <span class="keyword">global</span> ftbverbose
0032 <span class="keyword">if</span>(ftbverbose)
0033 fprintf(<span class="string">'\n'</span>)
0034 fprintf([<span class="string">'begin : '</span> subname <span class="string">'\n'</span>])
0035 <span class="keyword">end</span>;
0036
0037
0038 <span class="comment">%------------------------------------------------------------------------------</span>
0039 <span class="comment">% Plot the mesh</span>
0022 <span class="comment">% Pierre Cazenave (Plymouth Marine Laboratory)</span>
0023 <span class="comment">%</span>
0024 <span class="comment">% Note:</span>
0025 <span class="comment">% Uses ginput2 which allows zooming before selecting points and displays</span>
0026 <span class="comment">% clicked points realtime</span>
0027 <span class="comment">%</span>
0028 <span class="comment">% Revision history</span>
0029 <span class="comment">% 2014-05-20 Set boolean flag to true to indicate rivers.</span>
0030 <span class="comment">%</span>
0031 <span class="comment">%==============================================================================</span>
0032 subname = <span class="string">'add_river_nodes'</span>;
0033 <span class="keyword">global</span> ftbverbose
0034 <span class="keyword">if</span>(ftbverbose)
0035 fprintf(<span class="string">'\n'</span>)
0036 fprintf([<span class="string">'begin : '</span> subname <span class="string">'\n'</span>])
0037 <span class="keyword">end</span>;
0038
0039
0040 <span class="comment">%------------------------------------------------------------------------------</span>
0041
0042 <span class="keyword">if</span>(lower(Mobj.nativeCoords(1:3)) == <span class="string">'car'</span>)
0043 x = Mobj.x;
0044 y = Mobj.y;
0045 <span class="keyword">else</span>
0046 x = Mobj.lon;
0047 y = Mobj.lat;
0048 <span class="keyword">end</span>;
0049
0050 figure
0051 patch(<span class="string">'Vertices'</span>,[x,y],<span class="string">'Faces'</span>,Mobj.tri,<span class="keyword">...</span>
0052 <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>);
0053 hold on;
0054
0055 <span class="comment">% use ginput2 (which allows zooming and plots points as they are clicked) to let</span>
0056 <span class="comment">% user select the boundary points</span>
0057 fprintf(<span class="string">'click the river nodes in the model\n'</span>)
0058 fprintf(<span class="string">'left click: zoom\n'</span>);
0059 fprintf(<span class="string">'delete: delete last point\n'</span>);
0060 fprintf(<span class="string">'drag mouse: pan\n'</span>);
0061 fprintf(<span class="string">'right click: select point\n'</span>);
0062 fprintf(<span class="string">'enter (return): finished selecting points\n'</span>);
0063 [xselect] = ginput2(true,<span class="string">'r+'</span>);
0064
0065
0066 [npts,jnk] = size(xselect);
0041 <span class="comment">% Plot the mesh</span>
0042 <span class="comment">%------------------------------------------------------------------------------</span>
0043
0044 <span class="keyword">if</span>(lower(Mobj.nativeCoords(1:3)) == <span class="string">'car'</span>)
0045 x = Mobj.x;
0046 y = Mobj.y;
0047 <span class="keyword">else</span>
0048 x = Mobj.lon;
0049 y = Mobj.lat;
0050 <span class="keyword">end</span>;
0051
0052 figure
0053 patch(<span class="string">'Vertices'</span>,[x,y],<span class="string">'Faces'</span>,Mobj.tri,<span class="keyword">...</span>
0054 <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>);
0055 hold on;
0056
0057 <span class="comment">% use ginput2 (which allows zooming and plots points as they are clicked) to let</span>
0058 <span class="comment">% user select the boundary points</span>
0059 fprintf(<span class="string">'click the river nodes in the model\n'</span>)
0060 fprintf(<span class="string">'left click: zoom\n'</span>);
0061 fprintf(<span class="string">'delete: delete last point\n'</span>);
0062 fprintf(<span class="string">'drag mouse: pan\n'</span>);
0063 fprintf(<span class="string">'right click: select point\n'</span>);
0064 fprintf(<span class="string">'enter (return): finished selecting points\n'</span>);
0065 [xselect] = ginput2(true,<span class="string">'r+'</span>);
0066
0067
0068 <span class="keyword">if</span>(npts == 0)
0069 fprintf(<span class="string">'you didn''t select any points'</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 fprintf(<span class="string">'you selected %d points\n'</span>,npts)
0074
0075 <span class="comment">% snap to the closest vertices</span>
0076 <span class="keyword">for</span> i=1:npts
0077 [ipt(i),dist] = <a href="find_nearest_pt.html" class="code" title="function [Point,Distance] = find_nearest_pt(xloc,yloc,Mobj)">find_nearest_pt</a>(xselect(i,1),xselect(i,2),Mobj);
0078 <span class="keyword">end</span>;
0079
0080 <span class="comment">% replot domain with snapped vertices</span>
0081 plot(x(ipt),y(ipt),<span class="string">'ro'</span>);
0082
0083 <span class="comment">% add to mesh object</span>
0084 Mobj.nRivers = Mobj.nRivers + 1;
0085 Mobj.nRivNodes(Mobj.nRivers) = npts;
0086 Mobj.riv_nodes(Mobj.nRivers,1:npts) = ipt;
0087 Mobj.riv_name{Mobj.nRivers} = RiverName;
0088
0089
0090 <span class="keyword">if</span>(ftbverbose)
0091 fprintf([<span class="string">'end : '</span> subname <span class="string">'\n'</span>])
0092 <span class="keyword">end</span>;
0093</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>
0068 [npts,jnk] = size(xselect);
0069
0070 <span class="keyword">if</span>(npts == 0)
0071 fprintf(<span class="string">'you didn''t select any points'</span>)
0072 fprintf([<span class="string">'end : '</span> subname <span class="string">'\n'</span>])
0073 <span class="keyword">return</span>
0074 <span class="keyword">end</span>;
0075 fprintf(<span class="string">'you selected %d points\n'</span>,npts)
0076
0077 <span class="comment">% snap to the closest vertices</span>
0078 <span class="keyword">for</span> i=1:npts
0079 [ipt(i),dist] = <a href="find_nearest_pt.html" class="code" title="function [Point,Distance] = find_nearest_pt(xloc,yloc,Mobj)">find_nearest_pt</a>(xselect(i,1),xselect(i,2),Mobj);
0080 <span class="keyword">end</span>;
0081
0082 <span class="comment">% replot domain with snapped vertices</span>
0083 plot(x(ipt),y(ipt),<span class="string">'ro'</span>);
0084
0085 <span class="comment">% add to mesh object</span>
0086 Mobj.nRivers = Mobj.nRivers + 1;
0087 Mobj.nRivNodes(Mobj.nRivers) = npts;
0088 Mobj.riv_nodes(Mobj.nRivers,1:npts) = ipt;
0089 Mobj.riv_name{Mobj.nRivers} = RiverName;
0090
0091 Mobj.have_rivers = true;
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 Tue 29-Jul-2014 15:11:16 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
This diff is collapsed.
......@@ -91,6 +91,6 @@ This function is called by:
0045 nc = close(nc);
0046
0047</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>
<hr><address>Generated on Tue 29-Jul-2014 15:11:16 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
......@@ -157,6 +157,6 @@ This function is called by:
0085
0086 fprintf([<span class="string">'end : '</span> subname <span class="string">'\n'</span>])
0087</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>
<hr><address>Generated on Tue 29-Jul-2014 15:11:16 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
......@@ -169,6 +169,6 @@ This function is called by:
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 Tue 04-Jun-2013 12:12:57 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 Tue 29-Jul-2014 15:11:16 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
......@@ -177,6 +177,6 @@ This function is called by:
0098 fprintf(<span class="string">'No stations found within the model domain.\n'</span>)
0099 <span class="keyword">end</span>
0100 <span class="keyword">end</span></pre></div>
<hr><address>Generated on Tue 04-Jun-2013 12:12:57 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 Tue 29-Jul-2014 15:11:16 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
......@@ -172,6 +172,6 @@ This function is called by:
0098 fprintf([<span class="string">'end : '</span> subname <span class="string">'\n'</span>])
0099 <span class="keyword">end</span>;
0100</pre></div>
<hr><address>Generated on Tue 04-Jun-2013 12:12:57 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 Tue 29-Jul-2014 15:11:16 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
......@@ -49,7 +49,15 @@
spongeRadius = calc_sponge_radius(Mobj,Nlist)
Author(s)
Karen Thurston (National Oceanography Centre, Liverpool)
Karen Amoudry (National Oceanography Centre, Liverpool)
Pierre Cazenave (Plymouth Marine Laboratory)
Revision history:
2013-01-02 KJA bug fix: amended usage of 'unique' to prevent it from
sorting the values it returns. Amended by Pierre to support pre-2012
versions of MATLAB whilst giving the same result.
2013-07-16 KJA: adapted function to remove dependency on the Matlab
Mapping Toolbox.
==========================================================================</pre></div>
......@@ -90,51 +98,78 @@ This function is called by:
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>
0025 <span class="comment">% Karen Amoudry (National Oceanography Centre, Liverpool)</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">% 2013-01-02 KJA bug fix: amended usage of 'unique' to prevent it from</span>
0030 <span class="comment">% sorting the values it returns. Amended by Pierre to support pre-2012</span>
0031 <span class="comment">% versions of MATLAB whilst giving the same result.</span>
0032 <span class="comment">% 2013-07-16 KJA: adapted function to remove dependency on the Matlab</span>
0033 <span class="comment">% Mapping Toolbox.</span>
0034 <span class="comment">%</span>
0035 <span class="comment">%==========================================================================</span>
0036 subname = <span class="string">'calc_sponge_radius'</span>;
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">%--------------------------------------------------------------------------</span>
0044 <span class="comment">% Get a unique list and make sure they are in the range of node numbers</span>
0045 <span class="comment">%--------------------------------------------------------------------------</span>
0046 <span class="comment">% Make this work in versions of MATLAB older than 2012a (newer versions</span>
0047 <span class="comment">% can just use unique(A, 'stable'), but checking versions is a pain).</span>
0048 [~, Nidx] = unique(Nlist);
0049 Nlist = Nlist(sort(Nidx));
0050
0051 spongeRadius = 100000+zeros(size(Nlist));
0052
0053 <span class="comment">% For each node on the open boundary</span>
0054 <span class="keyword">for</span> i =1:length(Nlist)
0055 <span class="comment">% Find the neighbouring nodes</span>
0056 [r,c]=find(Mobj.tri==Nlist(i));
0057 neighbours = Mobj.tri(r,:);
0058 [~,neighidx] = unique(Mobj.tri(r,:));
0059 neighbours = neighbours(sort(neighidx));
0060
0061 <span class="comment">% Remove the node of interest from the neighbours list</span>
0062 n = find(neighbours~=Nlist(i));
0063 neighbours = neighbours(n);
0064
0065 <span class="comment">% Calculate the arc length (in degrees) between the node and its</span>
0066 <span class="comment">% neighbours</span>
0067 <span class="comment">% arclen = distance(Mobj.lat(Nlist(i)),Mobj.lon(Nlist(i)),...</span>
0068 <span class="comment">% Mobj.lat(neighbours),Mobj.lon(neighbours));</span>
0069 <span class="comment">% % Convert from degrees to whole metres</span>
0070 <span class="comment">% arclen = ceil(1000*deg2km(arclen));</span>
0071
0072
0073 <span class="comment">% Adapted to avoid using Mapping toolbox</span>
0074 <span class="comment">% Step 1: convert lat/lon to radians</span>
0075 lat1 = Mobj.lat(Nlist(i)) .* pi./180;
0076 lon1 = Mobj.lon(Nlist(i)) .* pi./180;
0077 lat2 = Mobj.lat(neighbours) .* pi./180;
0078 lon2 = Mobj.lon(neighbours) .* pi./180;
0079 <span class="comment">% Step 2: calculate distance in radians</span>
0080 a = sin((lat2-lat1)/2).^2 + cos(lat1) .* cos(lat2) .*<span class="keyword">...</span>
0081 sin((lon2-lon1)/2).^2;
0082 arclen = 2 * atan2(sqrt(a),sqrt(1 - a));
0083
0084 <span class="comment">% Calculate distance in whole metres</span>
0085 arclen = ceil(1000 .* 6371 .* arclen);
0086
0087 <span class="comment">% If the smallest distance is less than 100km, keep it</span>
0088 <span class="keyword">if</span> min(arclen)&lt;spongeRadius(i)
0089 spongeRadius(i)=min(arclen);
0090 <span class="keyword">end</span>
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>