Question on gsn_csm_vector_scalar_map (no map and filled contours are not seen), Thanks!

From: Xiaoming Sun <xiaoming.sun_at_nyahnyahspammersnyahnyah>
Date: Sun Feb 28 2010 - 18:37:37 MST

 
 Dear All,

 Thanks for reading this E-mail!

 I am using the function
 gsn_csm_vector_scalar_map
 to plot vector and scalar contour with map.

 However, I did not get any map and also the filled contours are not seen
but only a corner.

 Could you please give some help on this? Thanks!

 The PDF plotted out is attached to this E-mail.

 The following is the 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/WRFUserARW.ncl"
 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"

 begin

   ; specify domain
   Domain   = "d01"
   ; Domain   = "d02"

   ;++++++++++++++++++++++++++++++++++++++++++
   ; Part I: Read Results from Previous Steps
   ;++++++++++++++++++++++++++++++++++++++++++
   ; read arbitrary WRF output for:
   ; 1. topography (background plot)
   wrfOut =
addfile("/home/xs13/Results.WRF/05thWRFKubango/5th_f_Kubango/WRFPart/wrfout_"
+ Domain + "_2004-09-15_06:00:00.nc", "r")
   topo = wrfOut->HGT(0, :, :)
   WRF_Lat_NARR3Hrly = wrf_user_getvar(wrfOut, "XLAT",  0)
   WRF_Lon_NARR3Hrly = wrf_user_getvar(wrfOut, "XLONG", 0)
   ; read the results from Step2, for:
   ; 1. lat1d
   ; 2. lon1d
   ; 3. u_specPresLev_NARR3Hrly_YSU
   ; 4. v_specPresLev_NARR3Hrly_YSU
   ; 5. urgrid_NARR3Hrly_YSU
   ; 6. vrgrid_NARR3Hrly_YSU
   ; 7. vor_NARR3Hrly_YSU
   step2 =
addfile("/scratch/Manuscript/JHM_Nov2009_Feb2010/Fig14/Results/Step2/Fig14Step2_"
+ Domain + ".nc", "r")
   lat1d_step2 = step2->lat1d
   lon1d_step2 = step2->lon1d
   u_specPresLev_NARR3Hrly_YSU = step2->u_specPresLev_NARR3Hrly_YSU
   v_specPresLev_NARR3Hrly_YSU = step2->v_specPresLev_NARR3Hrly_YSU
   urgrid_NARR3Hrly_YSU        = step2->urgrid_NARR3Hrly_YSU
   vrgrid_NARR3Hrly_YSU        = step2->vrgrid_NARR3Hrly_YSU
   vor_NARR3Hrly_YSU           = step2->vor_NARR3Hrly_YSU
   ; read the results from Step 3, for:
   ; 1. lat1d (cutted in MATLAB already)
   ; 2. lon1d (cutted in MATLAB already)
   ; 3. phi (stream functio_n)
   ; 4. u_phi (u-component of non-divergent wind)
   ; 5. v_phi (v-component of non-divergent wind)
   step3 =
addfile("/scratch/Manuscript/JHM_Nov2009_Feb2010/Fig14/Results/Step3/Fig14Step3_Wind_Component_"
+ Domain + ".nc", "r")
   lat1d_phi         = step3->lat1d
   lon1d_phi         = step3->lon1d
   phi_NARR3Hrly_YSU   = step3->phi
   u_phi_NARR3Hrly_YSU = step3->u_phi
   v_phi_NARR3Hrly_YSU = step3->v_phi
  
   ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++
   ; Part II: Construct Latitude and Longitude Information
   ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++
   ; construct lat2d_phi and lon2d_phi and make them as attributes of
phi_NARR3Hrly_YSU
   dim = dimsizes(phi_NARR3Hrly_YSU)
   lat2d_phi = new((/dimsizes(lat1d_phi), dim(2)/), typeof(lat1d_phi))
   lon2d_phi = new((/dim(1), dimsizes(lon1d_phi)/), typeof(lon1d_phi))
   do m = 0, dim(2)-1
     lat2d_phi(:, m) = lat1d_phi
     lon2d_phi(m, :) = lon1d_phi
   end do
   phi_NARR3Hrly_YSU@lat2d = lat2d_phi
   phi_NARR3Hrly_YSU@lon2d = lon2d_phi
   delete(dim)
   ; construct lat2d_uvphi and lon2d_uvphi and make them as attributes of
