net.agmodel.weatherData
Class ScalarMaxMinMeanImpl

java.lang.Object
  |
  +--net.agmodel.physical.GeneralSequenceImpl
        |
        +--net.agmodel.weatherData.GeneralMetSequenceImpl
              |
              +--net.agmodel.weatherData.ScalarMaxMinImpl
                    |
                    +--net.agmodel.weatherData.ScalarMaxMinMeanImpl
All Implemented Interfaces:
Cloneable, CompoundSequence, MetSequence, Sequence, Serializable
Direct Known Subclasses:
AirTempMaxMinMeanImpl

public abstract class ScalarMaxMinMeanImpl
extends ScalarMaxMinImpl

Adds a store for the true mean value to TempMaxMin

See Also:
Serialized Form

Field Summary
protected  Store meanValues
           
 
Fields inherited from class net.agmodel.weatherData.ScalarMaxMinImpl
maxValues, measurementHeight, minValues, pb
 
Fields inherited from class net.agmodel.weatherData.GeneralMetSequenceImpl
rb
 
Fields inherited from class net.agmodel.physical.GeneralSequenceImpl
dateRange, maximumTemporalInterpolation, summaryHistory
 
Constructor Summary
ScalarMaxMinMeanImpl(MetElement element, Interval dateRange, SummaryHistory composition)
          Creates a sequence of maximum, minimum, and mean values.
ScalarMaxMinMeanImpl(MetElement element, Interval dateRange, SummaryHistory composition, double measurementHeight)
          Creates a sequence of maximum, minimum, and mean values.
 
Method Summary
 Object clone()
           
 JigsawQuantity getAverage(Interval interval)
          Returns the true mean value over the interval
 String getColumnHeading()
          Returned a localized label for the Sequence
 String getContentsAsString(Date time, String delimiter)
          Returns the measurement associated with a particular time as a string.
 float[] getCoverage(int index)
          Indicates which array elements returned by getData(int) are missing.
 double[] getData(int index)
          Creates a one-dimensional array containing one subcomponent of the data.
 JigsawQuantity getInstant(Date time)
          May estimate the value at a point in time Currently just returns the average value
protected  Store getMeanStore()
           
 int getNumberOfSubComponents()
          Get the number of sub-components in the sequence.
 String getSubHeading(int index)
          Gets a brief description of the data stored in a Sequence subcomponent in the language of the default locale.
 void putMaxMinMean(Date time, float maximum, float minimum, float mean)
          Puts a maximum, minimum value pair into the sequence.
 void putMaxMinMeanOverInterval(Interval interval, float maximum, float minimum, float mean)
          Puts a maximum, minimum value pair into the sequence based on an interval
 void putMean(Date time, float mean)
          Puts the mean value into the sequence.
 void putMeanOverInterval(Interval interval, float mean)
          Puts the mean value into the sequence based on an interval
protected  void setMeanStore(Store newMean)
           
 void setSubHeading(int index, String aHeading)
          Does nothing
 
Methods inherited from class net.agmodel.weatherData.ScalarMaxMinImpl
getInstantMaximum, getInstantMinimum, getMaximum, getMaxStore, getMeasurementHeight, getMinimum, getMinStore, putMax, putMaxMin, putMaxMinOverInterval, putMaxOverInterval, putMin, putMinOverInterval, setMaxStore, setMinStore
 
Methods inherited from class net.agmodel.weatherData.GeneralMetSequenceImpl
getName, getSequenceElement, getSequenceHeading, getUnitsHeading, setColumnHeading, setName, setSequenceHeading, setUnitsHeading
 
Methods inherited from class net.agmodel.physical.GeneralSequenceImpl
cancelTemporalInterpolation, dumpSequence, getAllCoverage, getAllData, getCurrentResolution, getDateRange, getMaximumTemporalInterpolation, getResolution, getSubHeading, getSummaryHistory, getSummaryKind, getTemporalInterpolation, getUnitsHeading, setTemporalInterpolation
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.agmodel.weatherData.MetSequence
summarize
 
Methods inherited from interface net.agmodel.physical.CompoundSequence
cancelTemporalInterpolation, getAllCoverage, getAllData, getMaximumTemporalInterpolation, getTemporalInterpolation, setTemporalInterpolation
 
Methods inherited from interface net.agmodel.physical.Sequence
dumpSequence, getCurrentResolution, getDateRange, getResolution, getSubHeading, getSummaryKind, getUnitsHeading
 

Field Detail

meanValues

protected Store meanValues
Constructor Detail

ScalarMaxMinMeanImpl

public ScalarMaxMinMeanImpl(MetElement element,
                            Interval dateRange,
                            SummaryHistory composition,
                            double measurementHeight)
Creates a sequence of maximum, minimum, and mean values. Usually these are daily values, but the object can be used for other data resolutions. Note that some sites assign max and min temperatures recorded on a morning against different days (ie the maximum is assigned to the previous day) This is regarded as a presentation issue for client applications, and this method doesn't implement this behaviour.

Parameters:
element - the meteorological element eg AIRTEMPERATURE or WATERTEMPERATURE
dateRange - the interval for which data is stored
composition - a record of how raw data has been summarised to make the sequence.
measurementHeight - the height in metres;

ScalarMaxMinMeanImpl

public ScalarMaxMinMeanImpl(MetElement element,
                            Interval dateRange,
                            SummaryHistory composition)
