vertical gradient of vert.vorticity; cdiff(Expr,z)

Eduardo Agosta Scarel eduardo.agosta at GMAIL.COM
Mon Jun 23 15:13:08 EDT 2008


Ulrike,

Also I see you may need to estimate the vertical gradient in a sistematic
way and using a density wighted expression. I give you below the following
script that you should adjust for your case, it may help (words and in
Spanish, if needed, I can translate them later).
That`s all.

Eduardo.




* k   es el indice vertical, km es el maximo
km=12
k=1
while (k <= km)
 k1=k-1
 k2=k+1
 if (k = 1)
   k1=1
 endif
 if (k = km)
   k2=km
 endif
* los niveles p1 y p2 estan en hPa,
 'set z 'k1
 'define p1=lev'
 'set z 'k2
 'define p2=lev'
 'set z 'k

* Divergencia vertical en coordenadas de presión considerando omeg
*               la variable vertical.
*  vertdiv1, vertdiv2, ... sera la divergencia vertical para los niveles 1,
2, ...
* en este caso la variable vertical está pesada por la densidad del aire
* de la manera siguiente
* 1/(densidad)*Div/vertical(densidad*omeg)

* densidad del aire en funcion de alturas de nivel para amtosfera standard
'roo=1.212'
'cte=0.9999'
'roz'k1'=roo*exp(-cte*p1)'
'roz'k2'=roo*exp(-cte*p2)'

'define terma=(roz'k2'-roz'k1')'
'define termb=(Euz(z='k2')+Euz(z='k1'))/2'
'define termc=termb/terma'

'p0=1000'
'C=p0*exp(log(p2/p0)-log(p1/p0)'

'define omeg(z='k2')=Euz(z='k2')'
'define omeg(z='k1')=Euz(z='k1')'


 'define verdiv'k'=(termc+((omeg(z='k2')-omeg(z='k1'))/(p2-p1))))*C'
 k=k+1
endwhile


2008/6/23 Ulrike Wissmeier <ulrike at meteo.physik.uni-muenchen.de>:

> Dear all,
> in order to compute/plot the vertical gradient of vertical vorticity zeta,
> I
> couldn't use the cdiff-function, as there seem to be problems with
> cdiff(Expr,z). In the past (see archive) it was suggested to use "define
> dExpr=Expr(z+1)-Expr(z-1)" instead of cdiff, however, that does not work
> for
> my calculated vertical vorticity zeta either:
>
> grads-script:
>  'set lon 0 60'
>  'set lat 0 60'
>  'set z 0 30''
>
>  'define dx = cdiff(lon*1000.0,x)'
>  'define dy = cdiff(lat*1000.0,y)'
>  'define dvx = cdiff(vinterp,x)'
>  'define duy = cdiff(uinterp,y)'
>  'define zeta =  (dvx/dx-duy/dy)'
>
>  'set z 1 29'
>
>  'define dzetaz = zeta(z+1)-zeta(z-1)'
>  'define dzhz = zh(z+1)-zh(z-1)'
>
>  'set lon 'lon''
>  'display dzetaz/dzhz'
>
> (where zh is the position of the vertical grid points z=1,2,3,...)
>
> This gives the following error message:
>  Syntax Error:  Invalid Operand
>  'dzetaz' not a variable or function name
>  Error ocurred at column 1
>  DISPLAY error:  Invalid expression
>  Expression = dzetaz/dzhz
>
> I would be very glad if anyone can help,
> thanks in advance,
> Ulrike
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20080623/b17e14e6/attachment.html 


More information about the gradsusr mailing list