[ncl-talk] Issue Converting Year Fractions to Months

Zach Rieck zrr817 at gmail.com
Wed May 22 21:29:04 MDT 2019


To Whom it May Concern-

I've created a panel of plots and want the x-axis to simply be months.
These months need to be non-sequential in number order since I need
November, December, January, February, and March in that order. It's ok if
these months are tied to a year if necessary. The dates I am using are in
yyyymmdd format, and I have converted them to year fractions as suggested
in the online documentation. When I try using resources to convert this to
month strings though I get a resource warning.

I'll attach my whole script, but I've pasted my plotting section below to
keep things simple since I'm guessing it's just an issue I can fix with
some syntax changes.

Thanks for the help!

 wks = gsn_open_wks("pdf", "Pine_Creek")
    plots = new(12,graphic)
    res          = True
    res at gsnDraw  = False                          ; don't draw
    res at gsnFrame = False                          ; don't advance frame
    res at cnInfoLabelOn = False                     ; turn off cn info label
    colors = (/"blue","red"/)
    res at tmXBMode     = "Explicit"
    res at tmXBValues   = (/"Nov","Dec","Jan","Feb","Mar"/)
    res at tmXBLabels   = res at tmXBValues
    res at xyLineColors   = colors
    res at tiXAxis = "Year"
    res at tiYAxis = "LPE (mm)"

    plots(0) = gsn_csm_xy(wks,yfrac,sums1,res)
    plots(1) = gsn_csm_xy(wks,yfrac,sums2,res)
    plots(2) = gsn_csm_xy(wks,yfrac,sums3,res)
    plots(3) = gsn_csm_xy(wks,yfrac,sums4,res)
    plots(4) = gsn_csm_xy(wks,yfrac,sums5,res)
    plots(5) = gsn_csm_xy(wks,yfrac,sums6,res)
    plots(6) = gsn_csm_xy(wks,yfrac,sums7,res)
    plots(7) = gsn_csm_xy(wks,yfrac,sums8,res)
    plots(8) = gsn_csm_xy(wks,yfrac,sums9,res)
    plots(9) = gsn_csm_xy(wks,yfrac,sums10,res)
    plots(10) = gsn_csm_xy(wks,yfrac,sums11,res)
    plots(11) = gsn_csm_xy(wks,yfrac,sums12,res)

    resP                    = True                 ; modify the panel plot
    resP at gsnPanelMainString = "Pine Creek 38.88 N 112.25W elev 8790 ft"
; set main title
    gsn_panel(wks,plots,(/3,4/),resP)               ; now draw as one plot

-Zach Rieck
zrr817 at gmail.com
(513)-502-5652
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190522/1cc89fa7/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PineCreek_Comparrison.ncl
Type: application/octet-stream
Size: 12114 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190522/1cc89fa7/attachment.obj>


More information about the ncl-talk mailing list