NCL Home > Documentation > Functions > General applied math, Statistics


Calculates the cumulative sum along the rightmost dimension and retains metadata.


load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"  ; This library is automatically loaded
                                                             ; from NCL V6.2.0 onward.
                                                             ; No need for user to explicitly load.

	function dim_cumsum_Wrap (
		x    : numeric,  
		opt  : integer   

	return_val [dimsizes(x)] :  float or double



A variable of numeric type and any dimensionality.


Option for how to treat _FillValue

  • opt = 0 ; when _FillValue is encountered, set current element and all remaining to _FillValue
  • opt = 1 ; when _FillValue is encountered set element to _FillValue and resume summing
  • opt = 2 ; treat _FillValue as numeric zero when summing


This function is identical to dim_cumsum, except the return value will have metadata added based on metadata attached to x. See the dim_cumsum page for full documentation and examples.