[ncl-talk] Help in Plotting

Mary Haley haley at ucar.edu
Tue Oct 6 09:59:47 MDT 2015


[In the future, please respond back to ncl-talk with follow-up emails,
unless we purposely take the conversation offline.]

If you are certain that the map projection for your WRF data is cylindrical
equidistant, then please see example mptick_7.ncl.  You are better off
using a tmXBMode and tmYLMode of "Explicit" and then setting your own
tickmark locations and tickmark labels via tmXBValues / tmXBLabels /
tmYLValues / tmYLLabels.  This example shows you how to do that.

--Mary


On Mon, Oct 5, 2015 at 10:18 PM, Arun Kumar Dwivedi <
dwivedi.arunkumar at gmail.com> wrote:

> Hello Mary,
> I am having map projection "CE". I do not want to add my own tickmarks. Is
> there any way to enable tmXB/tmYL to modify them.
>
> On Mon, Oct 5, 2015 at 8:07 PM, Mary Haley <haley at ucar.edu> wrote:
>
>> Arun,
>>
>> Map tickmarks are very limited, and the tmXB / tmYL resources are
>> disabled for most map projections.
>>
>> You didn't say what kind of map projection you have, but you should visit
>> our map tickmarks examples page to see ways that you can add your own
>> tickmarks to projections other than standard lat/lon:
>>
>> http://www.ncl.ucar.edu/Applications/mptick.shtml
>>
>> In particular, look at examples mptick_9.ncl, and maybe the two after
>> this.
>>
>> --Mary
>>
>>
>> On Mon, Oct 5, 2015 at 6:16 AM, Arun Kumar Dwivedi <
>> dwivedi.arunkumar at gmail.com> wrote:
>>
>>> 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
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk at ucar.edu
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>>
>>
>
>
> Thanks
> Arun Kumar Dwivedi,
> Mob :09546189035
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151006/d007b73e/attachment.html 


More information about the ncl-talk mailing list