Re: zero vector field error

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Tue Jan 10 2012 - 10:20:14 MST

JinQ,

The error is telling you exactly what the problem is. You have a vector field that is all zero. Please check that you are computing the mean and magnitude correctly, and that the data for the calculation is also correct. Use statements like:

   printVarSummary(u)
   print("min/max u = " + min(u) + "/" + max(u))

to verify that your missing value is correct, that the units are what you expect, and that your min/max values look reasonable.

--Mary

On Jan 10, 2012, at 12:15 AM, JinQ Liu wrote:

> hi,
> I want to get the mean vector between 2 layers , so i create a new u,v to see the mean direction and magnitude. while the script error is as follows:
>
> warning:StreamlinePlotInitialize: zero vector field; StreamlinePlot not possible:[errno=1103]
>
> Any suggestions will be appreciate. Thanks
> JinQ
>
> --
> JinQ, M.S.
> Ocean University of China
> --
>
> scripts:
>
> 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/csm/contributed.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
>
> begin
> ;
> ; The WRF ARW input file.
> ; This needs to have a ".nc" appended, so just do it.
> a = addfile("wrfout_d03_20 10-09-09_12:00:00o.nc","r")
>
> type = "pdf"
> ; type = "eps"
>
> wks = gsn_open_wks(type,"mean")
>
> ; Set some basic resources
> res = True
>
> res@gsnMaximize=True
> res@gsnDraw = False ; let gsn_panel do plotting
> res@gsnFrame = False
> ;res@pmTickMarkDisplayMode="Always"
> res@tmXBTickSpacingF= 2
> res@tmYLTickSpacingF= 2
> res@tmXBLabelFontHeightF=0.025
> res@tmYLLabelFontHeightF=0.025
> res@tmXBMinorOn = False ; no lon minior tickmarks
> res@tmYLMinorOn = False
>
> res@mpDataSetName = "E arth..4"
> res@mpDataBaseVersion = "MediumRes"
> res@mpOutlineSpecifiers = (/"China:states","India","Taiwan"/)
> res@mpLimitMode = "LatLon"
> res@mpMinLatF = 22
> res@mpMaxLatF = 28.1
> res@mpMinLonF = 115.7
> res@mpMaxLonF = 120.7
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> times = wrf_user_list_times(a) ; get times in the file
> ntimes = dimsizes(times) ; number of times in the file
>
> ; The specific pressure levels that we want the data interpolated to.
> pressure_levels = (/ 850., 200./ ) ; pressure levels to plot
> nlevels = dimsizes(pressure_levels) ; number of pressure levels
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
> do it = 12,ntimes-36,12 ; TIME LOOP
> print("Working on time: " + times(it) )
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> u = wrf_user_getvar(a,"ua",it) ; u averaged to mass points
> v = wrf_user_getvar(a,"va",it) ; v averaged to mass points
> p = wrf_user_getvar(a, "pressure",it) ; pressure is our vertical coordinate
> z = wrf_user_getvar(a, "z",it)&n bsp; ; grid point height
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
> pressure0 = pressure_levels(0)
> pressure1 = pressure_levels(1)
> ; z_plane = wrf_user_intrp3d( z,p,"h",pressure,0.,False)
> u_plane0 = wrf_user_intrp3d( u,p,"h",pressure0,0.,False)
> v_plane0 = wrf_user_intrp3d( v,p,"h",pressure0,0.,False)
> u_plane1 = wrf_user_intrp3d( u,p,"h",pressure1,0.,False)
> v_plane1 = wrf_user_intrp3d( v,p,"h",pressure1,0.,False)
>
> u_planeb=wgt_areaave(u_plane1,1.,1.,0)-wgt_areaave(u_plane0,1.,1.,0)
> v_planeb=wgt_areaave(v_plane1,1.,1.,0)-wgt_areaave(v_plane0,1.,1.,0)
>
> u_plane=new(dimsizes(u_plane0),float)
> v_plane=new(dimsizes(v_plane0),float)
> copy _VarMeta(u_plane0,u_plane)
> copy_VarMeta(v_plane0,v_plane)
> u_plane=(/u_planeb/)
> v_plane=(/v_planeb/)
>
> u_plane = u_plane*1.94386 ; kts
> v_plane = v_plane*1.94386 ; kts
> u_plane@units = "kts"
> v_plane@units = "kts"
>
> lat2d=a->XLAT(0,:,:)
> lon2d=a->XLONG(0,:,:)
> u_plane@lat2d=lat2d
> u_plane@lon2d=lon2d
> v_plane@lat2d=lat2d
> v_plane@lon2d=lon2d
>
> ; Plotting options for Wind Vectors
> opts = res
> opts@vcGlyphStyle = "CurlyVector"
> opts@vcMinDistanceF &nbs p; =0.02
> opts@vcRefLengthF = 0.045
> ; opts@vcRefMagnitudeF = 20.0
> opts@vcRefAnnoOrthogonalPosF = -1.
>
> vector = gsn_csm_vector_map_ce(wks,u_plane,v_plane,opts)
> draw(vector)
> delete(opts)
>
> frame(wks)
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
> end do ; END OF TIME LOOP
>
> end
>
>
>
> _______________________________________________
> 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 Tue Jan 10 10:20:26 2012

This archive was generated by hypermail 2.1.8 : Wed Jan 18 2012 - 09:21:55 MST