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


Computes the weighted sum of a variable's rightmost dimension at all other dimensions 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_sum_wgt_Wrap (
		x       : numeric,  
		w   [*] : numeric,  
		opt [1] : integer   

	return_val  :  float or double



A variable of numeric type and any dimensionality. Missing values are indicated by the _FillValue attribute.


A one-dimensional array of weights. The length must the same as the rightmost dimension of x.


A scalar: (a) opt=0 means compute the weighted sum only if all values are not missing; (b) opt=1 means compute the weighted sum of all non-missing values; (c) opt>1 means to return the weighted sum only if the number of non-missing values is greater-than or equal to opt.


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