
;; Empty NCL template
;; run code in recipes, use it carefully

;;DIAG_NORCPM; RUNTHESECODES: print("    no ncl code run here")

begin
figfilename="rhisto_NINO34"
histo1d = asciiread("rhisto_NINO34.txt",-1,"float")
histo = onedtond(histo1d,(/36,31/))
dims = dimsizes(histo)
nbin = dims(1)
nt   = dims(0)
;; for nt,nmem+1
bins = ispan(1,nbin,1)

do t = 0,nt-1
    histo(t,:) = histo(t,:)/sum(histo(t,:))
end do
res = True
    res@gsnXYBarChart = True
    res@vpWidthF = 0.7
    res@vpHeightF = 0.3
    res@trYMinF = 0.00
    res@trYMaxF = 0.21
    res@trXMinF = -0.4
    res@trXMaxF = nbin+0.6
    res@gsnXYBarChartBarWidth = 0.50                 ; change bar widths
    res@tmXBMode  = "Explicit"
    res@tmXBLabels  = bins
    res@tmXBValues  = bins
    res@tmXTOn = False
    res@gsnXYBarChartColors  = "Gray"
    res@tiMainString = "SSTa NINO34 rank histogram"
    res@gsnLeftString = "NINO34"
    res@gsnRightString = ""
    res@gsnLeftString = where(res@gsnLeftString.eq."","NINO34",res@gsnLeftString)
do t = 0,nt-1
    figfn = figfilename+"_t"+sprinti("%2.2d",t+1)
    wks = gsn_open_wks("ps",figfn)
    plot = gsn_csm_xy(wks,bins,histo(t,:) ,res)
end do
end


