<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif; ">
<div>There's en error in your final do loop, where you create the plots; you're using indices of 0 and 1 for the plots, regardless of the loop. Every loop will just overwrite the previous loop.</div>
<div><br>
</div>
<div>One possible fix:</div>
<div><br>
</div>
<div> i = 0 ;index to refer to the plot</div>
<div><span style="font-family: Calibri; font-size: medium; "> do ns=0,dimsizes(season_index)-1</span><br style="font-family: Calibri; font-size: medium; ">
<span style="font-family: Calibri; font-size: medium; "> </span><br style="font-family: Calibri; font-size: medium; ">
<span style="font-family: Calibri; font-size: medium; "> res@gsnCenterString = season_label(ns)+":"+(ymStrt/100) +"-"+(ymLast/100)</span><br style="font-family: Calibri; font-size: medium; ">
<span style="font-family: Calibri; font-size: medium; "> </span><br style="font-family: Calibri; font-size: medium; ">
<span style="font-family: Calibri; font-size: medium; "> plot(i) = gsn_csm_contour_map_ce(wks,precSeaClm(ns,:,:), res) ; create plot, using i NOT 0</span><br style="font-family: Calibri; font-size: medium; ">
<span style="font-family: Calibri; font-size: medium; "> plot(i+1) = gsn_csm_contour_map_ce(wks,prec1SeaClm(ns,:,:), res) ; create plot using i+1 NOT 1</span><br style="font-family: Calibri; font-size: medium; ">
<span style="font-family: Calibri; font-size: medium; "> </span></div>
<div> i = i+2 ; update i for the next loop<br style="font-family: Calibri; font-size: medium; ">
<span style="font-family: Calibri; font-size: medium; "> </span><br style="font-family: Calibri; font-size: medium; ">
<span style="font-family: Calibri; font-size: medium; "> end do</span></div>
<div><br>
</div>
<div>Normally in a loop you could use the loop integer (ns in this case) as the reference. But sometimes, is is the case here, it's necessary to use an index several times in the same loop, hence I created 'i'.</div>
<div><br>
</div>
<div>Will</div>
<div><br>
</div>
<span id="OLK_SRC_BODY_SECTION">
<div style="font-family:Calibri; font-size:11pt; text-align:left; color:black; BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt">
<span style="font-weight:bold">From: </span>george luke <<a href="mailto:lukejuliet2015@gmail.com">lukejuliet2015@gmail.com</a>><br>
<span style="font-weight:bold">Date: </span>Monday, 10 August 2015 6:21 PM<br>
<span style="font-weight:bold">To: </span>"<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a>" <<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a>><br>
<span style="font-weight:bold">Subject: </span>[ncl-talk] getting less plots than what is required<br>
</div>
<div><br>
</div>
<div>
<div>
<div dir="ltr">
<div>Dear All</div>
<div>I am trying to make 6plots BUT only two are being made. If i set </div>
<div><br>
</div>
<div>plot(0) = gsn_csm_contour_map_ce(wks,precSeaClm(ns,:,:), res) ; create plot<br>
plot(1) = gsn_csm_contour_map_ce(wks,prec1SeaClm(ns,:,:), res) ; create plot</div>
<div><br>
</div>
<div>I get only 3plots</div>
<div>BUT IF I SET </div>
<div>plot(ns) = gsn_csm_contour_map_ce(wks,precSeaClm(ns,:,:), res) ; create plot<br>
plot(ns) = gsn_csm_contour_map_ce(wks,prec1SeaClm(ns,:,:), res) ; create plot </div>
<div>I only get 2plots..</div>
<div><br>
</div>
<div>kindly help</div>
<div><br>
</div>
<div>Below is my script full script and also attached...</div>
<div><br>
</div>
<div>;***********************************************<br>
; climo_3.ncl<br>
;<br>
; Concepts illustrated:<br>
; - Calculating monthly climatologies<br>
; - Calculating seasonal totals for 36yrs<br>
; - Creating a color map using named colors<br>
; - Paneling four plots on a page<br>
; - Adding a common labelbar to paneled plots<br>
; - Explicitly setting contour levels<br>
; - Changing the center longitude for a cylindrical equidistant projection<br>
; - Turning off the individual contour labelbar<br>
; - Adding a common title to paneled plots<br>
; - Turning off map fill<br>
; - Creating a center subtitle<br>
;<br>
;***********************************************<br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"<br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"<br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"<br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"</div>
<div>begin<br>
;*******************************************************<br>
; Read the file for GPCC<br>
;*******************************************************<br>
ymStrt = 198101 <br>
ymLast = 199012<br>
a = addfile("GPCC.nc","r")<br>
<br>
TIME = a->time<br>
YYYYMM = cd_calendar(TIME, -1)<br>
iStrt = ind(YYYYMM.eq.ymStrt)<br>
iLast = ind(YYYYMM.eq.ymLast)</div>
<div> prec = a->precip(iStrt:iLast,:,:) ; (time,lat,lon)<br>
delete(prec@units)<br>
delete(prec@long_name)<br>
printMinMax(prec,True)<br>
<br>
printVarSummary(prec)<br>
time = a->time ; (time) ==> YYMM<br>
ntim = dimsizes(time)<br>
precClm = clmMonTLL(prec)<br>
printVarSummary(precClm)</div>
<div>;*******************************************************<br>
; Read the file for GPCP<br>
;*******************************************************<br>
ymStrt = 198101 <br>
ymLast = 199012<br>
b = addfile("GPCP.nc","r")<br>
;TIME = b->time<br>
time1 =b->time<br>
delete(TIME)<br>
yyyymm = cd_calendar(time1, -1)<br>
iStrt = ind(yyyymm.eq.ymStrt)<br>
iLast = ind(yyyymm.eq.ymLast)</div>
<div> prec1 = b->precip(iStrt:iLast,:,:) ; (time,lat,lon)<br>
delete(prec1@units)<br>
delete(prec1@long_name)<br>
printMinMax(prec1,True)<br>
<br>
printVarSummary(prec1)<br>
time1 = b->time ; (time) ==> YYMM<br>
ntim1 = dimsizes(time1)<br>
prec1Clm = clmMonTLL(prec1)<br>
printVarSummary(prec1Clm)</div>
<div>;************************************************<br>
; Compute the monthly climatology using a function in contributed.ncl<br>
;************************************************<br>
precMonClm = clmMonTLL(prec) ; (12,:,:)<br>
precSeaClm = runave_n_Wrap(precMonClm, 3, -1, 0) ; unweighted seasonal average<br>
printVarSummary(precSeaClm)<br>
<br>
prec1MonClm = clmMonTLL(prec1) ; (12,:,:)<br>
prec1SeaClm = runave_n_Wrap(prec1MonClm, 3, -1, 0) ; unweighted seasonal average<br>
printVarSummary(prec1SeaClm)<br>
<br>
season_index = (/3,6,10/) ; MAM, JJA, OND <br>
season_label = (/ "MAM", "JJA","OND"/)<br>
<br>
;************************************************<br>
; create colors<br>
;*************************************************<br>
wks = gsn_open_wks("x11", "clim_gpcp") ; open a work station<br>
<br>
<br>
colors = (/ (/255,255,255/),(/255,255,255/), (/244,255,244/), \<br>
(/217,255,217/), (/163,255,163/), (/106,255,106/), \<br>
(/43,255,106/), (/0,224,0/), (/0,134,0/),(/255,255,0/),\<br>
(/255,127,0/) /) * 1.0 ; we multiply by 1 to make colors float<br>
<br>
colors = colors/255. ; normalize (required by NCL)</div>
<div> ;************************************************<br>
; create panel plots<br>
;*************************************************<br>
plot = new ( 6, graphic) ; create graphical array<br>
<br>
res = True ; plot options desired<br>
<br>
;res@cnFillDrawOrder = "Predraw" <br>
res@cnFillOn = True ; turn on color fill<br>
res@cnInfoLabelOn = False ; turn off contour info label<br>
res@cnLinesOn = False ; turn off contour lines<br>
res@cnLineLabelsOn = False ; turn off line labels<br>
res@cnFillPalette =colors<br>
res@cnLevelSelectionMode = "ExplicitLevels" ; set explicit contour levels<br>
res@cnLevels =(/0.1,0.2,0.4,0.8,1.6,3.2,6.4,12.8,25,30,40,45,60,75,83,100/)</div>
<div> <br>
res@mpFillOn = False ; turn off gray continents<br>
res@mpCenterLonF = 180 ; Centers the plot at 180 <br>
<br>
res@lbLabelBarOn = False ; No single label bar</div>
<div> res@gsnDraw = False<br>
res@gsnFrame = False</div>
<div> resP = True ; panel options<br>
resP@txString = "Seasons" ; common title<br>
resP@gsnMaximize = True ; maximize image<br>
resP@gsnPanelLabelBar = True ; Add common label bar <br>
<br>
;****************ZOOM INTO YOUR LOCATION*********************<br>
<br>
res@mpLimitMode = "LatLon"<br>
;res@mpOutlineOn =True<br>
;res@mpOutlineSpecifiers =True<br>
res@mpMinLonF = 21. ; select a subregion<br>
res@mpMaxLonF = 54.<br>
res@mpMinLatF = -12. <br>
res@mpMaxLatF = 22.5<br>
<br>
<br>
;res@mpLandFillColor = "background" ; color of land<br>
<br>
;*********************Masking*********************************<br>
</div>
<div> res@mpFillDrawOrder = "Postdraw" <br>
<br>
<br>
resMap= True <br>
resMap@mpPerimOn = False <br>
resMap@mpGridAndLimbOn = False <br>
resMap@gsnTickMarksOn = False <br>
resMap@mpDataSetName = "Earth..3" <br>
resMap@mpOutlineOn = True <br>
<br>
<br>
res@mpFillOn = False ; turn off gray fill<br>
res@mpOutlineBoundarySets = "National" ; turn on country boundaries<br>
<br>
resMap@mpFillOn = True </div>
<div> resMap@mpOceanFillColor = "transparent" <br>
resMap@mpLandFillColor = "transparent" <br>
resMap@mpInlandWaterFillColor = "transparent" <br>
<br>
res@mpDataBaseVersion = "MediumRes" ; choose higher resolution<br>
</div>
<div> do ns=0,dimsizes(season_index)-1<br>
<br>
res@gsnCenterString = season_label(ns)+":"+(ymStrt/100) +"-"+(ymLast/100)<br>
<br>
;res@gsnCenterString = ""<br>
plot(0) = gsn_csm_contour_map_ce(wks,precSeaClm(ns,:,:), res) ; create plot<br>
plot(1) = gsn_csm_contour_map_ce(wks,prec1SeaClm(ns,:,:), res) ; create plot<br>
<br>
<br>
end do</div>
<div> gsn_panel(wks,plot,(/3,3/),resP)<br>
<br>
end</div>
<div><br>
</div>
</div>
</div>
</div>
</span>
<p style="font-size:10pt; line-height:10pt; calibri"><br>
<br>
University of Tasmania Electronic Communications Policy (December, 2014). <br>
This email is confidential, and is for the intended recipient only. Access, disclosure, copying, distribution, or reliance on any of it by anyone outside the intended recipient organisation is prohibited and may be a criminal offence. Please delete if obtained
in error and email confirmation to the sender. The views expressed in this email are not necessarily the views of the University of Tasmania, unless clearly intended otherwise.
</p>
</body>
</html>