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