Re: dimension problem: vorticity calculation

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed Jul 14 2010 - 07:40:05 MDT

[1]
The uv2vr_cfd documentation clearly indicates that the input
latitude and longitude variables *must* be one-dimensional
as indicated by [*]

http://www.ncl.ucar.edu/Document/Functions/Built-in/uv2vr_cfd.shtml

                lat [*] : numeric,
                lon [*] : numeric,

You are passing in
     lat = wrf_user_getvar(a,"XLAT",0)
     lon = wrf_user_getvar(a,"XLONG",0)

If you use printVarSummary(lat) you would see that it
is two-dimensional [*][*]. Hence, you get the error message:

> fatal:Number of dimensions in parameter (2) of (uv2vr_cfd) is (2),
(1) dimensions were expected

[2]
There are two WRF functions that calculate absolute vorticity

http://www.ncl.ucar.edu/Document/Functions/WRF_arw/wrf_user_getvar.shtml
http://www.ncl.ucar.edu/Document/Functions/Built-in/wrf_avo.shtml

EG:
    vo = wrf_user_getvar(a,"avo",-1) ; calculate avo for all times

[3]
WRF files contain the Coriolis parameter [ F ]

    F = a->F
    vo = vo - F ; relative vorticity

or
    vo = vo - a->F

=============

On 7/14/10 1:23 AM, Sahidul wrote:
> Dear NCL users,
>
> I am having WRF model outputs which are saved in 1 hourly. So each file
> contains only 1 time.
>
> I would like to calcuate "Relative Vorticity" using following script. It
> is showing error like:
> fatal:Number of dimensions in parameter (2) of (uv2vr_cfd) is (2), (1)
> dimensions were expected
> fatal:Execute: Error occurred at or near line 44 in file test_vort.ncl
>
> HERE line 44 is: vr = uv2vr_cfd (u_plane,v_plane,lat,lon, 3)
>
> ;==========script is here============
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
>
> begin
> datadir = "/WRF/output/"
> FILES = systemfunc ("ls -1 " + datadir + "wrfout_d02* " )
> numFILES = dimsizes(FILES)
>
> res = True
>
> pltres = True
> mpres = True
>
> do ifil = 0,numFILES-1
> a = addfile(FILES(ifil)+".nc","r")
>
> times = wrf_user_list_times(a)
>
> plevs = (/ 925., 850./)
> nlevels = dimsizes(plevs)
>
> ;;;===========================
> day = systemfunc("echo "+times +"|cut -c9-10")
> yr = systemfunc("echo "+times +"|cut -c1-4")
> mon = systemfunc("date '+%b'|tr [a-z] [A-Z]")
> hr = systemfunc("echo "+times +"|cut -c12-13")
> ;;;===========================
>
> u = wrf_user_getvar(a,"ua",0)
> v = wrf_user_getvar(a,"va",0)
> p = wrf_user_getvar(a, "pressure",0)
>
> lat = wrf_user_getvar(a,"XLAT",0)
> lon = wrf_user_getvar(a,"XLONG",0)
>
> do level = 0,nlevels-1 ; LOOP OVER LEVELS
>
> pressure = plevs(level)
>
> u_plane = wrf_user_intrp3d(u,p,"h",pressure,0.,False)
> v_plane = wrf_user_intrp3d(v,p,"h",pressure,0.,False)
>
> vr = uv2vr_cfd (u_plane,v_plane,lat,lon, 2)
>
> wks = gsn_open_wks("ps","vort_"+pressure+"hPa"+"_"+day+mon+yr+"_"+hr+"Z")
>
> vort = wrf_contour(a,wks,vr,res)
> plot = wrf_map_overlays(a,wks,vort,pltres,mpres)
>
> end do
> end do
> end
> ================================
>
> Kindly help me to solve it.
>
> Sahidul
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Jul 14 07:40:10 2010

This archive was generated by hypermail 2.1.8 : Mon Jul 19 2010 - 09:39:01 MDT