[ncl-talk] Add new options for dim_cumsum

Dennis Shea shea at ucar.edu
Mon Nov 27 08:11:55 MST 2017


Dave,

A ticket has been opened:  JIRA-2699: dim_cumsum_n: add new options

-------------
I tagged this for the 6.5.0 release but that may not be possible.

Regards

On Fri, Nov 24, 2017 at 2:38 PM, Dave Allured - NOAA Affiliate <
dave.allured at noaa.gov> wrote:

> NCL team,
>
> I would like to suggest several new options for the dim_cumsum family of
> four functions.  The current three options are:
>
> opt = 0 ; when _FillValue is encountered no additional summing will be
> performed.
> opt = 1 ; when _FillValue is encountered set element to _FillValue and
> resume summing.
> opt = 2 ; treat _FillValue as numeric zero when summing.
>
> Frequently only the final array slice of the customized summing operation
> is wanted.  So I propose several new options:
>
> opt = 4 ; when _FillValue is encountered, return _FillValue.
> opt = 5 ; return sum only up to the first encountered _FillValue.
> opt = 6 ; return sum only following the last encountered _FillValue.
> opt = 7 ; treat _FillValue as numeric zero, and return only the final sum.
>
> The first three existing options return an array of the same type and
> dimensionality as *x*.  These four new options would return an array of
> one lesser rank than x; the summing dimension would be removed.
>
> 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.
>
> 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.
>
> To be consistent with current option 1, _FillValue is explicitly returned
> when:
>
> opt = 5 and the first input element is _FillValue.
> opt = 6 and the last input element is _FillValue.
>
> These new options would simplify user code in some cases, such as Rashed's
> case today.  In large array applications, these options could also reduce
> memory consumption and run time.
>
> --Dave
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20171127/76a6060f/attachment.html>


More information about the ncl-talk mailing list