[gradsusr] Saving new variable time-dependent

Jeff Duda jeffduda319 at gmail.com
Sun Jan 25 13:13:11 EST 2015


Try this command, but without any loop:

'set t 1 10'
'define dayrad = 2.78e-4*sum(SSRsfc,t-0,t+2)'

That will give you the sum, but based on the index increment you use
(tt+3), you will instead just get a 24-hour sum updated every 12 hours. To
get the time series you want, you may have to define a separate array for
each day and write each to either the same file or a different file. This
may seem tedious or prolific, but the loop you have will do the trick with
some minor alterations:

tt=1
while( tt <= 10)

'set t 'tt

'define dayrad'tt'= 2.78e-4*sum(SSRsfc, t='tt',t='tt+2')'

'set gxout print'

'd dayrad'tt
*To eliminate the possibility of a crash resulting from using too much
memory, undefine each array after printing it
'undefine dayrad'tt

tt=tt+3
endwhile

See if either of these strategies gives you what you want.

Jeff Duda

On Sun, Jan 25, 2015 at 11:48 AM, Rabah Hachelaf <r.hachelaf at gmail.com>
wrote:

> Hi Grads users,
>
> i have this small scripts to transform every 12 hours radiation into daily
> data by summing. but my new variable "dayrad" saves just the last iteration.
> my request is how to save all data calculated in dayrad variable into a
> time-dependent variable.
>
> Thanks for help.
>
>
> 'open rad.ctl'
> tt=1
> while( tt <= 10)
>
> 'set t 'tt
>
> 'define dayrad= 2.78e-4*sum(SSRsfc, t='tt',t='tt+2')'
>
> 'set gxout print'
>
> 'd dayrad'
>
> tt=tt+3
> endwhile
> --
> Rabah
>
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>
>


-- 
Jeff Duda
Graduate research assistant
University of Oklahoma School of Meteorology
Center for Analysis and Prediction of Storms
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20150125/82eba4bf/attachment.html 


More information about the gradsusr mailing list