<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <font face="Arial">Hi GrADS users, <br>
    </font><br>
    <font face="Arial">
      <meta http-equiv="content-type" content="text/html; charset=utf-8">
      <span id="result_box" class="short_text" lang="en"><span
          class="hps">I</span><span>'m trying to implement</span> <span
          class="hps">this solution -&gt;</span></span><br>
      <a class="moz-txt-link-freetext" href="http://iges.org/grads/gadoc/ascii.html">http://iges.org/grads/gadoc/ascii.html</a><br>
      <br>
    </font><br>
    <font face="Arial">
      <meta http-equiv="content-type" content="text/html; charset=utf-8">
      <span id="result_box" class="short_text" lang="en"><span
          class="hps">When I run</span> <span class="hps">I get</span>
        <span class="hps">this error-&gt;<br>
          <br>
        </span></span>Error in format:  2rd argument invalid.<br>
        Error occurred on line 29<br>
      <br>
      - - - - - - - - - <br>
      - - - - - - - - -<br>
      <br>
      'set x 1 119'<br>
      outfile='my_ascii_file.txt'<br>
      '!/bin/rm -f 'outfile<br>
      'set gxout print'<br>
      fmt='%8.3f'<br>
      numcols=119<br>
      'set prnopts 'fmt' 'numcols' 1'<br>
      'd lon'<br>
      lon_data = result<br>
      'd lat'<br>
      lat_data = result<br>
      'd t'<br>
      v1_data = result<br>
      'd t'<br>
      v2_data = result<br>
      'd t'<br>
      v3_data = result<br>
      i=1<br>
      while (1)<br>
        lons  = sublin(lon_data,i)<br>
        lats  = sublin(lat_data,i)<br>
        line1 = sublin(v1_data,i)<br>
        line2 = sublin(v2_data,i)<br>
        line3 = sublin(v3_data,i)<br>
        if (lons='' | lats='' | line1='' | line2='' | line3=''); break;
      endif<br>
        if (i&gt;1)<br>
          j=1<br>
          while (j&lt;=numcols)<br>
            str = subwrd(lons,j); lon = math_format(fmt,str)<br>
            str = subwrd(lats,j); lat = math_format(fmt,str)<br>
            str = subwrd(line1,j); v1 = math_format(fmt,str)<br>
            str = subwrd(line2,j); v2 = math_format(fmt,str)<br>
            str = subwrd(line3,j); v3 = math_format(fmt,str)<br>
            record = lon' 'lat' 'v1' 'v2' 'v3<br>
            rc = write(outfile,record,append)<br>
            j=j+1<br>
          endwhile<br>
        endif<br>
        i=i+1<br>
      endwhile<br>
      <br>
      - - - - - - - - - -<br>
      - - - - - - - - - -<br>
      <br>
      Leopoldo <br>
      Tenerife - Canary Islands 
                                                                                                                                                                                                                                                                                                
      <br>
      <br>
    </font>
  </body>
</html>