u_phi_NARR3Hrly_YSU and v_phi_NARR3Hrly_YSU
   lat1d_uvphi = new(dimsizes(lat1d_phi)-1, typeof(lat1d_phi))
   do m = 0, dimsizes(lat1d_phi)-2
     lat1d_uvphi(m) = 0.5*(lat1d_phi(m)+lat1d_phi(m+1))
   end do
   lon1d_uvphi = new(dimsizes(lon1d_phi)-1, typeof(lon1d_phi))
   do m = 0, dimsizes(lon1d_phi)-2
     lon1d_uvphi(m) = 0.5*(lon1d_phi(m)+lon1d_phi(m+1))
   end do
   dim = dimsizes(u_phi_NARR3Hrly_YSU)
  
   lat2d_uvphi = new((/dimsizes(lat1d_uvphi), dim(2)/),
typeof(lat1d_uvphi))
   lon2d_uvphi = new((/dim(1), dimsizes(lon1d_uvphi)/),
typeof(lon1d_uvphi))
   do m = 0, dim(2)-1
     lat2d_uvphi(:, m) = lat1d_uvphi
     lon2d_uvphi(m, :) = lon1d_uvphi
   end do
   u_phi_NARR3Hrly_YSU@lat2d = lat2d_uvphi
   u_phi_NARR3Hrly_YSU@lon2d = lon2d_uvphi
   v_phi_NARR3Hrly_YSU@lat2d = lat2d_uvphi
   v_phi_NARR3Hrly_YSU@lon2d = lon2d_uvphi
   delete(dim)
  
   ;+++++++++++++++++++
   ; Part III: Plotting
   ;++++++++++++++++++++
   ; resources
   wks = gsn_open_wks("pdf", "Non_divergent_Wind_"+Domain)
   res_vs                          = True
   res_vs@gsnRightString           = ""
   res_vs@gsnLeftString            = ""
   res_vs@mpGeophysicalLineColor   = "black"
   res_vs@mpPerimOn                = False
   res_vs@mpGridAndLimbOn          = False
   res_vs@mpGridLineDashPattern    = 2
   res_vs@mpUSStateLineThicknessF  = 2.0
   res_vs@mpGeophysicalLineThicknessF = 2.0
   res_vs@mpOutlineBoundarySets  = "AllBoundaries"
   res_vs@mpUSStateLineColor     = "black"
   res_vs@cnFillOn               = True             
   res_vs@cnLinesOn              = False           
   res_vs@cnLineLabelsOn         = False            
   res_vs@gsnSpreadColors        = True             
   res_vs@cnInfoLabelOn          = False
   res_vs@pmTickMarkDisplayMode  = "Always"     
   res_vs@tmYROn                 = False
   res_vs@tmXTOn                 = False   
   res_vs@gsnAddCyclic           = False  
   res_vs@gsnFrame               = False
   res_vs@gsnDraw                = False
   res_vs@mpLimitMode            = "Corners" 
   res_vs@mpLeftCornerLatF       = WRF_Lat_NARR3Hrly(0, 0)
   res_vs@mpLeftCornerLonF       = WRF_Lon_NARR3Hrly(0, 0)
   res_vs@mpRightCornerLatF      = WRF_Lat_NARR3Hrly(269, 269)
   res_vs@mpRightCornerLonF      = WRF_Lon_NARR3Hrly(269, 269)
   res_vs@tfDoNDCOverlay         = False ; This one must be set to Fals_e
   res_vs@mpProjection           = "LambertConformal"
   res_vs@mpLambertParallel1F    = 25
   res_vs@mpLambertParallel2F    = 45
   res_vs@mpLambertMeridianF     = -83.073
   res_vs@tmXTLabelsOn           = False
   res_vs@vpWidthF               = 0.55
   res_vs@vpHeightF              = 0.55
   res_vs@lbLabelBarOn           = True
   res_vs@lbLabelFontHeightF     = 0.023
   res_vs@pmLabelBarHeightF      = 0.06
   res_vs@pmLabelBarWidthF       = 0.55
   res_vs@pmLabelBarOrthogonalPosF = 0.08
   res_vs@tmXBLabelFontHeightF = 0.025
   res_vs@tmYLLabelFontHeightF = 0.025
   res_vs@lbLabelAutoStride = True
   res_vs@gsnScalarContour        = True
   res_vs@cnFillOn                = True
   res_vs@cnLinesOn               = False         
   res_vs@gsnSpreadColors         = True
   ; res_vs@mpOutlineDrawOrder    = "PostDraw"        ; draw continental
outline last
   res_vs@vcRefMagnitudeF          = 0.
   res_vs@vcRefLengthF             = 0.05             ; define length of
vec ref
   res_vs@vcGlyphStyle             = "CurlyVector"    ; turn on curly
vectors
   res_vs@vcMinDistanceF           = 0.017            ; thin vectors
   res_vs@vcRefAnnoOrthogonalPosF  = .1               ; move ref vector
down

   ; plotting
   dimInfo = dimsizes(u_phi_NARR3Hrly_YSU)
   ntimes = dimInfo(0)
   do it = ntimes-1, ntimes-1
     print("Working on time " + it + ".")
     plot = gsn_csm_vector_scalar_map(wks, u_phi_NARR3Hrly_YSU(it, :, :),
v_phi_NARR3Hrly_YSU(it, :, :), phi_NARR3Hrly_YSU(it, :, :), res_vs)
     draw(plot)
     frame(wks)

   end do
  
 end

 Xiaoming

 

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

Received on Sun Feb 28 18:37:48 2010

This archive was generated by hypermail 2.1.8 : Mon Mar 01 2010 - 08:49:37 MST