net.agmodel.weatherData
Class WindProfileImpl

java.lang.Object
  |
  +--net.agmodel.physical.GeneralSequenceImpl
        |
        +--net.agmodel.weatherData.GeneralMetSequenceImpl
              |
              +--net.agmodel.weatherData.MultiImpl
                    |
                    +--net.agmodel.weatherData.WindProfileImpl
All Implemented Interfaces:
Cloneable, CompoundSequence, MetSequence, MultiQuantity, Sequence, Serializable, Wind

public class WindProfileImpl
extends MultiImpl
implements Wind

Stores a sequence of wind readings including speed and/or direction at various heights. Wind speeds are stored internally in m/s. If height index is not specified (eg in methods implementing the Wind interface) height[0] data is used.

See Also:
if you only want to deal with surface wind., Serialized Form

Field Summary
 
Fields inherited from class net.agmodel.weatherData.GeneralMetSequenceImpl
rb
 
Fields inherited from class net.agmodel.physical.GeneralSequenceImpl
dateRange, maximumTemporalInterpolation, summaryHistory
 
Constructor Summary
WindProfileImpl(Interval dateRange, SummaryHistory composition, double[] heights, String heightUnits)
          Creates a set of wind sequences which can store speed and/or direction at various heights.
 
Method Summary
 WindProfileImpl average(Duration newResolution)
          Creates a new wind profile sequence, averaging winds to a lower resolution.
 JigsawQuantity getAverageSpeed(Interval interval)
          Returns the average wind speed over the interval.
 JigsawQuantity getAverageSpeed(int index, Interval 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.
 String getHeightUnits()
          Gets the units for the wind measurement height.
 JigsawQuantity getInstantDirection(Date time)
          Returns the instantaneous wind speed at a particular point in time.
 JigsawQuantity getInstantDirection(int index, Date time)
           
 JigsawQuantity getInstantSpeed(Date time)
          Returns the instantaneous wind speed at a particular point in time.
 JigsawQuantity getInstantSpeed(int index, Date time)
           
 JigsawQuantity getMaxSpeed(Interval interval)
          Returns the maximum wind speed over the interval.
 JigsawQuantity getMaxSpeed(int index, Interval interval)
           
 double getMeasurementHeight()
          Gets the height of the wind measurement
 double getMeasurementHeight(int index)
           
 double[] getMeasurementHeights()
           
 JigsawQuantity getMinSpeed(Interval interval)
          Returns the minimum wind speed over the interval.
 JigsawQuantity getMinSpeed(int index, Interval interval)
           
 int getNumberOfSubComponents()
          Get the number of sub-components in the sequence.
 float[] getRose(Interval interval, int divisions)
          Returns the distribution of wind directions as an array.
 float[] getRose(int index, Interval interval, int divisions)
           
 String getSubHeading(int index)
          Gets a brief description of the data stored in a Sequence subcomponent in the language of the default locale.
 JigsawQuantity getWindRun(Interval interval)
          Returns the total windrun over the interval.
 JigsawQuantity getWindRun(int index, Interval interval)
           
 boolean hasDirection()
          Returns whether wind direction data are stored in the sequence
 boolean hasDirection(int index)
           
 boolean hasSpeed()
          Returns whether wind speed data are stored in the sequence
 boolean hasSpeed(int index)
           
 void putInstantDirection(int index, Date time, float value)
          Records the instantaneous wind direction.
 void putInstantSpeed(int index, Date time, float value)
          Records the instantaneous wind speed at the lowest height at a particular time
 void putSpeedOverInterval(int index, Interval interval, float value)
          Records the average wind speed at the lowest height over some subinterval.
 void putWindRun(int index, Interval interval, float valuekm)
          Records the wind run over some subinterval.
protected  void setDirectionStore(int index, Store newDir)
           
 void setSubHeading(int index, String aHeading)
          Does nothing
 MetSequence summarize(Duration longerResolution)
          Creates a lower resolution sequence which summarizes this sequence
 
Methods inherited from class net.agmodel.weatherData.MultiImpl
clone, getAverage, getCoverage, getData, getInstant, getMaximum, getMinimum, getStore, putInstantValue, putValueOverInterval, setStore
 
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
getSequenceElement
 
Methods inherited from interface net.agmodel.physical.CompoundSequence
cancelTemporalInterpolation, getAllCoverage, getAllData, getCoverage, getData, getMaximumTemporalInterpolation, getTemporalInterpolation, getUnitsHeading, setSequenceHeading, setTemporalInterpolation, setUnitsHeading
 
Methods inherited from interface net.agmodel.physical.Sequence
clone, dumpSequence, getCurrentResolution, getDateRange, getName, getResolution, getSequenceHeading, getSubHeading, getSummaryKind, getUnitsHeading, setColumnHeading, setName
 

Constructor Detail

WindProfileImpl

public WindProfileImpl(Interval dateRange,
                       SummaryHistory composition,
                       double[] heights,
                       String heightUnits)
Creates a set of wind sequences which can store speed and/or direction at various heights.

Parameters:
dateRange - the interval over which wind speeds can be stored
composition - a record of how raw wind data has been summarised to make the sequence.
heights - an array containing measurement heights in ascending order.
heightUnits - the units for height (at this stage just a string).
Method Detail

setDirectionStore

protected void setDirectionStore(int index,
                                 Store newDir)

hasSpeed

public boolean hasSpeed()
Description copied from interface: Wind
Returns whether wind speed data are stored in the sequence

Specified by:
hasSpeed in interface Wind
Returns:
true if wind speed data are stored, false otherwise

hasDirection

public boolean hasDirection()
Description copied from interface: Wind
Returns whether wind direction data are stored in the sequence

Specified by:
hasDirection in interface Wind
Returns:
true if wind direction data are stored, false otherwise

hasSpeed

public boolean hasSpeed(int index)

hasDirection

public boolean hasDirection(int index)

getMeasurementHeights

public double[] getMeasurementHeights()

getMeasurementHeight

public double getMeasurementHeight(int index)

getHeightUnits

public String getHeightUnits()
Description copied from interface: Wind
Gets the units for the wind measurement height.

Specified by:
getHeightUnits in interface Wind
Returns:
the height units

putInstantSpeed

public void putInstantSpeed(int index,
                            Date time,
                            float value)
Records the instantaneous wind speed at the lowest height at a particular time

Parameters:
index - the height of interest
time - the point in time
value - the wind speed at that time
Throws:
IllegalArgumentException - if the time is outside the interval that the period is intended to store

putSpeedOverInterval

public void putSpeedOverInterval(int index,
                                 Interval interval,
                                 float value)
Records the average wind speed at the lowest height over some subinterval.

Parameters:
index - the height of interest
interval - the period of time over which the measurement was taken.
value - the average wind speed over that interval
Throws:
IllegalArgumentException - if the subinterval is outside the interval that the sequence was constructed to store

putWindRun

public void putWindRun(int index,
                       Interval interval,
                       float valuekm)
Records the wind run over some subinterval.

Parameters:
interval - the period of time over which the measurement was taken.
valuekm - the wind run in km over that interval
Throws:
IllegalArgumentException - if the subinterval is outside the interval that the sequence was constructed to store

getMinSpeed

public JigsawQuantity getMinSpeed(int index,
                                  Interval interval)

getMaxSpeed

public JigsawQuantity getMaxSpeed(int index,
                                  Interval interval)

getInstantSpeed

public JigsawQuantity getInstantSpeed(int index,
                                      Date time)

getAverageSpeed

public JigsawQuantity getAverageSpeed(int index,
                                      Interval interval)

getWindRun

public JigsawQuantity getWindRun(int index,
                                 Interval interval)

putInstantDirection

public void putInstantDirection(int index,
                                Date time,
                                float value)
Records the instantaneous wind direction.

Parameters:
time - the that the direction was measured.
value - the wind direction at that time.
Throws:
IllegalArgumentException - if the subinterval is outside the interval that the sequence was constructed to store

getRose

public float[] getRose(int index,
                       Interval interval,
                       int divisions)

getInstantDirection

public JigsawQuantity getInstantDirection(int index,
                                          Date 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 GeneralMetSequenceImpl

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 MultiImpl
Parameters:
time - the time of interest.
delimiter - a string to use between values if required.

average

public WindProfileImpl average(Duration newResolution)
Creates a new wind profile sequence, averaging winds to a lower resolution. The instaneous wind directions at the end of the subinterval is used in the new sequence.

Parameters:
newResolution - the target resolution required.
Returns:
a new rainfall sequence

getMeasurementHeight

public double getMeasurementHeight()
Description copied from interface: Wind
Gets the height of the wind measurement

Specified by:
getMeasurementHeight in interface Wind
Returns:
the height, in units expressed by Wind.getHeightUnits()

getMinSpeed

public JigsawQuantity getMinSpeed(Interval interval)
Description copied from interface: Wind
Returns the minimum wind speed over the interval. Wind speeds at either end of the interval are included in the comparison if more than 50% of their duration lies within the interval of interest.

Specified by:
getMinSpeed in interface Wind
Returns:
the minimum wind speed (m/s)

getMaxSpeed

public JigsawQuantity getMaxSpeed(Interval interval)
Description copied from interface: Wind
Returns the maximum wind speed over the interval. Sequence values at either end of the interval are included in the comparison if more than 50% of their duration lies within the interval of interest.

Specified by:
getMaxSpeed in interface Wind
Returns:
the maximum wind speed (m/s)

getInstantSpeed

public JigsawQuantity getInstantSpeed(Date time)
Description copied from interface: Wind
Returns the instantaneous wind speed at a particular point in time. If interpolation is requested, the value may be spatially and/or temporally interpolated from other data.

Specified by:
getInstantSpeed in interface Wind
Returns:
the instantaneous wind speed (m/s)

getInstantDirection

public JigsawQuantity getInstantDirection(Date time)
Description copied from interface: Wind
Returns the instantaneous wind speed at a particular point in time. If interpolation is requested, the value may be spatially and/or temporally interpolated from other data.

Specified by:
getInstantDirection in interface Wind
Returns:
the instantaneous direction (in degrees)

getAverageSpeed

public JigsawQuantity getAverageSpeed(Interval interval)
Description copied from interface: Wind
Returns the average wind speed over the interval. Wind speeds at either end of the interval are included by weighting their values according to the proportion of their duration that lies in the period of interest.

Specified by:
getAverageSpeed in interface Wind
Returns:
the average wind speed (m/s)

getWindRun

public JigsawQuantity getWindRun(Interval interval)
Description copied from interface: Wind
Returns the total windrun over the interval. Wind speeds at either end of the interval are included by weighting their values according to the proportion of their duration that lies in the period of interest.

Specified by:
getWindRun in interface Wind
Returns:
the total wind run (km)

getRose

public float[] getRose(Interval interval,
                       int divisions)
Description copied from interface: Wind
Returns the distribution of wind directions as an array. The first array element indicates the proportion of time (0-1) that the wind was coming from a direction between 0 and 360/(number of classes) ) The range is one sided, including 0 but not 360/n.

Specified by:
getRose in interface Wind
Parameters:
interval - the period of interest.
divisions - the number of classes in the resulting array
Returns:
the instantaneous value

summarize

public MetSequence summarize(Duration longerResolution)
Description copied from interface: MetSequence
Creates a lower resolution sequence which summarizes this sequence

Specified by:
summarize in interface MetSequence
Parameters:
longerResolution - the new resolution to summarize to
Returns:
a summarized sequence.

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 MultiImpl
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 MultiImpl
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 MultiImpl
Parameters:
aHeading - the new heading
index - the zero-based index of the heading
See Also:
Sequence.getNumberOfSubComponents(), Sequence.getSequenceHeading(String)