Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 28842e744495811080ce537d0b6dab00 > files > 109

grads-2.0.a9-0.2.fc15.i686.rpm

<!--Copyright (C) 1988-2005 by the Institute of Global Environment and Society (IGES). See file COPYRIGHT for more information.-->

<html>
<head>
<title>GrADS Commands: sdfwrite</title>
</head>
<body bgcolor="e0f0ff" text="#000000">

<h2><b>sdfwrite</b></h2>
<p><code>sdfwrite <i>varname </i></code>
<p>This<code></code> command will write out a defined variable <code><i>varname </i></code>into a NetCDF formatted
  data file.  

<ul>
  <p>&nbsp;</p>
</ul>
<h3>Usage Notes</h3>

<p>
The <code>sdfwrite</code> command works with GrADS version 2.0.a3 (or higher). Changes to the command in version 2.0.a5 included the option to force the output to have 4 or 5 dimensions. Changes to include compression and floating-point output were added with version 2.0.a8. 
<p> The name of the output file will be <code>grads.sdfwrite.nc</code> unless specified otherwise with the <code><a href="gradcomdsetsdfwrite.html">set sdfwrite</a></code> command. If the 
  file exists, it will be replaced. The <a href="gradcomdqsdfwrite.html"><code>q sdfwrite</code></a> command
  returns the status of the <code>sdfwrite</code> options. 
<p>The dimensions of the variable written to file correspond to the dimension environment that is set when the variable is  defined. The dimension environment that is set when the 'sdfwrite' command is invoked is ignored. Note this behavior is different from the fwrite command.

<p>By default, the output file will have a coordinate variable only for  varying dimensions in the defined variable; non-varying dimensions will not appear as a coordinate variable with a size of 1. However, as of version 2.0.a5,  options have been added to the  <code><a href="gradcomdsetsdfwrite.html">set sdfwrite</a></code> command to  force the variable in the output file to have at least 4 or all 5 dimensions. When either of these options to   <code><a href="gradcomdsetsdfwrite.html">set sdfwrite</a></code>  are used,   the output file will retain information about the values of the  dimensions that were fixed when the variable was defined; non-varying dimensions will appear as a coordinate variable of size 1.

<p>The coordinate variables will be  type 'double' and have two default attributes (&quot;units&quot; and &quot;long_name&quot;) with values that are based on the GrADS 5-dimensional gridded data model. The data variable will also be  type 'double' by default; beginning with version 2.0.a8, you can also write out data of type 'float' if you use the -flt option with    <code><a href="gradcomdsetsdfwrite.html">set sdfwrite</a></code> command. Data variables will have a 'missing value' attribute. 
<p>For example, if <code><i>varname</i></code> is called &quot;testvar&quot; and varies in X, Y, Z, T, and E, then the output file might have a NetCDF header that looks like this: 
<p><code>netcdf foo {<br>
  dimensions:<br>
&nbsp;&nbsp;longitude = 9 ;<br>
&nbsp;&nbsp;latitude = 9 ;<br>
&nbsp;&nbsp;level = 9 ;<br>
&nbsp;&nbsp;time = 9 ;<br>
&nbsp;&nbsp;ensemble = 9 ;<br>
variables:<br>
&nbsp;&nbsp;double longitude(longitude) ;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;longitude:units = &quot;degrees_east&quot; ;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;longitude:long_name = &quot;Longitude&quot; ;<br>
&nbsp;&nbsp;double latitude(latitude) ;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;latitude:units = &quot;degrees_north&quot; ;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;latitude:long_name = &quot;Latitude&quot; ;<br>
&nbsp;&nbsp;double level(level) ;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;level:units = &quot;millibar&quot; ;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;level:long_name = &quot;Level&quot; ;<br>
&nbsp;&nbsp;double time(time) ;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;time:units = &quot;minutes since 01-01-0001 00:00&quot; ;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;time:long_name = &quot;Time&quot; ;<br>
&nbsp;&nbsp;double ensemble(ensemble) ;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ensemble:grads_dim = &quot;e&quot; ;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ensemble:long_name = &quot;Ensemble member&quot; ;<br>
&nbsp;&nbsp;double testvar(ensemble, time, level, latitude, longitude) ;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;testvar:missing_value = -888. ;<br>
}
</code>
<p>The time axis units will always be &quot;minutes since ...&quot; and the date of the time axis origin will correspond to the initial time of the defined variable. 
<p>If the variable has an ensemble dimension, the attribute &quot;grads_dim&quot; with the value &quot;e&quot; will always be present so that the resulting output file can be opened with GrADS using the 'sdfopen' command. 
<p>To supplement or override the default attributes of the output file, use the <code><a href="gradcomdsetsdfattr.html">set sdfattr</a></code> command. 
<p>Beginning with version 2.0.a8, the output file may also be a compressed netCDF file. Use the <code>-zip</code> option with the <code><a href="gradcomdsetsdfwrite.html">set sdfwrite</a></code> command to enable compression. Please see the documentation on <a href="compression.html">compression</a> for  more details.
<h3>Examples </h3>

<p>
The following commands produce a regional subset of a global precip forecast :
<ul>
  <p><code>open global_forecast.ctl<br>
  set lon -111.3 -103.8 <br>
  set lat 40.9 45.0 <br>
  set lev 1000 10<br>
  set t 1 last<br>
    set e 1 last<br>
  define precip = ptot</code><code><br>
    set sdfwrite wyoming_precip.nc<br>
    sdfwrite precip<br>
    <br>
  </code></p>
</ul>

<p>Suppose you want to write out a long time series in one file, but memory limits do not allow you to define the entire time series in a single variable. You can write out the variable in time chunks, and then concatenate them together sequentially using the NetCDF Operators. 
<p>
<p>
<pre>open long_run.ctl
</pre>

</body>
</html>