write_FVCOM_cor.html 6.83 KB
Newer Older
Geoffrey Cowles's avatar
Geoffrey Cowles committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of write_FVCOM_cor</title>
  <meta name="keywords" content="write_FVCOM_cor">
  <meta name="description" content="Write coriolis to FVCOM format coriolis file">
  <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; write_FVCOM_cor.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>write_FVCOM_cor
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>Write coriolis to FVCOM format coriolis file</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 write_FVCOM_cor(Mobj,filename) </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"> Write coriolis to FVCOM format coriolis file

 function write_FVCOM_cor(Mobj,filename)

 DESCRIPTION:
    Generate an ascii FVCOM 3.x format coriolis from Mesh object

 INPUT 
   Mobj     = Mesh object
   filename = FVCOM coriolis file name

 OUTPUT:
    FVCOM coriolis file: filename

 EXAMPLE USAGE
45
    write_FVCOM_cor(Mobj, 'tst_cor.dat')   
Geoffrey Cowles's avatar
Geoffrey Cowles committed
46 47 48

 Author(s):  
    Geoff Cowles (University of Massachusetts Dartmouth)
49 50
    Rory O'Hara Murray (Marine Scotland Science)
    Pierre Cazenave (Plymouth Marine Laboratory)
Geoffrey Cowles's avatar
Geoffrey Cowles committed
51 52

 Revision history
53 54
    2014-10-07 Removed loops to speed up writing the file
    2016-08-08 Remove tabs and clean up syntax.
Geoffrey Cowles's avatar
Geoffrey Cowles committed
55 56 57 58 59 60 61 62 63 64
   
==============================================================================</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)">
Pierre Cazenave's avatar
Pierre Cazenave committed
65
</ul>
Geoffrey Cowles's avatar
Geoffrey Cowles committed
66 67 68 69 70 71
<!-- 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 write_FVCOM_cor(Mobj,filename) </a>
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
0002 <span class="comment">% Write coriolis to FVCOM format coriolis file</span>
0003 <span class="comment">%</span>
0004 <span class="comment">% function write_FVCOM_cor(Mobj,filename)</span>
0005 <span class="comment">%</span>
0006 <span class="comment">% DESCRIPTION:</span>
0007 <span class="comment">%    Generate an ascii FVCOM 3.x format coriolis from Mesh object</span>
0008 <span class="comment">%</span>
0009 <span class="comment">% INPUT</span>
0010 <span class="comment">%   Mobj     = Mesh object</span>
0011 <span class="comment">%   filename = FVCOM coriolis file name</span>
0012 <span class="comment">%</span>
0013 <span class="comment">% OUTPUT:</span>
0014 <span class="comment">%    FVCOM coriolis file: filename</span>
0015 <span class="comment">%</span>
0016 <span class="comment">% EXAMPLE USAGE</span>
0017 <span class="comment">%    write_FVCOM_cor(Mobj, 'tst_cor.dat')</span>
0018 <span class="comment">%</span>
0019 <span class="comment">% Author(s):</span>
0020 <span class="comment">%    Geoff Cowles (University of Massachusetts Dartmouth)</span>
0021 <span class="comment">%    Rory O'Hara Murray (Marine Scotland Science)</span>
0022 <span class="comment">%    Pierre Cazenave (Plymouth Marine Laboratory)</span>
0023 <span class="comment">%</span>
0024 <span class="comment">% Revision history</span>
0025 <span class="comment">%    2014-10-07 Removed loops to speed up writing the file</span>
0026 <span class="comment">%    2016-08-08 Remove tabs and clean up syntax.</span>
0027 <span class="comment">%</span>
0028 <span class="comment">%==============================================================================</span>
0029 
0030 [~, subname] = fileparts(mfilename(<span class="string">'fullpath'</span>));
0031 <span class="keyword">global</span> ftbverbose
0032 <span class="keyword">if</span> ftbverbose
0033     fprintf(<span class="string">'\nbegin : %s\n'</span>, subname);
0034 <span class="keyword">end</span>
0035 
0036 <span class="comment">%------------------------------------------------------------------------------</span>
0037 <span class="comment">% Parse input arguments</span>
0038 <span class="comment">%------------------------------------------------------------------------------</span>
0039 <span class="keyword">if</span> exist(<span class="string">'Mobj'</span>)*exist(<span class="string">'filename'</span>) == 0
0040     error(<span class="string">'arguments to write_FVCOM_cor are incorrect'</span>)
0041 <span class="keyword">end</span>
0042 
0043 <span class="comment">%------------------------------------------------------------------------------</span>
0044 <span class="comment">% Dump the file</span>
0045 <span class="comment">%------------------------------------------------------------------------------</span>
0046 <span class="keyword">if</span> lower(Mobj.nativeCoords(1:3)) == <span class="string">'car'</span>
0047     x = Mobj.x;
0048     y = Mobj.y;
0049 <span class="keyword">else</span>
0050     x = Mobj.lon;
0051     y = Mobj.lat;
0052 <span class="keyword">end</span>
0053 
0054 <span class="keyword">if</span> Mobj.have_cor
0055     <span class="keyword">if</span>(ftbverbose); fprintf(<span class="string">'writing FVCOM coriolis file %s\n'</span>,filename); <span class="keyword">end</span>;
0056     fid = fopen(filename,<span class="string">'w'</span>);
0057     fprintf(fid,<span class="string">'Node Number = %d\n'</span>,Mobj.nVerts);
0058     fprintf(fid, <span class="string">'%f %f %f\n'</span>, [x, y, Mobj.f]');
0059     fclose(fid);
0060 <span class="keyword">else</span>
0061     error(<span class="string">'can''t write coriolis to file, coriolis is not setup, see add_coriolis'</span>)
0062 <span class="keyword">end</span>
0063 
0064 <span class="keyword">if</span> ftbverbose
0065     fprintf(<span class="string">'end   : %s\n'</span>, subname)
0066 <span class="keyword">end</span>
0067 
0068</pre></div>
Pierre Cazenave's avatar
Pierre Cazenave committed
139
<hr><address>Generated on Wed 20-Feb-2019 16:06:01 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" title="Matlab Documentation in HTML">m2html</a></strong> &copy; 2005</address>
Geoffrey Cowles's avatar
Geoffrey Cowles committed
140 141
</body>
</html>