[ncl-talk] overlaying multiple layers on a map

Joe Grim grim at ucar.edu
Thu Oct 12 12:30:41 MDT 2017


That was it!  Thank you very much, Alan!  I had been spinning my wheels on
this for days.

Joe

On Thu, Oct 12, 2017 at 12:27 PM, Alan Brammer <abrammer at albany.edu> wrote:

> Hey Joe,
>
> Think you just need to use vfXArray and vfYArray instead of the commented
> sfXArray, sfYArray for res_vec.
> v for vector, s for scalar.
>
> Quick test with that shows they all overlay as expected with those 2
> resources.
>
>
>
> Alan
>
>
>
>
>
>
> On Thu, Oct 12, 2017 at 1:26 PM, Joe Grim <grim at ucar.edu> wrote:
>
>> Hi,
>>
>> I am in the midst of creating a suite of operational weather plots for
>> the ATEC project I am working on.  We are replacing RIP plots with NCL
>> plots, since NCL is much more versatile.  I need the scripts to be as
>> flexible as possible, since there are a wide variety of plots.  Therefore,
>> I am drawing each layer of a plot and overlaying them.  For example, in the
>> plot I am trying to create, there is a map, shaded contour plot, solid
>> contour lines, dashed contour lines, and wind barbs.  It all plots
>> perfectly, except for the wind barbs are missing.  I have tried to use
>> numerous examples on the NCL website as templates, and then adapting them,
>> but none of them will draw the wind barbs either.  I am trying to avoid
>> using plotting functions that plot scalars and vectors within the same
>> function, so the plotting system can be as flexible as possible.
>>
>> Here is my script.  The input file is on my website, here:
>> http://joeandfrede.com/ncl/wrfout_d01_2017-09-23_12_00_00.RTC_P+FCST.
>> Could someone tell me what I am missing or doing wrong?  Thanks on my part,
>> and the whole ATEC project.
>>
>> Joe
>>
>> ; This script is used to test ideas for plotting in NCL
>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>> begin
>>  PlotType = "png"
>>  in_file = "wrfout_d01_2017-09-23_12:00:00.RTC_P+FCST"
>>  ncdf_in = addfile(in_file+".nc","r")
>>  times  = wrf_user_list_times(ncdf_in)  ; get times in the file
>>  ntimes = dimsizes(times)         ; number of times in the file
>>  T2    = wrf_user_getvar(ncdf_in,"T2",0)
>>  rh2   = wrf_user_getvar(ncdf_in,"rh2",0)
>>  XLAT  = wrf_user_getvar(ncdf_in,"XLAT",0)
>>  XLONG = wrf_user_getvar(ncdf_in,"XLONG",0)
>>  U10   = wrf_user_getvar(ncdf_in,"U10",0)
>>  V10   = wrf_user_getvar(ncdf_in,"V10",0)
>>  slp   = wrf_user_getvar(ncdf_in,"slp",0)
>>  dims       = dimsizes(XLAT)
>>  nlat       = dims(0)
>>  nlon       = dims(1)
>>
>> ; Create plot
>>  PlotName = "T2_RH2_WND10_v2"
>>  wks = gsn_open_wks(PlotType,PlotName)
>>  gsn_define_colormap(wks,"BlAqGrYeOrReVi200")
>>
>>  res_sha = True
>>  res_sha at cnFillOn = True
>>  res_sha at gsnDraw    = False
>>  res_sha at gsnFrame   = False
>>  res_sha at gsnSpreadColors = True
>>  res_sha at cnInfoLabelOn = False
>>  res_sha at sfXArray  = XLONG
>>  res_sha at sfYArray  = XLAT
>>
>>  res_con = True
>>  res_con at cnLineColor = "NavyBlue"
>>  res_con at cnLineThicknessF = 3
>>  res_con at gsnDraw    = False
>>  res_con at gsnFrame   = False
>>  res_con at cnInfoLabelOn = False
>>  res_con at gsnLeftStringOrthogonalPosF = 0.05
>>  res_con at gsnRightStringOrthogonalPosF = 0.05
>>  res_con at sfXArray  = XLONG
>>  res_con at sfYArray  = XLAT
>>
>>  res_dash = True
>>  res_dash at cnLineColor = "red4"
>>  res_dash at cnLineThicknessF = 3
>>  res_dash at gsnContourPosLineDashPattern = 1
>>  res_dash at gsnDraw    = False
>>  res_dash at gsnFrame   = False
>>  res_dash at cnInfoLabelOn = False
>>  res_dash at gsnLeftStringOrthogonalPosF = 0.1
>>  res_dash at gsnRightStringOrthogonalPosF = 0.1
>>  res_dash at sfXArray  = XLONG
>>  res_dash at sfYArray  = XLAT
>>
>>  res_vec = True
>>  res_vec at gsnDraw    = False
>>  res_vec at gsnFrame   = False
>>  res_vec at vcGlyphStyle    = "WindBarb"
>>  res_vec at vcMinDistanceF  = 0.02
>>  res_vec at vcRefLengthF  = 0.02
>>  res_vec at gsnLeftStringOrthogonalPosF = 0.15
>>  res_vec at gsnRightStringOrthogonalPosF = 0.15
>>  res_vec at vcRefAnnoOn      = False
>>  res_vec at vcMinFracLengthF = 0.2
>>  ;res_vec at vcVectorDrawOrder        = "Postdraw"
>>  ;res_vec at sfXArray  = XLONG
>>  ;res_vec at sfYArray  = XLAT
>>
>>  res_map = True
>>  res_map at gsnDraw    = False
>>  res_map at gsnFrame   = False
>>  res_map at mpLimitMode         = "Corners"             ; corner method of
>> zoom
>>  res_map at mpLeftCornerLatF    = XLAT(0,0)            ; left corner
>>  res_map at mpLeftCornerLonF    = XLONG(0,0)            ; left corner
>>  res_map at mpRightCornerLatF   = XLAT(nlat-1,nlon-1)  ; right corner
>>  res_map at mpRightCornerLonF   = XLONG(nlat-1,nlon-1)  ; right corner
>>  res_map at mpProjection        = "LambertConformal"    ; choose projection
>>  res_map at mpLambertParallel1F = ncdf_in at TRUELAT1
>>  res_map at mpLambertParallel2F = ncdf_in at TRUELAT2
>>  res_map at mpLambertMeridianF  = ncdf_in at STAND_LON
>>  res_map at tfDoNDCOverlay      = True                  ; native grid, no
>> transform
>>  ;res_map at mpOutlineDrawOrder     = "Predraw"
>>  ;res_map at mpFillDrawOrder        = "Predraw"
>>  res_map at mpFillOn            = False
>>
>>  plot_sha = gsn_csm_contour(wks,T2,res_sha)
>>  plot_con = gsn_csm_contour(wks,rh2,res_con)
>>  plot_dash = gsn_csm_contour(wks,slp,res_dash)
>>  plot_vec = gsn_csm_vector(wks,U10,V10,res_vec)
>>  plot_map = gsn_csm_map(wks,res_map)
>>   ;res_map = res_vec
>>   ;plot_map = gsn_csm_vector_map(wks,U10,V10,res_map)
>>
>>  overlay(plot_map,plot_sha)
>>  overlay(plot_map,plot_con)
>>  overlay(plot_map,plot_dash)
>>  overlay(plot_map,plot_vec)
>>
>>  draw(plot_map)
>>  frame(wks)
>>
>>  print("Created plot: "+PlotName+"."+PlotType)
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20171012/8c5fcf79/attachment.html>


More information about the ncl-talk mailing list