<div dir="ltr"><div><div><div><div><div><div><div>The error mesages is telling you the exact problem:<br> <span style="font-variant-ligatures:no-common-ligatures"><font color="#0433ff">fatal:Plus: Number of dimensions do not match, can't continue</font></span></div><div><br>spi has 4-dimensions:<br> <span style="font-variant-ligatures:no-common-ligatures">[len | 7] x [time | 1368] x [lat | 4] x [lon | 9]<br><br></span></div><span style="font-variant-ligatures:no-common-ligatures">prc has 3-dimensions<br> </span><span style="font-variant-ligatures:no-common-ligatures">[time | 1368] x [lat | 4] x [lon | 9]<br><br></span></div><span style="font-variant-ligatures:no-common-ligatures">yyyymm has 1-dimension<br> </span><span style="font-variant-ligatures:no-common-ligatures"> </span><span style="font-variant-ligatures:no-common-ligatures">[time | 1368]<br><br>==============<br></span></div><span style="font-variant-ligatures:no-common-ligatures">The print statement you used was copied from:<br> <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/dim_spi_n.shtml">https://www.ncl.ucar.edu/Document/Functions/Built-in/dim_spi_n.shtml</a><br></span></div><div><span style="font-variant-ligatures:no-common-ligatures"> Example 2<br></span></div><div><span style="font-variant-ligatures:no-common-ligatures">That was working upon a single time series prc[*]<br></span></div><div><span style="font-variant-ligatures:no-common-ligatures"><br></span><font color="#0433ff"></font><span style="font-variant-ligatures:no-common-ligatures"><font color="#0433ff"> <br><br></font></span></div><span style="font-variant-ligatures:no-common-ligatures"><font color="#0433ff">You have a 4-D array. *You* must make the appropriate changed to handle your situation.<br></font></span></div><div><span style="font-variant-ligatures:no-common-ligatures"><font color="#0433ff">The eamples are not generic to all dimensions.<br></font></span></div><div><span style="font-variant-ligatures:no-common-ligatures"><font color="#0433ff"><br></font></span></div><div><span style="font-variant-ligatures:no-common-ligatures"><font color="#0433ff"> nlat=4<br></font></span></div><div><span style="font-variant-ligatures:no-common-ligatures"><font color="#0433ff"> mlon=9<br><br></font></span></div><span style="font-variant-ligatures:no-common-ligatures"><font color="#0433ff"> do nl=0,nlat-1<br></font></span></div><span style="font-variant-ligatures:no-common-ligatures"><font color="#0433ff"> do ml=0,mlon-1<br></font></span></div><span style="font-variant-ligatures:no-common-ligatures"><font color="#0433ff"> print("------------------------------------------------")<br></font></span><div><div><div><div><div><div><div><div><br><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures"><font color="#0433ff">print(yyyymm+sprintf("%8.2f", prc(:,nl,ml)) \ </font></span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures"><font color="#0433ff"> +sprintf("%8.2f", spi(0,:,nl,ml))+sprintf("%8.2f", spi(1,:,nl,ml)) \ </font></span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures"><font color="#0433ff"> +sprintf("%8.2f", spi(2,:,nl,ml))+sprintf("%8.2f", spi(3,:,nl,ml)) \ </font></span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures"><font color="#0433ff"> +sprintf("%8.2f", spi(4,:,nl,ml))+sprintf("%8.2f", spi(5,:,nl,ml)) \ </font></span></p>
<span style="font-variant-ligatures:no-common-ligatures"><font color="#0433ff"> +sprintf("%8.2f", spi(6,:,nl,ml)))<br><br></font></span></div><div><span style="font-variant-ligatures:no-common-ligatures"><font color="#0433ff"> end do<br></font></span></div><div><span style="font-variant-ligatures:no-common-ligatures"><font color="#0433ff"> en do<br></font></span></div></div></div></div></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 5, 2017 at 2:20 AM, Dawit Abebe <span dir="ltr"><<a href="mailto:dawit.kan@gmail.com" target="_blank">dawit.kan@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">Hello all,</span></p><div><br></div><div>Kindly help me to fix my problem with printing SPI. I pasted below first the return of printVarSummary(spi), which seems okay. However, my attempt to print the output (text in blue) did not work. What was wrong?</div><div><br></div><div>Greatly appreciate your help.</div><div><br></div><div>Dawit</div><div><br></div><div>…………………………………….</div><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"><br></span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">copy_VarCoords(prc,spi(0,:,:,:<wbr>))</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">spi@long_name = "SPI"</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">spi!0 = "len"</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">spi&len = len</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">
</p><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">printVarSummary(spi)</span></p><div><br></div><div><br></div><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">Variable: spi</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">Type: double</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">Total Size: 2757888 bytes</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"> 344736 values</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">Number of Dimensions: 4</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">Dimensions and sizes:<span class="m_-3429062055612373153Apple-tab-span" style="white-space:pre-wrap">        </span>[len | 7] x [time | 1368] x [lat | 4] x [lon | 9]</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">Coordinates: </span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"> len: [1..36]</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"> time: [ 380..41987]</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"> lat: [3.75..5.25]</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"> lon: [36.75..40.75]</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">Number Of Attributes: 2</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"> long_name :<span class="m_-3429062055612373153Apple-tab-span" style="white-space:pre-wrap">        </span>SPI</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"> _FillValue :<span class="m_-3429062055612373153Apple-tab-span" style="white-space:pre-wrap">        </span>-999</span></p><div><br></div><div><br></div><div><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"><font color="#0433ff">yyyymm = cd_calendar(f->time, -1) </font></span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"><font color="#0433ff"><br></font></span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"><font color="#0433ff">print(yyyymm+sprintf("%8.2f", prc) \ </font></span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"><font color="#0433ff"> +sprintf("%8.2f", spi(0,:))+sprintf("%8.2f", spi(1,:)) \ </font></span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"><font color="#0433ff"> +sprintf("%8.2f", spi(2,:))+sprintf("%8.2f", spi(3,:)) \ </font></span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"><font color="#0433ff"> +sprintf("%8.2f", spi(4,:))+sprintf("%8.2f", spi(5,:)) \ </font></span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"><font color="#0433ff"> +sprintf("%8.2f", spi(6,:))) </font></span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"><font color="#0433ff">fatal:Plus: Number of dimensions do not match, can't continue</font></span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"><font color="#0433ff">fatal:["Execute.c":8638]:<wbr>Execute: Error occurred at or near line 37</font></span></p><div><br></div></div><div><br></div></div><br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>