Creates a sequence of maximum, minimum, and mean values. Usually these are daily values, but the object can be used for other data resolutions. Note that some sites assign max and min temperatures recorded on a morning against different days (ie the maximum is assigned to the previous day) This is regarded as a presentation issue for client applications, and this method doesn't implement this behaviour. This constructor uses the default height for value measurements.

Parameters:
dateRange - the interval for which data is stored
composition - a record of how raw data has been summarised to make the sequence.
Method Detail

setMeanStore

protected void setMeanStore(Store newMean)

getMeanStore

protected Store getMeanStore()

putMaxMinMean

public void putMaxMinMean(Date time,
                          float maximum,
                          float minimum,
                          float mean)
Puts a maximum, minimum value pair into the sequence.

Parameters:
time - the ending time of the interval over which the measurement was made
maximum - the maximum value in the period preceding this time
minimum - the minimum value in the period preceding this time
mean - the true mean value in the period preceding this time

putMaxMinMeanOverInterval

public void putMaxMinMeanOverInterval(Interval interval,
                                      float maximum,
                                      float minimum,
                                      float mean)
Puts a maximum, minimum value pair into the sequence based on an interval

Parameters:
interval - the interval over which the maximum and minimum were recorded
maximum - the maximum value over the interval
minimum - the minimum value over the interval
mean - the mean value over the interval

putMean

public void putMean(Date time,
                    float mean)
Puts the mean value into the sequence.

Parameters:
time - the ending time of the interval over which the measurement was made.
mean - the mean value in the period preceding this time

putMeanOverInterval

public void putMeanOverInterval(Interval interval,
                                float mean)
Puts the mean value into the sequence based on an interval

Parameters:
interval - the interval over which the maximum was recorded
mean - the mean value during the interval

getAverage

public JigsawQuantity getAverage(Interval interval)
Returns the true mean value over the interval

Overrides:
getAverage in class ScalarMaxMinImpl
Parameters:
interval - the interval of interest
Returns:
the average value during the interval

getInstant

public JigsawQuantity getInstant(Date time)
May estimate the value at a point in time Currently just returns the average value

Overrides:
getInstant in class ScalarMaxMinImpl
Parameters:
time - the time of interest
Returns:
the estimated value at the time

getColumnHeading

public String getColumnHeading()
Deprecated.  

Description copied from interface: Sequence
Returned a localized label for the Sequence

Specified by:
getColumnHeading in interface Sequence
Overrides:
getColumnHeading in class ScalarMaxMinImpl

getNumberOfSubComponents

public int getNumberOfSubComponents()
Description copied from interface: Sequence
Get the number of sub-components in the sequence. This indicates how many "columns" the sequence output will occupy.

Specified by:
getNumberOfSubComponents in interface Sequence
Overrides:
getNumberOfSubComponents in class ScalarMaxMinImpl
Returns:
the number of sub-components
See Also:
Sequence.getSequenceHeading(String)

getSubHeading

public String getSubHeading(int index)
Description copied from interface: CompoundSequence
Gets a brief description of the data stored in a Sequence subcomponent in the language of the default locale. This value can be used as a column sub heading if the sequence is listed. It is assumed to be in the context of an overall column heading.

Specified by:
getSubHeading in interface CompoundSequence
Overrides:
getSubHeading in class ScalarMaxMinImpl
See Also:
Sequence.getNumberOfSubComponents(), Sequence.getSequenceHeading(String)

setSubHeading

public void setSubHeading(int index,
                          String aHeading)
Does nothing

Specified by:
setSubHeading in interface CompoundSequence
Overrides:
setSubHeading in class ScalarMaxMinImpl
Parameters:
aHeading - the new heading
index - the zero-based index of the heading
See Also:
Sequence.getNumberOfSubComponents(), Sequence.getSequenceHeading(String)

getContentsAsString

public String getContentsAsString(Date time,
                                  String delimiter)
Description copied from interface: Sequence
Returns the measurement associated with a particular time as a string. Used by dumpSequence.

Specified by:
getContentsAsString in interface Sequence
Overrides:
getContentsAsString in class ScalarMaxMinImpl
Parameters:
time - the time of interest.
delimiter - a string to use between values if required.

getData

public double[] getData(int index)
Description copied from interface: CompoundSequence
Creates a one-dimensional array containing one subcomponent of the data. Use CompoundSequence.getCoverage(int) to test for missing values (at present these are returned as Double.NaN but don't rely on this).
Note that the first element of the array corresponds to getStart() and is therefore empty in most cases.

Specified by:
getData in interface CompoundSequence
Overrides:
getData in class ScalarMaxMinImpl
Parameters:
index - the zero-based index of the subcomponent
Returns:
the subcomponent as a timeseries array.
See Also:
Sequence.getNumberOfSubComponents()

getCoverage

public float[] getCoverage(int index)
Description copied from interface: CompoundSequence
Indicates which array elements returned by CompoundSequence.getData(int) are missing. Coverage values are in the range JigsawQuantity.DEVOID to JigsawQuantity.COMPLETE.
Note that the first element of the array corresponds to getStart() and is therefore empty in most cases.

Specified by:
getCoverage in interface CompoundSequence
Overrides:
getCoverage in class ScalarMaxMinImpl
Parameters:
index - the zero-based index of the subcomponent
Returns:
a array of the same length as that returned by getData()

clone

public Object clone()
Specified by:
clone in interface Sequence
Overrides:
clone in class ScalarMaxMinImpl