>  Docs Center  >  Libraries  >  Mankoff  >  MAVG
Libraries

MAVG

MAVG

Name


  MAVG

Purpose


This procedure does a "smart average", where array elements less
than a certain value are NOT included in the average (they are
masked out)

Category


  Array, Math

Calling Sequence


  Result = MAVG( Data, DIMENSION=d, VALUE=v, SUM=s, MASK=m )

Inputs


  Data: This is an array of any dimensions that you want averaged
      across *ONE* of the dimensions

Optional Inputs


  None

Input Keyword Parameters


  DIMENSION: Set this to the dimension across which to sum. The
      first dimension is 1 not 0. The default value is the LAST
      dimension of the input array.
  VALUE: Set this such that any elements LE this value are not
      included in the average. Default is 0.

Output Keyword Parameters


  MASK: The mask array used to throw out 'bad' values
  SUM: The sum of the data across the dimension being averaged
 

Outputs


  Result: The average of the DATA input array, with any values less
  than VALUE not being included in the average. The DIMENSION of the
  RESULT is one less than the input DATA

Procedure


  Yes.

Example


  data = [ [ 1, 3, 0 ], $ ; 1+3 / 2 = 2
            [ 3, 0, 3 ], $ ; 3+3 / 2 = 3
            [ 0, 0, 10 ] ] ; 10 / 1 = 10
  ;;; to sum over columns
  avg = MAVG( data, dimension=1 )
  print, avg
        2.00000 3.00000 10.0000

Modification History


  Written by: KDM; 2002-07-31
  2002-08-12: KDM; Fixed bug when value gt 0. Made MASK and SUM

Keyword Parameters


  2002-09-05; KDM; made faster when getting rid of elements lt value



© 2024 NV5 Geospatial Solutions, Inc. |  Legal
   Contact Us