[ncl-talk] wind vectors outside of map

xiaoming Hu yuanfangcan at hotmail.com
Wed Dec 9 10:28:41 MST 2015


    Hello

I wanted to place two wind vector plots in one figure, see below.
For the 1st plot, the black wind vectors are nicely in the map, but for the 2nd plot, red wind vectors are everywhere in the wks. 
How can I control the wind vectors for the 2nd plot to be in the map?
         
Here is my script:

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/WRF_contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
begin

 do idomain =   2,2; 3,3; 1,1;3
  fmap = addfile("/nsftor1/xhu/2011SeptDFW/2011Aug_Irene/WRFV3.6.1/wrffnl2dWSM6_UCM_YSU.2011082500/wrfinput_d0"+idomain+".nc","r")
  figurename_xhu = "wrf_d0"+idomain+"_MADISmetarWindVector_24"; +nfiles 
  wks = gsn_open_wks("eps" ,figurename_xhu)           ; eps,pdf,x11,ncgm,eeps
  gsn_define_colormap(wks,"cosam") ; select color map
idate_pick = (/8, 27/)
do idaten = 0, 1; 7, 8 ;  31,31; 26,29
  idate = idate_pick(idaten)
  system("rm 2011*00")
  if (idate.gt.9) then 
  system("ln -sf /nsftor/xhu/WRF-UCM/MADIS/madis.201108/madis.201108"+idate+"/metar/2011*00 .")
  else 
  system("ln -sf /nsftor/xhu/WRF-UCM/MADIS/madis.201108/madis.2011080"+idate+"/metar/2011*00 .")
  end if 
  folder = "20110827"
  files = systemfunc("ls 2011*00")


do nfiles = 12,12; 0 ,   dimsizes(files)-1 

    filename =files(nfiles); 
    f=addfile(filename+".nc","r")


  file_site_char= stringtochar(filename)
  time_string = charactertostring (file_site_char(0:12))

  res                       = True             ; plot mods desired
res at vpWidthF              = 0.4
  if (idaten.eq.0) then
  res at pmLegendDisplayMode    = "Always"       ; create a legend
;  res at tiYAxisString         = "Ozone, ppbv"
   res at vpXF              =0.1
  res at tmYLLabelsOn = True
  else
  res at tmYLLabelsOn = False
  res at pmLegendDisplayMode    = "Never"       ; create a legend
;  res at tiYAxisString         = "Temperature, ~S~o~N~C"
   res at vpXF              =0.5069385706
  end if

;  res at gsnMaximize = True
  res at gsnPaperOrientation   = "portrait"

  WRF_map_c(fmap, res, 0)                   ; reads info from file
  res at tfDoNDCOverlay       = True      
  res at pmTickMarkDisplayMode = "Always"         ; turn on tickmarks
;  res at tmXTOn = False            ; turn off top   labels 
;  res at tmYROn = False            ; turn off right labels
  res at tmYRMajorOutwardLengthF = 0
  res at tmYLMajorOutwardLengthF = 0
  res at tmYLMinorOutwardLengthF = 0
  res at tmXBMajorOutwardLengthF = 0
  res at tmXBMinorOutwardLengthF = 0
res at tmYRLabelsOn = False
res at tmXTLabelsOn = False

  res at tmYLLabelStride = 2
  res at tmXBLabelStride = 2
  res at tmXBLabelFontHeightF = 0.0108
  res at tmYLLabelFontHeightF = 0.0108

      res at tiMainFuncCode = "~"
;       res at tiMainString     = "metar data at "+time_string 
       res at gsnLeftString    = "Wind Vector"
       res at gsnRightString    = "metar data at "+time_string 
       res at gsnFrame     = False
       res at gsnDraw                = False 
       plot                 = gsn_csm_map(wks,res)
;  draw(plot)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  lat  = f->latitude 
  lon  = f->longitude 
  WSP_obs = f->windSpeed
  WDR_obs = f->windDir
  rad = 4.0*atan(1.0)/180.
  U       = -WSP_obs*sin(rad*WDR_obs)
  V       = -WSP_obs*cos(rad*WDR_obs)
  wmsetp("wbs", .03)  ; Increase the size of the barb.
  wmsetp("ARS - arrow size",3.0)
;  wmsetp("vrn - size of reference vector on plot in NDC space", 0.03)
  wmsetp("vrs - size of reference vector in user space", 4.3)
  if (idomain.eq.1) then 
  wmsetp("vrn - size of reference vector on plot in NDC space", 0.015)
  else 
  wmsetp("vrn - size of reference vector on plot in NDC space", 0.02)
  end if 
  wmsetp("ARL - scale factor for length of arrow tail",3.)
;  wmsetp("vch - arrow head size",0.01)
  wmsetp("vch - arrow head size",0.0051)
if (idaten.eq.0) then
  wmsetp("vcc",1)
else
  wmsetp("vcc",11)
end if 
  wmsetp("vcw - linewidth scale",1.)
  wmvectmap(wks, lat, lon,  U, V)  ; Plot barbs.
;  wmvlbl(wks,0.8,0.3)
  wmvlbl(wks,0.295,0.3)
  draw(plot)
 delete(lat)
 delete(lon)
 delete(WSP_obs)
 delete(WDR_obs)
 delete(U)
 delete(V)
 end do ; nfiles
 end do ; idate

  frame(wks)    ; Advance the frame.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 
  print("finish "+figurename_xhu)
end do ; idomain
end


Thanks a lot!
Xiaoming  
  		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151209/f2a7afd3/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wrf_d02_MADISmetarWindVector_24.png
Type: image/png
Size: 645586 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151209/f2a7afd3/attachment-0001.png 


More information about the ncl-talk mailing list