<div dir="ltr">NCL team,<div><br></div><div>I would like to suggest several new options for the dim_cumsum family of four functions.  The current three options are:<br><br>opt = 0 ; when _FillValue is encountered no additional summing will be performed. <br>opt = 1 ; when _FillValue is encountered set element to _FillValue and resume summing.<br>opt = 2 ; treat _FillValue as numeric zero when summing.</div><div><br></div><div>Frequently only the final array slice of the customized summing operation is wanted.  So I propose several new options:</div><div><br></div><div>opt = 4 ; when _FillValue is encountered, return _FillValue.</div><div>opt = 5 ; return sum only up to the first encountered _FillValue.</div><div>opt = 6 ; return sum only following the last encountered _FillValue.</div><div>opt = 7 ; treat _FillValue as numeric zero, and return only the final sum.<br></div><div><br></div><div>The first three existing options return an <span style="font-size:14px;color:rgb(51,51,51);font-family:verdana,sans-serif">array of the same type and dimensionality as </span><em style="font-size:14px;margin:0px;padding:0px;color:rgb(51,51,51);font-family:verdana,sans-serif">x</em><span style="font-size:14px;color:rgb(51,51,51);font-family:verdana,sans-serif">.  These four new options would return an array of one lesser rank than x; the summing dimension would be removed.</span></div><div><span style="font-size:14px;color:rgb(51,51,51);font-family:verdana,sans-serif"><br></span></div><div><font color="#333333" face="verdana, sans-serif">Options 4, 6, and 7 would return exactly the same result as taking the "last" array slice on the summing dimension, of options 0, 1, and 2 respectively.</font></div><div><font color="#333333" face="verdana, sans-serif"><br></font></div><div><font color="#333333" face="verdana, sans-serif">Option 5 would be special.  Summing would end on the FIRST encountered _FillValue, and that result would be returned.  Option 5 would be exactly the same as option 6 with reversed input ordering on the summing dimension.  Option 5 is included mainly for symmetry and completeness.</font></div><div><font color="#333333" face="verdana, sans-serif"><br></font></div><div><font color="#333333" face="verdana, sans-serif">To be consistent with current option 1, _FillValue is explicitly returned when:</font></div><div><font color="#333333" face="verdana, sans-serif"><br></font></div><div><font color="#333333" face="verdana, sans-serif">opt = 5 and the first input element is _FillValue.</font></div><div><font color="#333333" face="verdana, sans-serif">opt = 6 a</font><span style="color:rgb(51,51,51);font-family:verdana,sans-serif">nd the last input element is _FillValue.</span></div><div><font color="#333333" face="verdana, sans-serif"><br></font></div><div><font color="#333333" face="verdana, sans-serif">These new options would simplify user code in some cases, such as Rashed's case today.  In</font><span style="color:rgb(51,51,51);font-family:verdana,sans-serif"> </span><span style="color:rgb(51,51,51);font-family:verdana,sans-serif">large array applications, these options could also</span><span style="color:rgb(51,51,51);font-family:verdana,sans-serif"> reduce memory consumption and run time.</span></div><div><font color="#333333" face="verdana, sans-serif"><br></font></div><div><font color="#333333" face="verdana, sans-serif">--Dave</font></div></div>