Displaying Compound Variables

Jeffrey Duda jdduda at IASTATE.EDU
Mon Feb 1 23:39:32 EST 2010


No.  Compounds only work for internal variables and you can't display them.
there's a difference between a displayable product/field and an internal
variable that is used in calculations.

If you want to make a field that is the sum of that field in previous times,
you'll have to code it like that, but you can do it with a while loop in
such a way:

'define product = product(first time)'
while (time step counter variable condition is true)
 product '=' product '-' product'(t-'time step counter variable')'
endwhile

'd 'product

Each time the code goes through the loop, the previous time step of the
field will be taken away from the current one, starting with the latest in
time.

Jeff Duda

On Mon, Feb 1, 2010 at 6:55 PM, Jason Snyder <jmssnyder at ucdavis.edu> wrote:

> I have a script to produce compound variables:
>
> 'sdfopen uwnd.2001.nc'
> 'set gxout shaded'
> 'set t 1'
> 'define U=uwnd'
> i=1
> count=1
> While(i<5)
>     count=count+1
>     say count
>    'set t 'i
>    U.count=uwnd
>     i=i+1
> endwhile
> the compound variable is U.count.  How do I go about producing and
> displaying compound variables?
> What modifications must I make to the script.
>
> What I want to make a formula that would be like this
> U(t)=U(t)+U(t-1)+U(t-2).  Where t-1 is a time step earlier than t and t-2 is
> two timesteps earlier than t.  I want to have this formula work for
> steptimes from 1 to say 5 (set t 1 5) How do I go about doing this?  Are
> compound variables event the answer?
>
> Thanks,
>
> Jason
>
>
>



-- 
Jeff Duda
Iowa State University
Meteorology Graduate Student
3134 Agronomy Hall
www.meteor.iastate.edu/~jdduda
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20100201/cc1fbef9/attachment.html 


More information about the gradsusr mailing list