[ncl-talk] Help in Plotting

Arun Kumar Dwivedi dwivedi.arunkumar at gmail.com
Mon Oct 5 06:16:09 MDT 2015


Hello Everyone,
I need to modify the interval on x and y axes according to my necessity but
I am not able to do that. I have attached the screenshot of my ncl window
and my is my code is as following:


load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"      ;Load the
required library files
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"

begin                                                         ;NCL script
always start with 'begin'

  a = addfile("wrfout_d01_2014-08-08_00.nc","r")              ;Loads the
required nc file

; Type of plot outputfile
;type = "x11"
; type = "pdf"
; type = "ps"
; type = "ncgm"
 type = "png"
;type at wkWidth = 600
;type at wkHeight = 800
  wks = gsn_open_wks(type,"final_gsn")                     ; Create op plot
file with name


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; First get the variables we will need
tk2 = wrf_user_getvar(a,"HGT",0)     ; T2 in Kelvin
tc2 = tk2-273.16                  ; T2 in C
lat = wrf_user_getvar(a,"XLAT",0)
lon = wrf_user_getvar(a,"XLONG",0)
;print(lat(:,0)) ;all lat values
;print(lon(0,:)) ;all lon values

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Plotting options for T
res = True
res at gsnDraw      = False             ;Don't draw yet
  res at gsnFrame     = False ;Don't advance the frame(plot file will create
but nothing will draw)
res at gsnSpreadColors       = True       ; use full range of colormap
res at gsnMaximize          = True   ;maximize plot in frame
res at cnFillOn = True   ;Turn On the contour color
res at cnLinesOn = False ;Turn Off the contour lines

res at lbTitleOn = False ;Turn off the color bar text
res at lbOrientation = "Vertical" ;color bar orientation

;res at pmLabelBarSide = "Right" ;color bar position
res at pmTickMarkDisplayMode = "Always"

res at mpGridAndLimbOn = False
res at mpOutlineOn = False  ;NCL Map outline off(Outline taking from shapefile)
res at mpFillOn    = False
;res at mpTickMarkDisplayMode = "Never" ;put it off otherwise some tick marks
reqources will not work


;Necessary for contours to be overlaid correctly on WRF projection
  res at tfDoNDCOverlay       = True
  ;res at gsnAddCyclic         = True

res at tiMainString         = "Terrain Height (m)  "
res at tiMainFontHeightF     =  0.03
; res at tmEqualizeXYSizes = True ;share the same label font height and major
and minor tick lengths
  res at tmXBOn = True
  res at tmYLOn = True
res at tmXBMode      = "Manual"   ; Define your own tick mark labels.
res at tmYLMode      = "Manual"   ; Define your own tick mark labels.
;res at tmXBLabelFontColor = 1 ; Change the color of the x-axis
res at tmXBLabelAngleF = 0 ; Change the angle on x-axis (bottom) values
  res at tmXBLabelFont = 0           ; Change font of labels.
  res at tmYLLabelFont = 0           ; Change font of labels.
res at tmXBLabelFontHeightF =0.015 ; Change font height of labels.
res at tmYLLabelFontHeightF =0.02 ; Change font height of labels.
;res at tmXBLabelFontAspectF = 1.3
res at tmXBLabelFontThicknessF = 5
res at tmYLLabelFontThicknessF = 5

res at tmXBTickStartF = min(lon(0,:))
res at tmXBTickEndF = max(lon(0,:))
res at tmXBTickSpacingF = 2
res at tmYLTickStartF = min(lat(:,0))
res at tmYLTickEndF = max(lat(:,0))
res at tmYLTickSpacingF = 2



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

;Set map resources based on projection on WRF output file
  res = wrf_map_resources(a,res)
contour_tc = gsn_csm_contour_map(wks,tc2,res)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Attach shapefile polylines to map
lnres = True
lnres at NoHeaderFooterOn = True
lnres at gsLineColor      = "Black"
  lnres at gsLineThicknessF = 3.0

  poly = gsn_add_shapefile_polylines(wks,contour_tc,"india_state.shp",lnres)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Now everything will be drawn
draw(contour_tc)
frame(wks)

end


Kindly help me.
Thanks & Regards
Arun Kumar Dwivedi,
Mob :09546189035
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151005/3adf8396/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot.png
Type: image/png
Size: 80631 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151005/3adf8396/attachment.png 


More information about the ncl-talk mailing list