[ncl-talk] No map overlay in wrf_gsn_4.ncl and wrf_nogsn_4.ncl

Zilore Mumba zmumba at gmail.com
Thu Aug 26 01:55:51 MDT 2021


I have a basic problem that the scripts in wrf_gsn and wrf_nogsn do not
overlay maps. I paste below the script for wrf_nogsn_4.ncl. I have tried to
put some resources like res at cnFillDrawOrder = "PreDraw" and other related
resources (commented out in the attached text). These have no effect.
I wonder if the map overlay works in these scripts.
Thanks.
;----------------------------------------------------------------------
; wrf_nogsn_4.ncl
;----------------------------------------------------------------------

begin
;---Open WRF output file
  filename =
"/home/zmumba/DA/OUTPUT/2021081900/noda/wrfout_d01_2021-08-19_00:00:00"
  a        = addfile(filename +".nc","r")

;---Read temperature at first time step
  tc = wrf_user_getvar(a,"tc",0)

  lat2d = wrf_user_getvar(a,"XLAT",0)   ; latitude
  lon2d = wrf_user_getvar(a,"XLONG",0)  ; longitude

  wks = gsn_open_wks("x11","wrf_nogsn")

  pltres = True
  mpres  = True

 ;---Set special resource to indicate we are using XLAT/XLONG coordinates.
  ;pltres at LatLonOverlay = True

 ;---Resources for filled contour plot
  res                   = True

  res at gsnMaximize     = True
  res at cnFillOn        = True
  res at cnLinesOn       = False
  ;res at tfDoNDCOverlay  = True          ; This is necessary if you don't set
sfXArray/sfYArray
  ;res at cnFillDrawOrder = "PreDraw"
  ;res at cnLineDrawOrder = "PreDraw"
  ;res at gsnDraw         = False         ; don't draw yet
  ;res at gsnFrame        = False         ; don't advance yet

  res at cnFillOn          = True
  res at ContourParameters = 2.      ; Change the spacing

 ;---Zoom in on map and plot again
  res at cnLineThicknessF = 2            ; make lines thicker, Default: 1
  res at mpMinLatF      = -18.   ; zoom in on lat/lon area
  res at mpMaxLatF      =  -8.
  res at mpMinLonF      =  21.
  res at mpMaxLonF      =  34.

  nl   = 0    ; bottomost level
  contour = wrf_contour(a,wks,tc(nl,:,:),res)

 ;---Overlay plot on map and draw.
  ;plot = wrf_map_overlays(a,wks,contour,True,True)
  plot = wrf_map_overlays(a,wks,(/contour/),pltres,mpres)

 ;Define shapefiles
 ;*****************
  shp_filename =
("/home/zmumba/DA/TMINTMAX2/Shapefiles/Zambia/ZMB_ADM1.shp")

 ;Set shapefile resources
 ;***********************
  shpres                    =  True
  shpres at gsLineThicknessF   =  1             ; increase line thickness
  shpres at gsLineColor        =  "Black"       ; line colorgsLineThicknessF
  shpres at gsLineDashPattern  =  1

  shp= gsn_add_shapefile_polylines(wks,plot,shp_filename,shpres)

  ;draw(plot)
  ;frame(wks)

end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210826/faf657f2/attachment.html>


More information about the ncl-talk mailing list