Please note: tThe 1st rule of data processing is to *look at your data*.
[1]
The calculation of potential vorticity requires a vertical derivative.
You have:
  a = addfile("uwnd.2005.nc","r")
  u = short2flt(a->uwnd(152,{200},:,:))
which means you are reading in the 153rd time step and the 200hPa level 
only.
In fact, you have only a two-dimensional array:  u(lat,lon). The same holds
for temperature and v. So, you do not have  multiple vertical levels. 
Hence,
a vertical derivative in not possible!!
Use
      printVarSummary( u )
to verify.
The actual data variables are: (time, lev,lat,lon)
[2]
There were many syntax errors which you did not even try to correct.
Please do not send us code with multiple syntax errors.
We like to help but     *** our time is valuable too!!!! ***
[3]
Please read the Mini-Language manual at:
http://www.ncl.ucar.edu/Document/Manuals/
[4]
The approximation you were using is good only on isentropic surfaces. 
The formulation
for pressure levels is significantly different.
I have a PV code which I will send you offline.
*NOTE* the is unsupported. I will not answer any questions.
kalim ullah wrote:
> Dear Wei,
> I am feeling difficulty to calculate the potential vorticity as you 
> suggested me. Now I am sending you my script file I hope you will 
> check it and suggested me like before.
> thanks in advance
> kalim
>
> --- On *Mon, 10/19/09, Wei Huang /<huangwei@ucar.edu>/* wrote:
>
>
>     From: Wei Huang <huangwei@ucar.edu>
>     Subject: Re: how to calculate potential vorticity
>     To: "kalim ullah" <kalimrid@yahoo.com>
>     Date: Monday, October 19, 2009, 7:09 AM
>
>     Kalim,
>
>     Where "phi = latitude * PI/180".
>     Do not scale your vrt before pv, but after you get pv.
>
>     Assume your have KZ levels,
>
>     where theat = T * (100000/p) **(R/cp).
>
>     then:
>     at level 1: d(theta)/dp =  (theta(2) - theta(1))/(P(2) - P(1))
>     at level KZ: d(theta)/dp =  (theta(KZ) - theta(KZ -1))/(P(KZ) -
>     P(KZ -1))
>     and other levels:  d(theta)/dp = 0.5 * (  (theta(K+1) -
>     theta(K))/(P(K+1) - P(K))
>                                                             
>      + (theta(K) - theta(K-1))/(P(K) - P(K-1)))
>
>     Where P is in Pa.
>
>     Hope this help.
>
>     Wei Huang
>     huangwei@ucar.edu
>     <http://us.mc537.mail.yahoo.com/mc/compose?to=huangwei@ucar.edu>
>     VETS/CISL
>     National Center for Atmospheric Research
>     P.O. Box 3000 (1850 Table Mesa Dr.)
>     Boulder, CO 80307-3000 USA
>     (303) 497-8924
>
>
>
>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Nov  9 14:03:04 2009
This archive was generated by hypermail 2.1.8 : Wed Nov 11 2009 - 12:48:56 MST