<div dir="ltr">Dear Mahakur,<div><br></div><div>CDO is also an easy alternative for merging variables ....</div><div><br></div><div>Cheers,</div><div><br></div><div>Kishore</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Wed, Sep 11, 2013 at 10:40 PM, Jennifer Adams <span dir="ltr"><<a href="mailto:jma@cola.iges.org" target="_blank">jma@cola.iges.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">Please read the documentation at <a href="http://iges.org/grads/gadoc/gradcomdsdfwrite.html" target="_blank">http://iges.org/grads/gadoc/gradcomdsdfwrite.html</a>. <div><br></div><div>Here's the relevant section of that page:<div>
<p><em><strong>Appending Variables to a File</strong></em><br>
The sdfwrite command does not allow you to write out more than one
variable to a file. The way to do achieve this is to write out each
variable in a separate file, then merge them with the <a href="http://nco.sourceforge.net/nco.html" target="_blank">NetCDF Operators (NCO)</a>. Use the <a href="http://nco.sourceforge.net/nco.html#ncks" target="_blank"><code>ncks</code></a> command to append variables defined on the same grid. The GrADS commands might look like this:
</p><pre>open gfs.ctl
set x 1 720
set y 1 361
set t 1 last
define slp = mslp
define precip = ptot
set sdfwrite -flt <a href="http://slp.nc" target="_blank">slp.nc</a>
sdfwrite slp
sdt sdfwrite -flt <a href="http://precip.nc" target="_blank">precip.nc</a>
sdfwrite precip
</pre>
Then, outside GrADS, or using the ! in front of the command to send it
to the shell from within GrADS, merge these two files with <a href="http://nco.sourceforge.net/nco.html#ncks" target="_blank"><code>ncks</code></a>:
<pre><a href="http://nco.sourceforge.net/nco.html#ncks" target="_blank">ncks</a> -O -h -A <a href="http://precip.nc" target="_blank">precip.nc</a> <a href="http://slp.nc" target="_blank">slp.nc</a></pre><p>The -A is for appending to the output file, the -O is for overwriting
existing output file, and the -h does not add anything to the output
file's global 'history' attribute. Please see the <a href="http://nco.sourceforge.net/nco.html" target="_blank">NCO User's Guide</a> for more information.</p><p><br></p><p> </p></div><div><div><div class="h5">
<br><div><div>On Sep 11, 2013, at 12:41 PM, M.Mahakur wrote:</div><br><blockquote type="cite"><div>Respected Everyone,<br><br>Is it possible to write more than one variable to 'a single' netcdf file using sdfwrite? As below for example:<br>
<br><br>var1=...<br>var2='''<br>var3 ...<br>..<br><br>set sdfwrite <a href="http://all_var.nc" target="_blank">all_var.nc</a><br>sdfwrite var1<br>sdfwrite var2<br>....<br>clear sdfwrite<br><br><br>With Regards and Thanks,<br>
Mahakur<br>_______________________________________________<br>gradsusr mailing list<br><a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br><a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
</div></blockquote></div><br></div></div><div>
<span style="font-size:12px"><div style="word-wrap:break-word"><span style="text-indent:0px;letter-spacing:normal;font-variant:normal;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:12px;white-space:normal;font-family:Helvetica;word-spacing:0px"><span style="text-indent:0px;letter-spacing:normal;font-variant:normal;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:12px;white-space:normal;font-family:Helvetica;word-spacing:0px"><div>
--</div><div>Jennifer M. Adams<br>Center for Ocean-Land-Atmosphere Studies (COLA)<br>111 Research Hall, Mail Stop 2B3<br>George Mason University<br>4400 University Drive<br>Fairfax, VA 22030 <br><br></div><div><br></div><br>
</span></span></div></span><br>
</div>
<br></div></div></div><br>_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
<br></blockquote></div><br></div>