Generating variable with several layers
Heinz Juergen Punge
heinzjuergen.punge at ZMAW.DE
Tue Sep 4 12:45:14 EDT 2007
Hi Erko,
are the variables Q_lev'z' defined on the other levels? Try this
(assuming you have a ctl file with the 27 levels open):
zi=1
'set z 1 27'
while zi<=27
'QQ_lev'zi'=const(Q_lev'zi',0,-u)'
...
zi=zi+1
endwhile
Maybe defval only works for lat/lon dimensions?
You may alternatively want to try something like this :
zi=1
'set z 1 27'
'QQ=const(Q_lev'zi',0)
*i.e. a new variable that is zero everywhere
while zi<=27
'set z 'zi
'q dims'
levi=subwrd(sublin(result,4),6)
'set z 1 27'
'QQ=QQ+const(maskout(Q_lev'zi',-abs(lev-'levi')),0,-u)'
zi=zi+1
endwhile
Best,
Heinz Juergen
Erko Jakobson wrote:
> Hello again
>
> One solution I tried was function set defval. As it works only 2D, then I
> fixed lon value and made a new 2D variable QQ, the variables are lat and z.
> 'set defval QQ 3 10 2.46'
> (here z=3, lat=10, new value for QQ is 2.46)
> But it gives error "MODIFY DEFVAL Error: Out of Range", and it gives this
> error always when z<>1, with z=1 the function is working correctly.
>
> Hoping to get some new ideas to go on
>
> Erko Jakobson,
> PhD student,
> University of Tartu,
> Estonia
>
>
>
>
> On Mon, 3 Sep 2007 13:27:37 +0200, Erko Jakobson <erkokkk at HOT.EE> wrote:
>
>
>>I have Q seasonal averages for 27 level separately (Q_lev1 to Q_lev27). For
>>making the vertical profiles, I have to put them in only one variable Q,
>>that consists 27 levels, so I can display the profiles:
>>
>>'set lat 55 90'
>>'set lon 90'
>>'set z 1 27'
>>'d Q'
>>
>>It should be function like Q(z)=Q_lev'z', but for me it seems, that in Grads
>>it is not so easy:(
>>
>>
>>Thank you very much for any advice,
>>
>>Erko Jakobson,
>>PhD student,
>>University of Tartu,
>>Estonia
>
>
More information about the gradsusr
mailing list