[ncl-talk] Multiple Overlay Help

Kerwyn Texeira ktish86 at gmail.com
Sat Apr 2 21:08:14 MDT 2016


Hi ncl-talk,

 I trying to overlay both winds and frozen condensate with winds and I'm
having a hard time. I'm using gsn_gsm_contour and gsn_csm_vector for the
winds and gsn_csm_contour_map for the terrain. Any help will be greatly
appreciated.

Thanks,

Error message: warning:ContourPlotDraw: out of range coordinates
encountered; standard ORV rendering method may be unreliable;
 consider setting the resource trGridType to "TriangularMesh" if
coordinates contain missing values

Entire 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"

begin
   a = addfile("./wrfout_d03_2014-01-11_23:00:00.nc","r")

  it = 0
  hgt       = wrf_user_getvar(a, "HGT", it)
  hgt at lat2d = wrf_user_getvar(a, "XLAT", it)
  hgt at lon2d = wrf_user_getvar(a, "XLONG", it)
  u         = wrf_user_getvar(a, "ua", it)
  v         = wrf_user_getvar(a, "va", it)
  p         = wrf_user_getvar(a, "pressure", it)
  qc        = wrf_user_getvar(a, "QCLOUD", it)
  qc        = qc*1000
  qr        = wrf_user_getvar(a, "QRAIN", it)
  qr        = qr*1000
  qs        = wrf_user_getvar(a, "QSNOW", it)
  qs        = qs*1000
  qi        = wrf_user_getvar(a, "QICE", it)
  qi        = qs*1000

  u_wind    = wrf_user_intrp3d(u, p, "h", 600., 0.0, False)
  v_wind    = wrf_user_intrp3d(v, p, "h", 600., 0.0, False)
  qcl       = wrf_user_intrp3d(qc, p, "h", 600., 0.0, False)
  qrn       = wrf_user_intrp3d(qr, p, "h", 600., 0.0, False)
  qsn       = wrf_user_intrp3d(qs, p, "h", 600., 0.0, False)
  qice      = wrf_user_intrp3d(qi, p, "h", 600., 0.0, False)

   Melt_total = qcl + qrn;
   Froz_total = qsn + qice;

   spd = (u_wind*u_wind + v_wind*v_wind)^(0.5)  ;m/s
   u_wind = u_wind*1.94384449
   v_wind = v_wind*1.94384449

   u_wind at lon2d =   hgt at lon2d
   u_wind at lat2d =   hgt at lat2d

   v_wind at lon2d =   hgt at lon2d
   v_wind at lat2d =   hgt at lat2d

 ; spd = spd*1.94384449
 ; spd at units = "Wind Speed"
 ; spd at units = "kts"

    wks_type = "png"
    wks_type at wkWidth = 2500
    wks_type at wkHeight = 2500
    wks = gsn_open_wks(wks_type,"test")         ; send graphics to PNG file


; gsn_define_colormap(wks,"BlAqGrYeOrRe")
  gsn_define_colormap(wks,"matlab_jet")

  res = True
  res at gsnDraw      =  False                   ; do not draw the plot
  res at gsnFrame     =  False                   ; do not advance the frame
  res at cnLineLabelsOn       = False            ; do not use line labels
  res at cnFillOn             = True             ; color fill
  res at cnLinesOn            = False            ; do not draw contour lines



  res at tiMainString = ""
  res at pmTickMarkDisplayMode  = "Always"
  res at mpProjection  = "CylindricalEquidistant"    ;The default
  res at mpDataBaseVersion      = "MediumRes"
  res at mpOutlineOn            =True
  res at lbOrientation          = "Vertical"
  res at tiMainOffsetYF         = -0.03
  res at mpFillOn     = False
  res at mpOutlineOn  = True                  ; turn the map outline on
  res at mpMinLatF     = 37.60
  res at mpMaxLatF     = 38.50
  res at mpMinLonF     = -120.0
  res at mpMaxLonF     = -119.10
  res at gsnLeftString = ""
  res at gsnCenterString = "Winds (kts) at 600 hpa on Jan 11 at 23:00UTC"
  res at gsnStringFontHeightF = 0.025
  res at gsnRightString = ""
  res at gsnMaximize     = True
  res at mpShapeMode     = "FreeAspect"
  res at lbTitleString   = "Terrain (m)"
  res at lbTitlePosition = "Right"
  res at lbTitleDirection = "Across"
  res at lbTitleAngleF    = 90.
  res at lbTitleFontHeightF = 0.020


 ;------wind vectors
  res2 = True
  res2 at gsnDraw = False
  res2 at gsnFrame = False
  res2 at vcWindBarbLineThicknessF= 3.0
  res2 at vcRefLengthF= 0.018
  res2 at vcRefMagnitudeF= 10
  res2 at vcMinDistanceF = 0.05
  res2 at vcGlyphStyle = "WindBarb"
  res2 at gsnLeftString = ""
  res2 at gsnRightString = ""

;-------Frozen
res3 = True
res3 at cnLineColor = "Blue"
;res3 at ContourParameters = (/0.1/)
res3 at gsnContourLineThicknessesScale = 5.0
contour_solid = gsn_csm_contour(wks,Froz_total,res3)

;------Melted
res4 = True
res4 at cnLineColor = "Black"
res4 at gsnContourLineThicknessesScale = 5.0
contour_liquid = gsn_csm_contour(wks,Melt_total,res4)



contour = gsn_csm_contour_map(wks,hgt,res)
vector = gsn_csm_vector(wks,u_wind,v_wind,res2)
overlay(contour, vector)
overlay(contour, contour_solid)

plres = True
plres at gsLineColor = "blue"
plres at gsLineThicknessF = 3.0

lat = (/38.05, 38.05/)
lon = (/-120.10, -119.10/)

plot = gsn_add_polyline(wks,contour,lon,lat,plres)

draw(contour)
frame(wks)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160402/d7c29116/attachment.html 


More information about the ncl-talk mailing list