[ncl-talk] My script does not work

Kerwyn Texeira ktish86 at gmail.com
Sun Mar 13 16:12:50 MDT 2016


Hi All,

For a month now I have been having trouble overlay windbards on zoomed
terrain with specified lat and lon in ncl. I do not want the entire domain
plotted with winds.  If so, I would have used the multiOverlay.ncl script
which works perfectly for many overlay for the entire domain.  No images
are being plotted with the script below. I'm not getting any fatal errors.
I'm using NCL version 6.2.1.   All I'm getting is the following;
warning:wkImageFileName is not a resource in the given object
warning:wkImageFormat is not a resource in the given object.

 I would like some help with this script please.  I looked online for a
script to help with this (overlay on zoomed in terrain with specified lat
and lon) but I’m having trouble finding it.  Any advice will be greatly
appreciated. Thanks, Kerwyn

Script:

;*************************************************
; overlay_1.ncl
;
; Concepts illustrated:
;   - Overlaying line contours on filled contours
;   - Explicitly setting contour levels
;   - Selecting a different color map
;
;*************************************************
;
; These files are loaded by default in NCL V6.2.0 and newer
 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_21: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)

  u_wind    = wrf_user_intrp3d(u, p, "h", 650., 0.0, False)
  v_wind    = wrf_user_intrp3d(v, p, "h", 650., 0.0, False)


;  spd       = (u_wind*u_wind + v_wind*v_wind)^(0.5)  ;m/s
;  spd at units = "Wind Speed"
;  spd at units = "m/s"


  wks = gsn_open_wks("png","test")         ; send graphics to PNG file
  gsn_define_colormap(wks,"BlAqGrYeOrRe")


  res1 = True
  res1 at mpFillOn     = False
  res1 at mpMaxLatF    = 37.75                      ; specify the plot domain
  res1 at mpMinLatF    = 38.20                      ;
  res1 at mpMinLonF    = -120.00                     ;
  res1 at mpMaxLonF    = -119.10                     ;
  res1 at mpOutlineOn  = True                  ; turn the map outline on
  res1 at gsnDraw      =  False                   ; do not draw the plot
  res1 at gsnFrame     =  False                   ; do not advance the frame
  res1 at csnLinesOn   =  True
  res1 at tiMainString  = a

  res1 at mpProjection  = "CylindricalEquidistant"    ;The default
  res1 at pmTickMarkDisplayMode  = "Always"
  res1 at mpDataBaseVersion      = "MediumRes"
  res1 at mpOutlineOn            =True
  res1 at lbOrientation          = "Vertical"
  res1 at tiMainOffsetYF         = -0.03
  res1 at mpShapeMode            = "FreeAspect"
  res1 at vpWidthF               = 0.9
  res1 at vpHeightF              = 0.9

;  res at cnLevelSelectionMode = "ExplicitLevels" ; use explicit levels
;  res at cnLevels             = ispan(215,265,5) ; set the contour levels
  res1 at cnLineLabelsOn       = False            ; do not use line labels
  res1 at cnFillOn             = True             ; color fill
  res1 at cnLinesOn            = False            ; do not draw contour lines
;  res at cnFillPalette        = "BlueDarkRed18"

  res1 at gsnAddCyclic         = False

  map = wrf_map(wks, a, True)

  contour = gsn_csm_contour_map(wks,hgt,res1)

 ;------wind vectors
 res2 = True
 res2 at FieldTitle = "Winds"
 res2 at NumVectors = 47
 res2 at vcWindBarbLineThicknessF= 2.5
 vector = wrf_vector(a, wks, u_wind, v_wind, res2)

 wrf_map_overlay(wks,map,(/vector, contour/),True)

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


More information about the ncl-talk mailing list