example_FVCOM_wind_ts_speed.html 9.09 KB
Newer Older
Pierre Cazenave's avatar
Pierre Cazenave 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 45 46 47 48 49 50 51 52
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of example_FVCOM_wind_ts_speed</title>
  <meta name="keywords" content="example_FVCOM_wind_ts_speed">
  <meta name="description" content="example file for FVCOM, time-varying/spatially constant wind forcing as speed">
  <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; example_FVCOM_wind_ts_speed.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>example_FVCOM_wind_ts_speed
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>example file for FVCOM, time-varying/spatially constant wind forcing as speed</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 example_FVCOM_wind_ts_speed </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"> example file for FVCOM, time-varying/spatially constant wind forcing as speed

 function example_FVCOM_wind_ts_speed

 DESCRIPTION:
    Write a time-varying, spatially constant wind file
    This is TEMPLATE program to be used as an example
    Do not commit your user-defined programs to the repository
    It requires USER Modification to work 

 INPUT
   
 OUTPUT:
    NetCDF WindFile

 EXAMPLE USAGE
    example_FVCOM_wind_ts_speed

 Author(s):  
    Geoff Cowles (University of Massachusetts Dartmouth)

 Revision history
   
53 54
==============================================================================
warning off</pre></div>
Pierre Cazenave's avatar
Pierre Cazenave committed
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94

