<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi George,<br>
<br>
the error message tells you that there is something wrong with the
subscripts used in that line. You can see that the variable season
has 2 subscripts:<br>
<br>
<font color="#006600"><tt>print(dimsizes(season))</tt><tt><br>
</tt><tt>(0) 3</tt><tt><br>
</tt><tt>(1) 3</tt><tt><br>
</tt></font><br>
The line should be something like<br>
<br>
<font color="#006600"><tt>res@gsnCenterString = season<b>(ns,:)</b>+":"+time(0)/100
+"-"+ time(ntim-1)/100</tt></font><strong><br>
</strong><br>
Bye,<br>
Karin<br>
<br>
<div class="moz-cite-prefix">Am 28.07.15 um 11:48 schrieb george
luke otieno:<br>
</div>
<blockquote
cite="mid:CAA1qgRnmHk5_D=S9SihtNOfmTT8AgXypNRUefzdC9jwwX7pKaw@mail.gmail.com"
type="cite">
<div dir="ltr">
<div>Dear All; Trying to plot 3 seasons MAM,OND,JJA together.
My data has 3dimension ordered like (time,lat,lon)</div>
<div><br>
</div>
<div>This is the complain from this line ....<strong>res@gsnCenterString
= season(ns)+":"+time(0)/100 +"-"+ time(ntim-1)/100</strong></div>
<div><br>
</div>
<div><em>fatal:Number of subscripts do not match number of
dimensions of variable,(1) Subscripts used, (2) Subscripts
expected<br>
fatal:["Execute.c":8578]:Execute: Error occurred at or near
line 160 in file trial</em></div>
<div><em>Below is the script..</em></div>
<div><em><br>
</em></div>
<div><em><br>
</em></div>
<div><em><br>
</em></div>
<div><em>;***********************************************<br>
; climo_3.ncl<br>
;<br>
; Concepts illustrated:<br>
; - Calculating monthly climatologies<br>
; - Calculating interannual variability<br>
; - Calculating standard deviations of monthly means<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"</em></div>
<div><em>begin<br>
;************************************************<br>
; Read the file<br>
;************************************************<br>
a = addfile("GPCP.nc","r")<br>
prec =
a->precip(0:431,:,:) ;
(time,lat,lon)<br>
printVarSummary(prec)<br>
time = a->time ; (time)
==> YYMM<br>
ntim = dimsizes(time)<br>
<br>
ymStrt = 198001 ; start yyyymm<br>
ymLast = 199912 ; last <br>
yrStrt = ymStrt/100<br>
yrLast = ymLast/100 ; start
yyyymm<br>
<br>
<br>
wksType = "x11"<br>
wksName = "test" ; ":
"+yrStrt+"_"+yrLast<br>
<br>
<br>
;************************************************<br>
; plots ; Compute 3-month climatologies<br>
;************************************************<br>
; (2,6)<br>
season = (/ (/ 2, 3, 4/) \ ; March-May[MAM]<br>
, (/ 5, 6, 7/) \ ; June-August [JJA]<br>
, (/ 9, 10, 11/) /) ; Oct-Dec [OND]<br>
i_season = season - 1 ; NCL indices<br>
season_label = (/ "March-May",
"June-August","October-December"/)<br>
plot = new ( 3, "graphic")<br>
wks = gsn_open_wks(wksType, wksName) <br>
gsn_define_colormap(wks,"BlueYellowRed")<br>
<br>
<br>
;************************************************<br>
; Compute the MAM,JJA,OND climatology using a function in
contributed.ncl<br>
;************************************************<br>
; precClm = month_to_season(prec) ; monthly
climatology<br>
;************************************************<br>
; create colors<br>
;*************************************************<br>
wks = gsn_open_wks("x11","test") ; open a
workstation<br>
<br>
<br>
colors = (/ (/255,255,255/),(/0,0,0/),(/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)</em></div>
<div><em><br>
;colors = (/"white","Balck","White","RoyalBlue"\ ;
back/fore ground<br>
;
,"lightSkyblue","lightseagreen","palegreen"/) ;
choose colors for color map<br>
<br>
gsn_define_colormap(wks, colors) ; generate
new color map<br>
;************************************************<br>
; create panel plots<br>
;*************************************************<br>
plot = new ( 3, graphic) ; create
graphical array</em></div>
<p><br>
</p>
<p> res = True ; plot
options desired</p>
<p> 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@cnLevelSelectionMode = "ExplicitLevels" ; set explicit
contour levels<br>
res@cnLevels = (/0.0,0.5,1.0,5.0,10,15,20,25\ ;
set unequal contour levels<br>
,30,35/)<br>
<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</p>
<p> res@gsnDraw = False<br>
res@gsnFrame = False</p>
<p> resP = True ; panel
options<br>
resP@txString = "GPCC Observation" ; 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>
mpOutlineOn =True<br>
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>
res@cnFillDrawOrder = "Predraw" <br>
;*********************Masking*********************************<br>
res@mpAreaMaskingOn = True <br>
res@mpMaskAreaSpecifiers = "Land" <br>
res@mpOceanFillColor = 0 <br>
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@mpDataBaseVersion = "MediumRes" <br>
resMap@mpOutlineOn = True <br>
<br>
res = True<br>
res@mpFillOn = False ; turn off
gray fill<br>
res@mpOutlineBoundarySets = "National" ; turn on
country boundaries<br>
;res@mpGeophysicalLineColor = "Navy" ; color of
cont. outlines</p>
<p> <br>
resMap@mpFillOn = True </p>
<p> resMap@mpOceanFillColor = "transparent" <br>
resMap@mpLandFillColor = "transparent" <br>
resMap@mpInlandWaterFillColor = "transparent" <br>
<br>
res@mpDataBaseVersion = "MediumRes" ; choose
higher resolution<br>
</p>
<p><br>
;delete(precClm@long_name) ; do not want<br>
<br>
do ns =0,1<br>
</p>
<p><br>
</p>
<p><br>
do ns=0,1 ; loop over the
months<br>
<strong>res@gsnCenterString =
season(ns)+":"+time(0)/100 +"-"+ time(ntim-1)/100</strong><br>
plot(i) = gsn_csm_contour_map_ce(wks,precClm(ns,:,:),
res) ; create plot<br>
end do</p>
<p> gsn_panel(wks,plot,(/2,2/),resP)<br>
;************************************************<br>
; create second panel plot<br>
;*************************************************<br>
delete(precStd@long_name) <br>
; Std Deviations<br>
do ns=0,1 ; loop over the
months<br>
<br>
res@gsnCenterString = season(ns)+":"+time(0)/100 +"-"+
time(ntim-1)/100<br>
plot(i) = gsn_csm_contour_map_ce(wks,precStd(ns,:,:),
res) ; create plot<br>
end do</p>
<p> gsn_panel(wks,plot,(/2,2/),resP)</p>
<p>end do<br>
end</p>
<br clear="all">
<div>
<div class="gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div><br>
<br>
<br>
<span
style="font-family:arial,helvetica,sans-serif">Best
Regards<br>
</span></div>
<div><span
style="font-family:arial,helvetica,sans-serif">George
Otieno</span></div>
<div><span
style="font-family:arial,helvetica,sans-serif"><br>
</span></div>
<div><span
style="font-family:arial,helvetica,sans-serif">Intergrated
Climate System Modelling Lab.<br>
</span></div>
<div><span
style="font-family:arial,helvetica,sans-serif">Department
of Environmental Atmospheric Sciences<br>
</span></div>
<div><span
style="font-family:arial,helvetica,sans-serif">608-737,
Room 4302, Chungmu-Building</span></div>
<div><span
style="font-family:arial,helvetica,sans-serif">Pukyong
National University,<br>
</span></div>
<div><span
style="font-family:arial,helvetica,sans-serif">45,Yongso-ro,Nam-gu,
Busan, South Korea<br>
</span></div>
<div><span
style="font-family:arial,helvetica,sans-serif">Tel.
+82-51-629-6643<br>
</span></div>
<div><span
style="font-family:arial,helvetica,sans-serif">Fax+82-51-629-7991</span><b><span
style="font-family:times new
roman,serif"><br>
</span></b></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
ncl-talk mailing list
<a class="moz-txt-link-abbreviated" href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a>
List instructions, subscriber options, unsubscribe:
<a class="moz-txt-link-freetext" href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a>
</pre>
</blockquote>
</body>
</html>