<div dir="ltr"><div><div><div><div><div>Dear <span name="T. haghroosta" class="">Haghroosta,</span></div><div><br>Why don&#39;t you use CDO instead?<br><br></div>It is very easy to do.<br><br></div>Just invoke the following commands to accomplish your task...<br><br><em style="font-weight:bold;font-style:normal;color:rgb(84,84,84);font-family:arial,sans-serif;font-size:small;font-variant:normal;letter-spacing:normal;line-height:18.2px;text-align:left;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255)">cdo</em><span style="color:rgb(84,84,84);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:18.2px;text-align:left;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;display:inline!important;float:none;background-color:rgb(255,255,255)"><span class=""> </span>-f nc import_binary -i your_file.ctl <a href="http://output_file.nc">output_file.nc</a></span><br><br></div>Hope it helps !<br><br></div>Cheers,<br><br></div>Kishore<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Oct 24, 2014 at 9:03 AM, T. haghroosta <span dir="ltr">&lt;<a href="mailto:haghroosta@hotmail.com" target="_blank">haghroosta@hotmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div><div dir="ltr">Hi Andrew,<br> <br>Thanks for your reply, I used this script as you led, but unfortunately  these two commands gor error: outfile=&#39;my_ascii_file.txt&#39;<br>&#39;!/bin/rm -f &#39;outfile<br> <br>the grads said for first command:<br> <br> invalid expression<br>syntax error: expected operand or &#39;&lt;&#39;<br> <br>and for the second command said:<br>cannot remove &#39;-f&#39;<br>cannot remove &#39;outfile&#39;<br>not such a file or directory.<br> <br>could you please tell me where is my problem, because by other commands in the follow script I saw the data in the display window but I cannot have them in a text file<br>Regards,<br>T.<br> <br>&#39;open /data/grib/model/model.ctl&#39;<br>&#39;set x 1 72&#39;<br>outfile=&#39;my_ascii_file.txt&#39;<br>&#39;!/bin/rm -f &#39;outfile<br>&#39;set gxout print&#39;<br>&#39;set prnopts %g, 72 0&#39;<br>&#39;d ts-273.15&#39;<br>i=1<br>while (1)<br>  line = sublin(result,i)<br>  if (line = &#39;&#39;); break; endif<br>  if (i&gt;1)<br>    rc = write(outfile,line,append)<br>  endif<br>  i=i+1<br>endwhile<br> <br> <br> <br><br> <br><div>&gt; From: <a href="mailto:gradsusr-request@gradsusr.org" target="_blank">gradsusr-request@gradsusr.org</a><br>&gt; Subject: gradsusr Digest, Vol 56, Issue 40<br>&gt; To: <a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br>&gt; Date: Wed, 22 Oct 2014 12:00:01 -0400<br>&gt; <br>&gt; Send gradsusr mailing list submissions to<br>&gt;         <a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br>&gt; <br>&gt; To subscribe or unsubscribe via the World Wide Web, visit<br>&gt;         <a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>&gt; or, via email, send a message with subject or body &#39;help&#39; to<br>&gt;         <a href="mailto:gradsusr-request@gradsusr.org" target="_blank">gradsusr-request@gradsusr.org</a><br>&gt; <br>&gt; You can reach the person managing the list at<br>&gt;         <a href="mailto:gradsusr-owner@gradsusr.org" target="_blank">gradsusr-owner@gradsusr.org</a><br>&gt; <br>&gt; When replying, please edit your Subject line so it is more specific<br>&gt; than &quot;Re: Contents of gradsusr digest...&quot;<br>&gt; <br>&gt; <br>&gt; Today&#39;s Topics:<br>&gt; <br>&gt;    1. Re: Convert .dat file to netcdf (Andrew Friedman)<br>&gt; <br>&gt; <br>&gt; ----------------------------------------------------------------------<br>&gt; <br>&gt; Message: 1<br>&gt; Date: Wed, 22 Oct 2014 14:15:28 +0200<br>&gt; From: Andrew Friedman &lt;<a href="mailto:andfried@gmail.com" target="_blank">andfried@gmail.com</a>&gt;<br>&gt; Subject: Re: [gradsusr] Convert .dat file to netcdf<br>&gt; To: GrADS Users Forum &lt;<a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a>&gt;<br>&gt; Message-ID: &lt;<a href="mailto:31C71C86-50FA-43BE-AAD8-9F1BD3484D33@gmail.com" target="_blank">31C71C86-50FA-43BE-AAD8-9F1BD3484D33@gmail.com</a>&gt;<br>&gt; Content-Type: text/plain; charset=windows-1256<span class=""><br>&gt; <br>&gt; Hi T. Haghroosta,<br>&gt; <br>&gt; You can save to a .csv file using the instructions for ASCII data:<br>&gt; <a href="http://www.iges.org/grads/gadoc/ascii.html" target="_blank">http://www.iges.org/grads/gadoc/ascii.html</a><br>&gt; The instructions are related to the OpenGrADS recipe for saving to a text file:<br>&gt; <a href="http://cookbooks.opengrads.org/index.php?title=Recipe-002:_Saving_GrADS_variable_data_to_a_text_file" target="_blank">http://cookbooks.opengrads.org/index.php?title=Recipe-002:_Saving_GrADS_variable_data_to_a_text_file</a><br>&gt; <br>&gt; Andrew<br>&gt; <br>&gt; On Oct 21, 2014, at 8:43 AM, T. haghroosta &lt;<a href="mailto:haghroosta@hotmail.com" target="_blank">haghroosta@hotmail.com</a>&gt; wrote:<br>&gt; <br>&gt; &gt; Dear All,<br>&gt; &gt;  <br>&gt; &gt; Is there any way to convert a .dat file from WRF to a netcdf or .mat (matlab file) or .csv file?<br>&gt; &gt;  <br>&gt; &gt; I am looking forward to hearing from side of you.<br>&gt; &gt;  <br>&gt; &gt; Ragards.<br>&gt; &gt; T.<br>&gt; </span></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>