<!-- 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 example_FVCOM_wind_ts_speed</a>
0002 
0003 <span class="comment">% example file for FVCOM, time-varying/spatially constant wind forcing as speed</span>
0004 <span class="comment">%</span>
0005 <span class="comment">% function example_FVCOM_wind_ts_speed</span>
0006 <span class="comment">%</span>
0007 <span class="comment">% DESCRIPTION:</span>
0008 <span class="comment">%    Write a time-varying, spatially constant wind file</span>
0009 <span class="comment">%    This is TEMPLATE program to be used as an example</span>
0010 <span class="comment">%    Do not commit your user-defined programs to the repository</span>
0011 <span class="comment">%    It requires USER Modification to work</span>
0012 <span class="comment">%</span>
0013 <span class="comment">% INPUT</span>
0014 <span class="comment">%</span>
0015 <span class="comment">% OUTPUT:</span>
0016 <span class="comment">%    NetCDF WindFile</span>
0017 <span class="comment">%</span>
0018 <span class="comment">% EXAMPLE USAGE</span>
0019 <span class="comment">%    example_FVCOM_wind_ts_speed</span>
0020 <span class="comment">%</span>
0021 <span class="comment">% Author(s):</span>
0022 <span class="comment">%    Geoff Cowles (University of Massachusetts Dartmouth)</span>
0023 <span class="comment">%</span>
0024 <span class="comment">% Revision history</span>
0025 <span class="comment">%</span>
0026 <span class="comment">%==============================================================================</span>
95
0027 <span class="comment">%warning off</span>
Pierre Cazenave's avatar
Pierre Cazenave committed
96 97 98 99 100 101 102 103 104 105 106 107 108 109
0028 subname = <span class="string">'example_FVCOM_wind_ts'</span>;
0029 fprintf(<span class="string">'\n'</span>)
0030 fprintf([<span class="string">'begin : '</span> subname <span class="string">'\n'</span>])
0031 
0032 <span class="comment">%------------------------------------------------------------------------------</span>
0033 <span class="comment">% create a dataset</span>
0034 <span class="comment">%------------------------------------------------------------------------------</span>
0035 
0036 <span class="comment">% make a timeframe</span>
0037 <span class="comment">% tbeg = greg2julian(2009,1,1,0,0,0)-2400000.5;</span>
0038 <span class="comment">% tend = greg2julian(2010,1,1,0,0,0)-2400000.5;</span>
0039 tbeg = 0;
0040 tend = 31;
0041 time = tbeg:1:tend;
110
0042 nTimes = numel(time);
Pierre Cazenave's avatar
Pierre Cazenave committed
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 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173
0043 
0044 <span class="comment">% make up a fake time varying wind in m/s at 10-m above the water surface</span>
0045 u10 = 10*ones(nTimes,1); 
0046 v10 = zeros(nTimes,1); 
0047 
0048 <span class="comment">%------------------------------------------------------------------------------</span>
0049 <span class="comment">% write output to time-varying, spatially constant FVCOM wind file</span>
0050 <span class="comment">%------------------------------------------------------------------------------</span>
0051 fvcom_forcing_file = <span class="string">'tst_wind.nc'</span>; 
0052 nc = netcdf(fvcom_forcing_file, <span class="string">'clobber'</span>);            
0053 nc.references = <span class="string">'http://fvcom.smast.umassd.edu'</span>; 
0054 nc.source = <span class="string">'single-point time-dependent surface forcing'</span>; 
0055 nc.institution = <span class="string">'School for Marine Science and Technology'</span> ;
0056 nc.history = <span class="string">'generated using the fvcom-toolbox'</span>;
0057 
0058 
0059   
0060 <span class="comment">% dimensions</span>
0061 nc(<span class="string">'time'</span>) = 0;
0062 
0063 <span class="comment">% time vars</span>
0064 nc{<span class="string">'time'</span>} = ncfloat(<span class="string">'time'</span>);
0065 nc{<span class="string">'time'</span>}.long_name = <span class="string">'time'</span>;
0066 nc{<span class="string">'time'</span>}.units = <span class="string">'days since 1858-11-17 00:00:00'</span>;
0067 nc{<span class="string">'time'</span>}.format = <span class="string">'modified julian day (MJD)'</span>;
0068 nc{<span class="string">'time'</span>}.time_zone = <span class="string">'UTC'</span>;
0069   
0070 nc{<span class="string">'Itime'</span>} = ncint(<span class="string">'time'</span>);
0071 nc{<span class="string">'Itime'</span>}.units = <span class="string">'days since 1858-11-17 00:00:00'</span>;
0072 nc{<span class="string">'Itime'</span>}.format = <span class="string">'modified julian day (MJD)'</span>;
0073 nc{<span class="string">'Itime'</span>}.time_zone = <span class="string">'UTC'</span>;
0074 
0075 nc{<span class="string">'Itime2'</span>} = ncint(<span class="string">'time'</span>);
0076 nc{<span class="string">'Itime2'</span>}.units = <span class="string">'msec since 00:00:00'</span>;
0077 nc{<span class="string">'Itime2'</span>}.time_zone = <span class="string">'UTC'</span>;
0078 
0079 
0080 nc{<span class="string">'U10'</span>} = ncfloat(<span class="string">'time'</span>);
0081 nc{<span class="string">'U10'</span>}.long_name = <span class="string">'Eastward Wind Velocity'</span>;
0082 nc{<span class="string">'U10'</span>}.standard_name = <span class="string">'Wind Velocity'</span>;
0083 nc{<span class="string">'U10'</span>}.units = <span class="string">'m/s'</span>;
0084 nc{<span class="string">'U10'</span>}.type = <span class="string">'data'</span>;
0085 
0086 nc{<span class="string">'V10'</span>} = ncfloat(<span class="string">'time'</span>);
0087 nc{<span class="string">'V10'</span>}.long_name = <span class="string">'Northward Wind Velocity'</span>;
0088 nc{<span class="string">'V10'</span>}.standard_name = <span class="string">'Wind Velocity'</span>;
0089 nc{<span class="string">'V10'</span>}.units = <span class="string">'m/s'</span>;
0090 nc{<span class="string">'V10'</span>}.type = <span class="string">'data'</span>;
0091 
0092 <span class="comment">% dump time</span>
0093 nc{<span class="string">'time'</span>}(1:nTimes) = time; 
0094 nc{<span class="string">'Itime'</span>}(1:nTimes) = floor(time); 
0095 nc{<span class="string">'Itime2'</span>}(1:nTimes) = mod(time,1)*24*3600*1000.;
0096 
0097 nc{<span class="string">'U10'</span>}(1:nTimes) = u10;  
0098 nc{<span class="string">'V10'</span>}(1:nTimes) = v10; 
0099 
0100 ierr = close(nc);
0101 
0102 fprintf([<span class="string">'end   : '</span> subname <span class="string">'\n'</span>])
0103 
0104 
0105</pre></div>
174
<hr><address>Generated on Thu 19-Mar-2015 12:20:56 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" title="Matlab Documentation in HTML">m2html</a></strong> &copy; 2005</address>
Pierre Cazenave's avatar
Pierre Cazenave committed
175 176
</body>
</html>