[ncl-talk] Precipitation annual cycle

Dinuka Silva dinu.kera at gmail.com
Mon Feb 12 22:15:22 MST 2018


Hello,

I am trying to plot annual cycle of precipitation. I could plot it but I
have space after December. how can I remove that space?




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/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/diagnostics_cam.ncl"

begin
;----------------------------------------------------------------------
f    =  "mon.precip.nc"
f1   = addfile(f, "r")

time = f1->time
ymd = cd_calendar(time,2)
iTime = ind (ymd.ge.19790101.and.ymd.lt.20130101)
precip = f1->precip (iTime,{0:-12},{90:130})

Avg = dim_avg_Wrap(dim_avg_Wrap( precip(time|:,lat|:,lon|:)))
index = abs(Avg)
index!0 = "time"
index&time = Avg&time
;------------------------------------------------------------
T = index&time
YMD = cd_calendar(T,0)
imont = tointeger(YMD(:,1))
;-----------------------------------------------------------------------
k= new((/12/),float)
do mo = 0,11
mo1=mo+1
Nmont = ind(imont.eq.mo1)
k(mo) = dim_avg_Wrap(index(time|Nmont))
end do
;printVarSummary(k)
;---------------------------------------------------------------------
x = new((/12/),float)
x = (/00.,01.,02.,03.,04.,05.,06.,07.,08.,09.,10.,11./)
;--------------------------------------------------------------
res2                        = True
res2 at tiMainString           = "Monthly precipitation"
res2 at tiXAxisString          = "months"
res2 at tiYAxisString          = "precipitation (mm/month)"
res2 at xyLineColors           =  "blue"
res2 at xyLineThicknessF       =  5.0
res2 at tmXBMode               = "Explicit"
res2 at tmXBValues             = x
res2 at tmXBLabels    = (/"J","F","M","A","M","J","J","A","S","O","N","D"/)
;---------------------------------------------------------------------
wks = gsn_open_wks("x11","")
plot = gsn_xy(wks,x,k,res2)
end


[image: Inline image 1]


Thank you.

Sincerly,
Dinuka


<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon>
Virus-free.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180213/a5dfb139/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 29652 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180213/a5dfb139/attachment.png>


More information about the ncl-talk mailing list