<br><br><div class="gmail_quote">On Mon, Jan 30, 2012 at 10:55 PM, Dr.Gamal El Afandi <span dir="ltr">&lt;<a href="mailto:gamalafandy@yahoo.com">gamalafandy@yahoo.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 style="color:#000;background-color:#fff;font-family:times new roman,new york,times,serif;font-size:12pt"><div><span></span></div><div></div><div><span>Dear all,</span></div><div><span></span><span>Could <span>you</span> please let me know if anyone have idea about converting the <span>TXT</span> or ASCII data into <span>NetCDF</span>?</span></div>
<div><span></span><span>Please attached is the file required to be transformed into <span>NetCDF</span>.</span></div><div><span></span><span><var></var>Please below is the program I used to convert from binary to <span>TXT</span></span></div>
</div></div></blockquote><div><br></div><div>Why did you get ASCII involved at all? It appears that your binary file can be directly read by grads (with the proper <a href="http://grads.iges.org/grads/gadoc/descriptorfile.html">ctl</a>). Once grads can open your file you can convert it to netcdf with <a href="http://grads.iges.org/grads/gadoc/gradcomdsdfwrite.html">sdfwrite</a>, or if you have opengrads, with <a href="http://opengrads.org/doc/scripts/lats4d/">lats4d</a>.</div>
<div><br></div><div>   Arlindo</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="color:#000;background-color:#fff;font-family:times new roman,new york,times,serif;font-size:12pt">
<div><blockquote style="padding-left:5px;margin-top:5px;margin-left:5px;border-left-color:rgb(16,16,255);border-left-width:2px;border-left-style:solid"><div style="font-family:times new roman,new york,times,serif;font-size:12pt">
<div style="font-family:times new roman,new york,times,serif;font-size:12pt"><div><div><div style="color:rgb(0,0,0);font-family:times new roman,new york,times,serif;font-size:12pt;background-color:rgb(255,255,255)"><div><span></span> </div>
<div><span>PROGRAM convert_<span>rfe</span>_bin2<span>asc</span><br><br>c <span>cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc</span><br>c  Program: convert_<span>rfe</span>2.f<br>c<br>c  Description: This program reads in a daily <span>RFE</span> (rainfall estimate) file<br>
c              (version 2) in .bin format and creates an <span>ascii</span> integer<br>c              file.  Each file contains <span>rfe</span> coordinate data ordered by rows.<br>c              Rainfall resolution is 0.1 degree with a domain of<br>
c              20W-55E, 40S-40N.<br>c<br>c  Inputs: &#39;input_file&#39; = the 10-day binary <span>precip</span> file to be converted<br>c<br>c  Output: &#39;output.<span>txt</span>&#39; = the output <span>ascii</span> converted text file<br>
c<br>c  Modified: July, 2010 by Nick Novella (<a href="mailto:nicholas.novella@noaa.gov" target="_blank">nicholas.novella@noaa.gov</a>)<br>c<br>c <span>cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc</span><br>
<br>        REAL*4 <span>rfe</span>(751,801),arr(3,601551)<br>        real*4 lat,<span>lon</span><br>        INTEGER:: i,j,ind<br>        character*25:: input_file<br><br>c #####  CHANGE FILE NAME BELOW TO INPUT FILE  #####<br><br>        input_file=&quot;all_products.bin.20100621&quot;<br>
<br>c ##################################################<br><br>c #####  Initialize the arrays  #####<br>        do i = 1,751 <br>        do j = 1,801 <br>          <span>rfe</span> (i,j) = -999<br>        end do<br>        end do<br><br>c #####  Read in the input rainfall data  #####<br>
        open
 (unit=22,file=input_file,access=&quot;direct&quot;,<br>        1        convert=&#39;big_<span>endian</span>&#39;,status=&quot;old&quot;,<span>recl</span>=751*801*4)<br>        read  (22, rec=1) <span>rfe</span> <br><br>c #####  Open the output file  #####<br>
        open (88,file=&quot;output.<span>txt</span>&quot;,access=&#39;sequential&#39;,<br>        1        status=&#39;unknown&#39;,form=&#39;formatted&#39;)<br><br>c #####  The next code converts the input rainfall data. Each row is then written<br>
c        to the output file.<br><br>        ind=1 <br>          lat= -40.0<br>        <span>lon</span>= -20.0  <br>        do j=1,801<br>        do i=1,751<br>         
 arr(1,ind)=lat<br>          arr(2,ind)=<span>lon</span><br>          arr(3,ind)=<span>rfe</span>(i,j)<br><br>        write (88,499) arr(1,ind), arr(2,ind), arr(3,ind)<br>499        format(1X,f6.2,1X,f6.2,1X,f8.2)<br><br>           ind=ind+1<br>
           <span>lon</span>=<span>lon</span>+0.1<br>        end do<br>        lat=lat+0.1<br>        <span>lon</span>=-20.0<br>        end do<br><br><br><br><br><br>      END PROGRAM<br></span></div><div></div><div> </div><div><font size="3" face="times new roman, new york,
 times, serif">With my kind regards<br>Gamal<br>___________________________________________________________<br><b>Gamal <span>Salah</span> El Afandi, <span>Ph</span>.D.
 <br>College of Agricultural, Environment and Nutrition Sciences </b></font></div>
<div><font size="3" face="times new roman, new york, times, serif"><b>College of Engineering  <br>Tuskegee University, Tuskegee Alabama USA<br></b><br></font><a href="http://www.tuskegee.edu/" rel="nofollow" target="_blank"><font size="3" face="times new roman, new york, times, serif">http://www.tuskegee.edu/</font></a><br>
<a href="http://www.tuskegee.edu/academics/colleges/caens.aspx" rel="nofollow" target="_blank"><font size="3" face="times new roman, new york, times, serif">http://www.tuskegee.edu/academics/colleges/caens.aspx</font></a><br>
<a href="http://www.tuskegee.edu/academics/colleges/ceps.aspx" rel="nofollow" target="_blank"><font size="3" face="times new roman, new york, times, serif">http://www.tuskegee.edu/academics/colleges/ceps.aspx</font></a><br>
<a href="http://maindb.unfccc.int/public/roe/expert_list.pl?id_country=66&amp;" rel="nofollow" target="_blank"><font size="3" face="times new roman, new york, times,

 serif">http://maindb.unfccc.int/public/roe/expert_list.pl?id_country=66&amp;</font></a><font size="3" face="times new roman, new york, times, serif">;<br></font><a href="http://www.itap.purdue.edu/pto/NATO_KEEO/partCoDir_en.html" rel="nofollow" target="_blank"><font size="3" face="times new roman, new york, times, serif">http://www.itap.purdue.edu/pto/NATO_KEEO/partCoDir_en.html</font></a><br>
<a href="http://www.ucar.edu/governance/iap/iapreps.shtml" rel="nofollow" target="_blank"><font size="3" face="times new roman, new york, times, serif">http://www.ucar.edu/governance/iap/iapreps.shtml</font></a></div>
<div> </div></div></div></div><br><br> </div> </div> </blockquote></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><br clear="all"><div><br></div>-- <br>Arlindo da Silva<br><a href="mailto:dasilva@alum.mit.edu">dasilva@alum.mit.edu</a><br>