cdm/src/main/java/ucar/ma2/MAMath.java
public static double sumDoubleSkipMissingData(Array a, double missingValue) {
    double sum = 0;
    IndexIterator iterA = a.getIndexIterator();
    while (iterA.hasNext()) {
      double val = iterA.getDoubleNext();
      if ((val == missingValue) || Double.isNaN(val))
        continue;
      sum += val;
    }
    return sum;
  }
public static double sumDoubleSkipMissingData(Array a, double missingValue) {
    double sum = 0;
    IndexIterator iterA = a.getIndexIterator();
    while (iterA.hasNext()) {
      double val = iterA.getDoubleNext();
      if ((val == missingValue) || Double.isNaN(val))
        continue;
      sum += val;
    }
    return sum;
  }
public static double sumDoubleSkipMissingData ( Array a , double missingValue ) { double sum = 0 ; IndexIterator iterA = a . getIndexIterator ( ) ; while ( iterA . hasNext ( ) ) { double val = iterA . getDoubleNext ( ) ; if ( ( val == missingValue ) || Double . isNaN ( val ) ) continue ; sum += val ; } return sum ; }
sum all of the elements of array a as doubles.
The values from the array a are converted to double (if needed).
@param a read values from this Array
@param missingValue skip values equal to this, or which are NaNs
@return sum of elements
sum all of the elements of array a as doubles . The values from the array a are converted to double ( if needed ) .