<div dir="ltr"><div><div><div>The &#39;someone&#39; is me.<br></div><br>The error is with the example(s). The hazards of duplication! I was in the process of updating (ie: correcting) the documentation. <br><br></div>I will post back when all (hopefully) have been fixed.<br><br></div>D<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 22, 2016 at 9:43 AM, Alan Brammer <span dir="ltr">&lt;<a href="mailto:abrammer@albany.edu" target="_blank">abrammer@albany.edu</a>&gt;</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">Benita, <div><br></div><div>I see now that basically all these points apply to whoever wrote the examples and not to you.  </div><div><br></div><div>All examples on that page need to be edited.  I’m guessing someone did a find/replace on an older version of this function and didn’t check thoroughly.  </div><div><br></div><div>Also mistake on my part mixed up the order of these.  </div><div><div style="word-wrap:break-word"><div><div> spei(prc, t, lat,len(k), False, 0)</div></div></div><br></div><div><br></div><div><br></div><div>Alan. </div><div><br></div><div><br></div><div><br></div><div><br><div><blockquote type="cite"><div>On 22 Feb 2016, at 11:31, Alan Brammer &lt;<a href="mailto:abrammer@albany.edu" target="_blank">abrammer@albany.edu</a>&gt; wrote:</div><br><div><div style="word-wrap:break-word"><div><br></div><div>Hi Benita, </div><div><br></div><div>Multiple things.</div><div> <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/spei.shtml" target="_blank">https://www.ncl.ucar.edu/Document/Functions/Built-in/spei.shtml</a></div><div>At the top of the page.  &quot;<span style="color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13px;background-color:rgb(255,255,255)"> </span><i style="margin:0px;padding:0px;color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13px">Available in <a href="https://www.ncl.ucar.edu/prev_releases.shtml#6.3.1" style="margin:0px;padding:0px;text-decoration:none;color:rgb(133,45,133)" target="_blank">version 6.3.1</a> and later. &quot;</i></div><div> So you can’t use the function yet, latest released version is 6.3.0.  Which you’re using. </div><div><br></div><div><br></div><div>Secondly, </div><div>You can’t have variables and functions named the same thing.   When the function spei() is included, trying to define an array named spei is going to create problems.  </div><div><br></div><div>Line 16 won’t work in any language I know of.  Rename your variable so it doesn’t clash with the function name. </div><div><br></div><div><br></div><div>Third. </div><div>Again from the top link, spei() will expect 6 arguments and you only passed 4.  </div><div><br></div><div>Fourth.</div><div>The specific error you’re getting is because NCL is trying to subscript the spei variable using False as you passed on line 16.  False isn’t a valid subscript. </div><div><br></div><div>Fifth.</div><div>Included edited lines below which should work once 6.3.1 is released.   Though you will need to read in some temperature data as well. Read the functions documentation. </div><div><br></div><div><br></div><div>;;;;   Will need 6.3.1  </div><div><br></div><div><div>   f= addfile(&quot;pr_Amon_ensemble_historical_190001-200512.nc&quot;, &quot;r&quot;)</div><div>   prc    = f-&gt;pr                   ; pr(time,lat,lon)</div><div>   printVarSummary(prc)</div><div><br></div><div>   prc_dimnames = getvardims(prc)</div><div> time = lat= prc&amp;$prc_dimnames(0)$<span style="white-space:pre-wrap">                </span>;; get dimension coordinates without knowing dimension names</div><div>  lat= prc&amp;$prc_dimnames(1)$</div><div>  lon= prc&amp;$prc_dimnames(2)$</div><div> </div><div>  dimp   = dimsizes(prc)              ; # monthly precipitation values</div><div>   ntim   = dimp(0)</div><div>   nlat   = dimp(1)</div><div>   mlon   = dimp(2)</div><div><br></div><div><br></div><div>   len    = (/ 6, 12, 24 /)</div><div>   klen   =  dimsizes(len)</div><div>   spei_data    =  new((/klen,ntim,nlat,mlon/) ,float,prc@_FillValue)</div><div><br></div><div><br></div><div>  t =  ….  ; spei needs a temperature variable same size as prc</div><div><br></div><div> do k=0,klen-1</div><div>      spei_data(k,:,:,:) = spei(prc, t, len(k),lat, False, 0)</div><div>  end do</div></div><div><br></div><div><br></div><div><br></div><div>Good luck, </div><div>Alan</div><div><br></div><div><br></div><br><div><blockquote type="cite"><div>On 22 Feb 2016, at 11:11, Tam, Benita (EC/EC) &lt;<a href="mailto:benita.tam@canada.ca" target="_blank">benita.tam@canada.ca</a>&gt; wrote:</div><br><div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:Verdana,sans-serif" lang="EN-CA">Hi,<u></u><u></u></span></div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:Verdana,sans-serif" lang="EN-CA"><u></u> <u></u></span></div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:Verdana,sans-serif" lang="EN-CA">I am trying to calculate SPEI using the SPEI function in NCL with gridded data, but when I run the script, I get an error message saying that the subscripts must be one dimensional. This is expected for data for one location, but not for gridded data. My sample script is attached (it’s basically the same as the example provided with the function).<u></u><u></u></span></div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:Verdana,sans-serif" lang="EN-CA"><u></u> <u></u></span></div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:Verdana,sans-serif" lang="EN-CA">NCL version: 6.3.0<u></u><u></u></span></div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:Verdana,sans-serif" lang="EN-CA">Script (see attached)<u></u><u></u></span></div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:Verdana,sans-serif" lang="EN-CA">Error message: fatal:Illegal subscript. Subscripts must be scalar or one dimensional vectors<u></u><u></u></span></div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:Verdana,sans-serif" lang="EN-CA">Url for netcdf data:<span> </span></span><a href="http://ccds-dscc.ec.gc.ca/files/cmip5/pr/pr_Amon_ensemble_historical_190001-200512.nc" style="color:purple;text-decoration:underline" target="_blank"><span style="font-size:10pt;font-family:Verdana,sans-serif" lang="EN-CA">http://ccds-dscc.ec.gc.ca/files/cmip5/pr/pr_Amon_ensemble_historical_190001-200512.nc</span></a><span style="font-size:10pt;font-family:Verdana,sans-serif" lang="EN-CA"><u></u><u></u></span></div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:Verdana,sans-serif" lang="EN-CA"><u></u> <u></u></span></div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:Verdana,sans-serif" lang="EN-CA">Thanks,<u></u><u></u></span></div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:Verdana,sans-serif" lang="EN-CA">Benita<u></u><u></u></span></div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:Verdana,sans-serif" lang="EN-CA"><u></u> <u></u></span></div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:Verdana,sans-serif" lang="EN-CA"><u></u> <u></u></span></div></div><span>&lt;test_prc.ncl&gt;</span><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">_______________________________________________</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">ncl-talk mailing list</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><a href="mailto:ncl-talk@ucar.edu" style="color:purple;text-decoration:underline;font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">ncl-talk@ucar.edu</a><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">List instructions, subscriber options, unsubscribe:</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" style="color:purple;text-decoration:underline;font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></div></blockquote></div><br></div></div></blockquote></div><br></div></div><br>_______________________________________________<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/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>