error with while loop

Charles Seman Charles.Seman at NOAA.GOV
Mon Feb 22 17:02:10 EST 2010


Dipak,

Try using the "write()" function: 
http://grads.iges.org/grads/gadoc/script.html#intrinsic and no "set 
gxout print" or if you do, then the "subwrd(...)" statement would have 
to be changed...

'define maxt = ...'
'd maxt' ; maxt = subwrd(result,4)
rc = write('maxt2-bbsr-DA.txt','t = 'tt' maxt = 'maxt)
* or
rc =  write('maxt2-bbsr-DA.txt','t = 'tt' maxt = 'maxt,append)

* ",append" : if you want to append to any existing file on the first 
write; see documentation; try with/without ",append" to experiment...

Hope this helps,
Chuck

dipak sahu wrote:
> Dear frnds
>      here i have some difficulty with the following script, i want to 
> write the maximum value of daily temperature of 4-day forecast, but it 
> is only writing a single value (i.e the maximum value of last day 
> only). I didin't found where is the mistake. Thanks in advance if 
> anybody has any solution to share on it.The  script is given below.
>  
> 'reinit'
> 'open singldom-Nov.ctl'
> 'set lat 20.25'
> 'set lon 85.83'
> tt = 1
> while (tt<97)
> 'set t 'tt
>    'define maxt= max((t2-273.15),t+0,t+23)'
>     'set gxout print'
>    'fprintf maxt maxt2-bbsr-DA.txt';
>     tt=tt+24
>   endwhile
> ~
> with regards
> Dipak
>  

-- 

Please note that Charles.Seman at noaa.gov should be considered my NOAA
email address, not cjs at gfdl.noaa.gov.

********************************************************************
 Charles Seman                                Charles.Seman at noaa.gov
 U.S. Department of Commerce / NOAA / OAR
 Geophysical Fluid Dynamics Laboratory         voice: (609) 452-6547
 201 Forrestal Road                              fax: (609) 987-5063
 Princeton, NJ  08540-6649            http://www.gfdl.noaa.gov/~cjs/
********************************************************************

"The contents of this message are mine personally and do not necessarily
reflect any position of the Government or NOAA."



More information about the gradsusr mailing list