Class Statistics

java.lang.Object
noaa.coastwatch.util.Statistics

public class Statistics extends Object
The statistics class is a container for various data variable statistics such as minimum, maximum, mean, standard deviation, histogram counts, and so on.
Since:
3.1.6
Author:
Peter Hollemans
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new set of statistics.
    Statistics(DataIterator iter, boolean saveData)
    Creates a new set of statistics.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    Gets the average deviation from the mean.
    int
    getCount(double val)
    Gets the histogram count for a data value.
    double
    getData(int index)
    Gets the specified data value.
    double
    Gets the maximum data value.
    double
    Gets the mean data value.
    double
    Gets the median value of the data.
    double
    Gets the minimum data value.
    double
    getNormalizedCount(double val)
    Gets the normalized histogram count for a data value.
    double
    Gets the standard deviation from the mean.
    static Statistics
    getTestData(long seed)
    Gets a test statistics object with normal distribution.
    int
    Gets the total number of valid data values sampled.
    int
    Gets the total number of data values sampled, including invalid data.
    static void
    main(String[] argv)
    Tests this class with a very simple data set.
    Converts this statistics object to a string.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Statistics

      public Statistics(DataIterator iter)
      Creates a new set of statistics. Using this constructor, the data values are not saved.
      Parameters:
      iter - an iterator over all data values required for the statistics calculations.
    • Statistics

      public Statistics(DataIterator iter, boolean saveData)
      Creates a new set of statistics.
      Parameters:
      iter - an iterator over all data values required for the statistics calculations.
      saveData - the save data flag, true if the data values used in the statistics are to be saved. If the values are saved, they will be available from the getData(int) method.
  • Method Details

    • getTestData

      public static Statistics getTestData(long seed)
      Gets a test statistics object with normal distribution.
    • getValues

      public int getValues()
      Gets the total number of data values sampled, including invalid data.
    • getValid

      public int getValid()
      Gets the total number of valid data values sampled.
    • getMin

      public double getMin()
      Gets the minimum data value.
    • getMax

      public double getMax()
      Gets the maximum data value.
    • getMean

      public double getMean()
      Gets the mean data value.
    • getStdev

      public double getStdev()
      Gets the standard deviation from the mean.
    • getAdev

      public double getAdev()
      Gets the average deviation from the mean.
    • getMedian

      public double getMedian()
      Gets the median value of the data.
    • getData

      public double getData(int index)
      Gets the specified data value. This is only possible if the saveData flag was specified to be true in the constructor.
      Parameters:
      index - the data value index.
      Returns:
      the data value or Double.NAN if no data was saved.
    • getCount

      public int getCount(double val)
      Gets the histogram count for a data value.
      Parameters:
      val - the data value for the desired bin.
      Returns:
      the histogram bin count or 0 if the data value is out of range.
    • getNormalizedCount

      public double getNormalizedCount(double val)
      Gets the normalized histogram count for a data value.
      Parameters:
      val - the data value for the desired bin.
      Returns:
      the histogram bin count divided by the count of the maximum bin or 0 if the data value is out of range.
    • toString

      public String toString()
      Converts this statistics object to a string.
      Overrides:
      toString in class Object
    • main

      public static void main(String[] argv)
      Tests this class with a very simple data set.