<div dir="ltr">There appears to be a small (but potentially problematic!) bug in stat_dispersion.<div><br></div><div>The second index returned in the stats array (ex: stat(1)) should be standard deviation per the site documentation and function's internal print routine. However, the function actually appears to return the variance under the index.</div><div><br></div><div>in the actual function in contributed.ncl</div><div><br></div><div><snip></div><div><div> if (nwork.gt.1) then</div><div> ;statx(0) = avg(x) ; mean</div><div> ;statx(1) = stddev(x) ; std. deviation</div><div> moment = dim_stat4( work )</div><div> statx(0) = moment(0) ; mean</div><div> statx(1) = moment(1) ; std. deviation <---------------</div><div><br></div><div> qsort( work ) ; sort into ascending order</div><div> statx(2) = work(0) ; min ( work )</div></div><div><div><snip></div><div><br></div><div>dim_stat4 should return variance in the (1) index, not stddev<br></div><div><br></div><div>This can be reproduced with the below code snippet:</div><div><br></div><div><div>;========================================================</div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"</div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"</div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"</div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"</div><div>;========================================================</div><div>begin</div><div><br></div><div>a = new(10,"float",-999)</div><div>a = (/1,2,3,4,5,6,7,8,9,10/)</div><div>;a(3) = a@_FillValue</div><div><br></div><div>opt = True</div><div>opt@PrintStat = True</div><div>statb = stat_dispersion(a, opt )</div><div><br></div><div>print("stdev = "+stddev(a))</div><div>print("variance = "+variance(a))</div><div><br></div><div>end</div><div><br></div><div>;========================================================</div></div><div><br></div><div>-Colin</div><div><br></div>-- <br><div dir="ltr"><div dir="ltr" style="font-family:arial;font-size:small">Colin M. Zarzycki, ASP postdoctoral fellow</div><div dir="ltr" style="font-family:arial;font-size:small">Atmospheric Modeling and Predictability<br>National Center for Atmospheric Research<br><a href="http://www.colinzarzycki.com/" style="color:rgb(17,85,204)" target="_blank">http://www.colinzarzycki.com</a></div></div>
</div></div>