<div dir="ltr"><div><div><div><div><div>Dear all,<br><br></div>i&#39;m trying to calculate spi for aphrodite from 1951 to 2007 using dim_spi_n function. I&#39;m not successfull, below is the code and error:<br><span style="background-color:rgb(255,255,0)"><br><b><span style="background-color:rgb(204,204,204)">f      = addfile(&quot;/home/ponraj/Desktop/<a href="http://aphrodite_mon.nc">aphrodite_mon.nc</a>&quot;,&quot;r&quot;)<br>prc    = f-&gt;precip                    <br>printVarSummary(prc)<br><br>dimp   = dimsizes(prc)              ; # monthly precipitation values<br>ntim   = dimp(0)<br>nlat   = dimp(1)<br>mlon   = dimp(2)<br><br>len    = (/3, 6, 12/)<br>klen   =  dimsizes(len)<br>spi    =  new((/klen,ntim,nlat,mlon/) ,float,prc@_FillValue<br>opt    = False<br><br>do k=0,klen-1<br>   spi(k,:,:,:) = dim_spi_n(prc, len(k), opt, 0)<br>end do</span></b></span><br><b><br></b></div><b>error:<br><br><span style="background-color:rgb(204,204,204)">fatal:Undefined identifier: (spi) is undefined, can&#39;t continue<br>fatal:[&quot;Execute.c&quot;:8126]:Execute: Error occurred at or near line 33</span><br></b><br></div><span style="background-color:rgb(255,255,255)"><span style="">And also i want to save this spi array in netcdf file. i&#39;m not familiar with netcdf file writing in ncl. i kindly request you to </span></span>sort out the above problem.<br><br></div>Thanks in advance<br></div>Rajasivaranjan<br><div><br></div></div>