how to fwrite data from a while loop

See Hai Ooi axl419 at YAHOO.COM
Sat May 6 18:07:12 EDT 2006


Hi,

    I am not clear about your intended output.
Perhaps you could try the following:-

*
  'reinit'
*
  'open project/ERA40_test.ctl'
  'set gxout fwrite'
  'set fwrite project/peakvalues.data'
*
  'set lon 140 260'
  'set lat 15 75'
  'set lev 775'
*
  countt = 12
  while(countt<=528)
     'set t 'countt
     'define d=vv'
      countt=countt+1
     'set t 'countt
     'define j=vv'
      countt=countt+1
     'set t 'countt
     'define f=vv'
     'define win=(d+j+f)/3'
*
     a=1959
     'define
pval=aave(win'a',lon=189,lon=207,lat=51,lat=64)'
     'd pval'
     a=a+1
*
     countt = countt + 10
  endwhile
*
  'disable fwrite'

   Hope this helps. Regards.

Ooi


--- Dan Barrie <dbarrie at ATMOS.UMD.EDU> wrote:

> Hi everyone,
>
> I am having a relatively simple problem with a grads
> script I wrote. I
> am simply looking for the script to output a data
> file with the result
> of every incremental passage through a while loop.
> The loop I have
> written is hopefully producing only one data point
> each time through.
> All I am getting out is a blank data file. I have
> copied my script
> below. Thank you in advance for your help.
>
> Sincerely,
>
> Dan Barrie
>
>
>
> 'reinit'
>
> 'open project/ERA40_test.ctl'
>
> 'set lon 140 260'
> 'set lat 15 75'
> 'set lev 775'
> 'set t 1 528'
> countt = 12
> a=1959
> 'set fwrite project/peakvalues.data'
> 'set gxout fwrite'
>  while(countt<=527)
>      'set t 'countt
>      'define d=vv'
>       countt=countt+1
>      'set t 'countt
>      'define j=vv'
>       countt=countt+1
>      'set t 'countt
>      'define f=vv'
>      'define win=(d+j+f)/3'
>      'define
> pval=aave(win'a',lon=189,lon=207,lat=51,lat=64)'
>      'd pval'
>      a=a+1
>      countt = countt + 10
>  endwhile
> 'disable fwrite'
>


Send instant messages to your online friends http://uk.messenger.yahoo.com



More information about the gradsusr mailing list