<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Dear nil-talk group,<div class=""><br class=""></div><div class="">I’m trying to calculate SPI but failing to produce the intended result. I pasted below the commands used and the respective returns from the interactive apprach below. The lines I need help with are those highlighted blue:</div><div class=""><br class=""></div><div class="">1. on line 20) as per the examples provided in&nbsp;<a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/dim_spi_n.shtml" class="">https://www.ncl.ucar.edu/Document/Functions/Built-in/dim_spi_n.shtml</a>&nbsp;the use of the missing value of the variable (prc@_FillValue) returns an error. When I removed the prc@_FillValue, it &nbsp;seems okay, which according to the NCL documentation on&nbsp;missing values (,<a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/new.shtml" class="">https://www.ncl.ucar.edu/Document/Functions/Built-in/new.shtml</a>) omitting the parameter from the command line leads to NCL to use&nbsp;the default missing value of the variable (i.e. pcr in this case). I<font color="#ff2600" class="">’m just wondering if this is correct and appropriate path to the result I am expecting? &nbsp; &nbsp;</font></div><div class=""><br class=""></div><div class="">2. on line 26-28: the command gives me an error. I tried to&nbsp;figure out this but failed to fix it.&nbsp;</div><div class=""><br class=""></div><div class="">I’m calling upon anyone to help me out on this two issues.</div><div class=""><br class=""></div><div class="">Thank you so much</div><div class=""><br class=""></div><div class="">Dawit</div><div class=""><br class=""></div><div class="">——————————————————————————————</div><div class=""><p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">(my_ncl) Dagemawes-MacBook-Pro:~ dawitabebe$ ncl -Q</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">ncl 0&gt;&nbsp;</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">ncl 1&gt; load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"&nbsp;</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">ncl 2&gt; load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"&nbsp; &nbsp;</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">ncl 3&gt; load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">ncl 4&gt;&nbsp;</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">ncl 5&gt;&nbsp; &nbsp; diri = "./"</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">ncl 6&gt;&nbsp; &nbsp; fili = "pre_1901_2014.nc"</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">ncl 7&gt;&nbsp; &nbsp; f&nbsp; &nbsp; = addfile(diri+fili, "r")</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">ncl 8&gt;&nbsp;</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">ncl 9&gt;&nbsp; &nbsp; prc&nbsp; = f-&gt;pre</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">ncl 10&gt; &nbsp; printVarSummary(prc)</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Variable: prc</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Type: double</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Total Size: 393984 bytes</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 49248 values</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Number of Dimensions: 3</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Dimensions and sizes:<span class="Apple-tab-span" style="white-space:pre">        </span>[time | 1368] x [lat | 4] x [lon | 9]</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Coordinates:&nbsp;</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; time: [ 380..41987]</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lat: [3.75..5.25]</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lon: [36.75..40.75]</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Number Of Attributes: 5</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; correlation_decay_distance :<span class="Apple-tab-span" style="white-space:pre">        </span> 450</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; long_name :<span class="Apple-tab-span" style="white-space:pre">        </span>precipitation</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; units :<span class="Apple-tab-span" style="white-space:pre">        </span>mm/month</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; missing_value :<span class="Apple-tab-span" style="white-space:pre">        </span>9.96920996839e+36</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; _FillValue :<span class="Apple-tab-span" style="white-space:pre">        </span>9.96920996839e+36</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">ncl 11&gt;&nbsp;</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">ncl 12&gt;&nbsp;</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">ncl 13&gt; dimp = dimsizes(prc)</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">ncl 14&gt; ntim = dimp(0)</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">ncl 15&gt; nlat = dimp(1)</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">ncl 16&gt; mlon = dimp(2)</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">ncl 17&gt;&nbsp;</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">ncl 18&gt; len&nbsp; = (/3, 12, 17, 24, 29, 36/)</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">ncl 19&gt; klen = dimsizes(len)</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font color="#0433ff" class="">ncl 20&gt; spi&nbsp; = new((/klen, ntim, nlat, mlon/), float, prc@_FillValue)</font></span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font color="#0433ff" class="">warning:New: Could not coerce missing value parameter into appropriate type, using default</font></span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">ncl 21&gt; spi&nbsp; = new((/klen, ntim, nlat, mlon/), float)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">ncl 22&gt;&nbsp;</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">ncl 23&gt; opt&nbsp; = True</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">ncl 24&gt; opt@spi_typee = 3</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">ncl 25&gt;&nbsp;</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font color="#0433ff" class="">ncl 26&gt; do k=0,klen-1</font></span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font color="#0433ff" class="">ncl 27&gt;&nbsp; &nbsp; spi(k,:,:,:) = dim_spi_n(prc, len(k), True, 0)</font></span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font color="#0433ff" class="">ncl 28&gt; end do</font></span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font color="#0433ff" class="">fatal:Assignment type mismatch, right hand side can't be coerced to type of left hand side</font></span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font color="#0433ff" class="">fatal:["Execute.c":8638]:Execute: Error occurred at or near line 27</font></span></p></div><div class=""><br class=""></div><div class="">&nbsp;</div></body></html>