<div dir="ltr"><div>Hi Michele,</div><div><br></div><div>This does appear to be a bug in the pie_chart function that was introduced a couple of years ago. You can fix it in your local distribution by editing the file $NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl:</div><div><br></div><div>on both lines 4172 and 4177, replace "colors(n,:)" with "rgba_colors(n:i)".</div><div><br></div><div>While I've tested that this works with named colors, colormap indices, and rgba colors, you should make a backup of shea_util.ncl at least until satisfied that everything works.</div><div><br></div><div>I'll submit a fix to the NCL maintainers.</div><div><br></div><div>Hope that helps...</div><div>Rick</div><div><br></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Sep 1, 2020 at 8:45 AM Michele Petrini - CITG via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu">ncl-talk@mailman.ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div style="overflow-wrap: break-word;">
Dear helpdesk,
<div><br>
</div>
<div>I am contacting you as I am trying to make a simple pie chart and there is something strange happening; </div>
<div><br>
</div>
<div>when I run this code </div>
<div><br>
</div>
<div>
<div><font color="#ff8700">color=(/"lightskyblue","brown1"/)</font></div>
<div><font color="#ff8700">name=(/"Accumulation","Ablation"/)</font></div>
<div><font color="#ff8700">percent=(/10.0,90.0/)</font></div>
<div><font color="#ff8700"><br>
</font></div>
<div><font color="#ff8700">pcRes = True</font></div>
<div><font color="#ff8700">pcRes@gsnMaximize = True</font></div>
<div><font color="#ff8700">pcRes@tiMainString = areas(i)+": average years "+ystartavg+"-"+yendavg ; Sector Label is default</font></div>
<div><font color="#ff8700">piechart = pie_chart(wks2, percent, name, color, pcRes)</font></div>
<div><br>
</div>
<div>I get the following error: </div>
<div><br>
</div>
<div>
<div style="margin:0px;font-stretch:normal;font-size:13px;line-height:normal;font-family:Menlo;color:rgb(244,184,29)">
<span style="font-variant-ligatures:no-common-ligatures">fatal:Number of subscripts do not match number of dimensions of variable,(2) Subscripts used, (1) Subscripts expected</span></div>
<div style="margin:0px;font-stretch:normal;font-size:13px;line-height:normal;font-family:Menlo;color:rgb(244,184,29)">
<span style="font-variant-ligatures:no-common-ligatures">fatal:["Execute.c":8637]:Execute: Error occurred at or near line 4172 in file $NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl</span></div>
</div>
<div><span style="font-variant-ligatures:no-common-ligatures"><br>
</span></div>
<div><span style="font-variant-ligatures:no-common-ligatures">I went to look at line 4172 in shea_util.ncl and what I’m reading is</span></div>
<div><span style="font-variant-ligatures:no-common-ligatures"><br>
</span></div>
<div><span style="font-variant-ligatures:no-common-ligatures">—</span></div>
<div><span style="font-variant-ligatures:no-common-ligatures">
<div style="margin:0px;font-stretch:normal;font-size:13px;line-height:normal;font-family:Menlo;color:rgb(244,184,29)">
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(252,255,38)">4172 </span><span style="font-variant-ligatures:no-common-ligatures"> pgRes@</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(138,255,177)">gsFillColor</span><span style="font-variant-ligatures:no-common-ligatures">
= colors(n,:) </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(74,255,255)">; fill with associated color</span></div>
<div style="margin:0px;font-stretch:normal;font-size:13px;line-height:normal;font-family:Menlo;color:rgb(244,184,29)">
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(252,255,38)">4173 </span><span style="font-variant-ligatures:no-common-ligatures"> plotPC@$</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(74,255,255)"><b>unique_string</b></span><span style="font-variant-ligatures:no-common-ligatures">(</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(164,0,170)">"dum"</span><span style="font-variant-ligatures:no-common-ligatures">)$
= </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(254,230,231)">gsn_add_polygon</span><span style="font-variant-ligatures:no-common-ligatures"> (wks, plotPC, xx, yy, pgRes)
</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(74,255,255)">; color fill</span></div>
<div style="margin:0px;font-stretch:normal;font-size:13px;line-height:normal;font-family:Menlo;color:rgb(244,184,29)">
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(252,255,38)">4174 </span><span style="font-variant-ligatures:no-common-ligatures"> plotPC@$</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(74,255,255)"><b>unique_string</b></span><span style="font-variant-ligatures:no-common-ligatures">(</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(164,0,170)">"dum"</span><span style="font-variant-ligatures:no-common-ligatures">)$
= </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(254,230,231)">gsn_add_polyline</span><span style="font-variant-ligatures:no-common-ligatures">(wks, plotPC, xx, yy, plRes)
</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(74,255,255)">; outline</span></div>
<div style="margin:0px;font-stretch:normal;font-size:13px;line-height:normal;font-family:Menlo;color:rgb(252,255,38)">
<span style="font-variant-ligatures:no-common-ligatures">4175 </span></div>
<div style="margin:0px;font-stretch:normal;font-size:13px;line-height:normal;font-family:Menlo;color:rgb(244,184,29)">
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(252,255,38)">4176 </span><span style="font-variant-ligatures:no-common-ligatures"> gsRes@</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(138,255,177)">gsMarkerColor</span><span style="font-variant-ligatures:no-common-ligatures">
= colors(n,:) </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(74,255,255)">; associate marker</span></div>
</span></div>
<div>
<div dir="auto" style="overflow-wrap: break-word;">
<div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
—</div>
<div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<br>
</div>
<div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
If I replace colors(n,:) with colors(n) in the lines above, the script does work fine. </div>
<div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<br>
</div>
<div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
I am still wondering whether there is something wrong in my code - although I am using the very same code as in pie_chart_2.ncl (<a href="https://www.ncl.ucar.edu/Applications/Scripts/pie_chart_2.ncl" target="_blank">https://www.ncl.ucar.edu/Applications/Scripts/pie_chart_2.ncl</a>)
- or there is a bug in shea_util.ncl.</div>
<div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<br>
</div>
<div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
Thanks!</div>
<div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<br>
</div>
<div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
Michele</div>
<div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<br>
</div>
<div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
******************************************************************<br>
Michele Petrini, PhD </div>
<div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<br>
Department of Geoscience and Remote Sensing, TUDelft<br>
Delft, The Netherlands<br>
<br>
<a href="mailto:M.Petrini@tudelft.nl" target="_blank">M.Petrini@tudelft.nl</a> <br>
+39 3398367372<br>
michele.petrins (Skype alias)<br>
<br>
<br>
</div>
</div>
</div>
<br>
</div>
</div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="https://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">https://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote></div>