Package noaa.coastwatch.util
Class Statistics
java.lang.Object
noaa.coastwatch.util.Statistics
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
ConstructorsConstructorDescriptionStatistics(DataIterator iter) Creates a new set of statistics.Statistics(DataIterator iter, boolean saveData) Creates a new set of statistics. -
Method Summary
Modifier and TypeMethodDescriptiondoublegetAdev()Gets the average deviation from the mean.intgetCount(double val) Gets the histogram count for a data value.doublegetData(int index) Gets the specified data value.doublegetMax()Gets the maximum data value.doublegetMean()Gets the mean data value.doubleGets the median value of the data.doublegetMin()Gets the minimum data value.doublegetNormalizedCount(double val) Gets the normalized histogram count for a data value.doublegetStdev()Gets the standard deviation from the mean.static StatisticsgetTestData(long seed) Gets a test statistics object with normal distribution.intgetValid()Gets the total number of valid data values sampled.intGets the total number of data values sampled, including invalid data.static voidTests this class with a very simple data set.toString()Converts this statistics object to a string.
-
Constructor Details
-
Statistics
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
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 thegetData(int)method.
-
-
Method Details
-
getTestData
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 thesaveDataflag was specified to be true in the constructor.- Parameters:
index- the data value index.- Returns:
- the data value or
Double.NANif 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
Converts this statistics object to a string. -
main
Tests this class with a very simple data set.
-