Ulrike,<br><br>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).<br>
That`s all.<br><br>Eduardo.<br><br><br><br><br>* k es el indice vertical, km es el maximo<br>km=12<br>k=1<br>while (k <= km)<br> k1=k-1<br> k2=k+1<br> if (k = 1)<br> k1=1<br> endif<br> if (k = km)<br> k2=km<br> endif<br>
* los niveles p1 y p2 estan en hPa,<br> 'set z 'k1<br> 'define p1=lev'<br> 'set z 'k2<br> 'define p2=lev'<br> 'set z 'k<br><br>* Divergencia vertical en coordenadas de presión considerando omeg <br>
* la variable vertical.<br>* vertdiv1, vertdiv2, ... sera la divergencia vertical para los niveles 1,<br>2, ...<br>* en este caso la variable vertical está pesada por la densidad del aire<br>* de la manera siguiente<br>
* 1/(densidad)*Div/vertical(densidad*omeg)<br><br>* densidad del aire en funcion de alturas de nivel para amtosfera standard<br>'roo=1.212'<br>'cte=0.9999'<br>'roz'k1'=roo*exp(-cte*p1)'<br>
'roz'k2'=roo*exp(-cte*p2)'<br><br>'define terma=(roz'k2'-roz'k1')'<br>'define termb=(Euz(z='k2')+Euz(z='k1'))/2'<br>'define termc=termb/terma'<br><br>
'p0=1000'<br>'C=p0*exp(log(p2/p0)-log(p1/p0)'<br><br>'define omeg(z='k2')=Euz(z='k2')'<br>'define omeg(z='k1')=Euz(z='k1')'<br> <br> <br> 'define verdiv'k'=(termc+((omeg(z='k2')-omeg(z='k1'))/(p2-p1))))*C'<br>
k=k+1<br>endwhile<br><br><br><div class="gmail_quote">2008/6/23 Ulrike Wissmeier <<a href="mailto:ulrike@meteo.physik.uni-muenchen.de">ulrike@meteo.physik.uni-muenchen.de</a>>:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Dear all,<br>
in order to compute/plot the vertical gradient of vertical vorticity zeta, I<br>
couldn't use the cdiff-function, as there seem to be problems with<br>
cdiff(Expr,z). In the past (see archive) it was suggested to use "define<br>
dExpr=Expr(z+1)-Expr(z-1)" instead of cdiff, however, that does not work for<br>
my calculated vertical vorticity zeta either:<br>
<br>
grads-script:<br>
'set lon 0 60'<br>
'set lat 0 60'<br>
'set z 0 30''<br>
<br>
'define dx = cdiff(lon*1000.0,x)'<br>
'define dy = cdiff(lat*1000.0,y)'<br>
'define dvx = cdiff(vinterp,x)'<br>
'define duy = cdiff(uinterp,y)'<br>
'define zeta = (dvx/dx-duy/dy)'<br>
<br>
'set z 1 29'<br>
<br>
'define dzetaz = zeta(z+1)-zeta(z-1)'<br>
'define dzhz = zh(z+1)-zh(z-1)'<br>
<br>
'set lon 'lon''<br>
'display dzetaz/dzhz'<br>
<br>
(where zh is the position of the vertical grid points z=1,2,3,...)<br>
<br>
This gives the following error message:<br>
Syntax Error: Invalid Operand<br>
'dzetaz' not a variable or function name<br>
Error ocurred at column 1<br>
DISPLAY error: Invalid expression<br>
Expression = dzetaz/dzhz<br>
<br>
I would be very glad if anyone can help,<br>
thanks in advance,<br>
<font color="#888888">Ulrike<br>
</font></blockquote></div><br>