Angle represented in a CrossSection figure

From: Yan Bao <ybao2009_at_nyahnyahspammersnyahnyah>
Date: Fri Nov 04 2011 - 00:22:28 MDT

Hi, NCL group,
      I've been tried to make a CrossSection figure along the instant wind
direction (angle), but found
the angle I calculated was unproperly represented in the figure when the
wind direction were greater than
315 degree, which makes me so confused. For instance, in the figure
(attachment) the angle I calculated was
322 degree which is supposed to point northwest direction (red arrow), but
actually it was shown in the
figure with southwest direction (red line).I'm not sure if I did something
wrong or something else happened.
 Here I post part of my script related and the figure, hope any one who
knows about it can give me some
 suggestions. Thanks.

 dir="/OUTPUT/"
 fn = "wrfout_d01_2008-06-07_00:00:00.nc"
 a = addfile(dir+fn,"r")
wks = gsn_open_wks("pdf","test")
  xlat = wrf_user_getvar(a, "XLAT",0)
  xlon = wrf_user_getvar(a, "XLONG",0)
  ter = wrf_user_getvar(a, "HGT",0)

; Set some basic resources
  res = True
  res@Footer = False
  res@vpWidthF = 0.75 ; overwrite basic plot size
  res@vpHeightF = 1.0
  pltres = True

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  FirstTime = True
  FirstTimeMap = True
  times = wrf_user_list_times(a) ; get times in the file
  ntimes = dimsizes(times) ; number of times in the file
  xlat = wrf_user_getvar(a, "XLAT",0)
  xlon = wrf_user_getvar(a, "XLONG",0)
  ter = wrf_user_getvar(a, "HGT",0)
  do it = 7,7,1 ; TIME LOOP
  print("Working on time: " + times(it) )
  res@TimeLabel = times(it) ; Set Valid time to use on plots
  pm10 = wrf_user_getvar(a,"PM10",it) ; T in C
  uvm = wrf_user_getvar(a,"uvmet",it) ; umet and vmet averaged to
mass points

  u = uvm(0,:,:,:)
  v = uvm(1,:,:,:)

   y1 = 28
   x1 = 7
   plane = (/y1,x1/)

        opts = False
        r2d = 45.0/atan(1.0) ; conversion factor (radians to degrees)

        u1 = u(0,y1,x1)
        v1 = v(0,y1,x1)
        angle = atan2(u1, v1) * r2d + 180 ; ===> dir = 225.0
        print(angle) ; 322
        ....
         ; MAKE PLOTS
       plot = new(10,graphic)
if (FirstTimeMap) then
          lat_plane = wrf_user_intrp2d(xlat,plane,angle,opts)
          lon_plane = wrf_user_intrp2d(xlon,plane,angle,opts)
          mpres = True
          pltres = True
          pltres@FramePlot = False
          optsM = res
          optsM@NoHeaderFooter = True
          optsM@cnFillOn = True
          optsM@lbTitleOn = False
          contour = wrf_contour(a,wks,ter,optsM)
          plot(0) = wrf_map_overlays(a,wks,(/contour/),pltres,mpres)
          lnres = True
          lnres@gsLineThicknessF = 3.0
          lnres@gsLineColor = "Red"
          do ii = 0,dimsX(0)-2

gsn_polyline(wks,plot(0),(/lon_plane(ii),lon_plane(ii+1)/),(/lat_plane(ii),lat_plane(ii+1)/),lnres)
          end do
          frame(wks)
          delete(lon_plane)
          delete(lat_plane)
          pltres@FramePlot = True
 end if
end do

 Yan

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

Screen_shot_2011-11-04_at_12.20.09_AM.png
Received on Fri Nov 4 00:22:39 2011

This archive was generated by hypermail 2.1.8 : Fri Nov 04 2011 - 08:43:41 MDT