net.agmodel.weatherData
Class RHImpl

java.lang.Object
  |
  +--net.agmodel.physical.GeneralSequenceImpl
        |
        +--net.agmodel.weatherData.GeneralMetSequenceImpl
              |
              +--net.agmodel.weatherData.RHImpl
All Implemented Interfaces:
Cloneable, CompoundSequence, Humidity, MetSequence, ScalarQuantity, Sequence, Serializable

public class RHImpl
extends GeneralMetSequenceImpl
implements Humidity

Humidity manages a sequence of water vapour measurements. It stores these measurements in their original form (eg RH measurements are stored as RH) and provides methods for calculating the others. The getInstant and getValueOverInterval methods return RH measurements - descendent classes handle wet and dry bulb temperature pairs. A link to a temperature class is used for calculations like dewpoint temperature.

See Also:
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
RHImpl(Interval dateRange, SummaryHistory composition, AirTemperature temperature)
           
 
Method Summary
 RHImpl average(Duration newResolution)
          Creates a new RH sequence, averaging RH to a lower resolution.
static double calcDewpointFromRH(double drybulb, double rh)
          Estimates the dew point temperature from dry bulb temperature and rh.
static double calcTcFromVapourPressure(double vp)
          Estimates the temperature for a given vapor pressure.
static double calcVapourPressure(double t)
          Estimates the vapour pressure for a given temperature From Weather Algorithms Index
 Object clone()
          Note that this method does not clone the linked Temperature sequence - the clone refers to the existing one.
 JigsawQuantity getAverage(Interval interval)
          Returns the average humidity over the interval.
 JigsawQuantity getAverageDewpoint(Interval interval)
          Returns the average dewpoint temperature over the interval.
 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)
          Returns the instantaneous humidity at a particular point in time.
 JigsawQuantity getInstantDewpoint(Date time)
          Returns the instantaneous dewpoint temperature at a particular point in time.
 JigsawQuantity getMaximum(Interval interval)
          Returns the maximum humidity over the interval.
 JigsawQuantity getMinimum(Interval interval)
          Returns the minimum humidity over the interval.
 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 putInstantRH(Date time, float value)
          Records the instantaneous humidity at a particular time
 void putRHOverInterval(Interval interval, float value)
          Records the humidity over some subinterval.
static double saturatedVapourPressure(double temperature)
          Source: "Evapotranspiration and Irrigation Water Requirements" American Society of Civil Engineers, 1990
protected  void setStore(Store newStore)
           
 void setSubHeading(int index, String aHeading)
          Does nothing
 void setTemperatureSequence(AirTemperature temperature)
           
 MetSequence summarize(Duration longerResolution)
          Creates a lower resolution sequence which summarizes this sequence
static double vapourPressureDeficit(double t, double rH)
           
 
Methods inherited from class net.agmodel.weatherData.GeneralMetSequenceImpl
getColumnHeading, 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, getMaximumTemporalInterpolation, getTemporalInterpolation, getUnitsHeading, setSequenceHeading, setTemporalInterpolation, setUnitsHeading
 
Methods inherited from interface net.agmodel.physical.Sequence
dumpSequence, getColumnHeading, getCurrentResolution, getDateRange, getName, getResolution, getSequenceHeading, getSubHeading, getSummaryKind, getUnitsHeading, setColumnHeading, setName
 

Constructor Detail

RHImpl

public RHImpl(Interval dateRange,
              SummaryHistory composition,
              AirTemperature temperature)
Method Detail

setStore

protected void setStore(Store newStore)

setTemperatureSequence

public void setTemperatureSequence(AirTemperature temperature)

saturatedVapourPressure

public static double saturatedVapourPressure(double temperature)
Source: "Evapotranspiration and Irrigation Water Requirements" American Society of Civil Engineers, 1990


vapourPressureDeficit

public static double vapourPressureDeficit(double t,
                                           double rH)

calcVapourPressure

public static double calcVapourPressure(double t)
Estimates the vapour pressure for a given temperature From Weather Algorithms Index

Returns:
the corresponding vapour pressure in millibars

calcTcFromVapourPressure

public static double calcTcFromVapourPressure(double vp)
Estimates the temperature for a given vapor pressure. From Weather Algorithms Index

Parameters:
vp - the vapour pressure in millibars
Returns:
the corresponding temperature in Celsius

calcDewpointFromRH

public static double calcDewpointFromRH(double drybulb,
                                        double rh)
Estimates the dew point temperature from dry bulb temperature and rh. From Weather Algorithms Index

Parameters:
drybulb - the temperature in Celsius
rh - the relative humidity in %
Returns:
the corresponding dewpoint temperature in Celsius

putInstantRH

public void putInstantRH(Date time,
                         float value)
Records the instantaneous humidity at a particular time

Parameters:
time - the point in time
value - the humidity at that time
Throws:
IllegalArgumentException - if the time is outside the interval that the period is intended to store

putRHOverInterval

public void putRHOverInterval(Interval interval,
                              float value)
Records the humidity over some subinterval.

Parameters:
interval - the period of time over which the measurement was taken.
value - the humidity over that interval
Throws:
IllegalArgumentException - if the subinterval is outside the interval that the sequence was constructed to store

getMinimum

public JigsawQuantity getMinimum(Interval interval)
Description copied from interface: Humidity
Returns the minimum humidity over the interval. Humidity readings 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:
getMinimum in interface Humidity
Returns:
the minimum value

getMaximum

public JigsawQuantity getMaximum(Interval interval)
Description copied from interface: Humidity
Returns the maximum humidity over the interval. Humidity readings 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:
getMaximum in interface Humidity
Returns:
the maximum value

getInstant

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

Specified by:
getInstant in interface Humidity
Returns:
the instantaneous value

getAverage

public JigsawQuantity getAverage(Interval interval)
Description copied from interface: Humidity
Returns the average humidity over the interval. Humidity readings 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:
getAverage in interface Humidity
Returns:
the average value

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
Specified by:
getContentsAsString in class GeneralSequenceImpl
Parameters:
time - the time of interest.
delimiter - a string to use between values if required.

average

public RHImpl average(Duration newResolution)
Creates a new RH sequence, averaging RH to a lower resolution. After this call, can not use getDewpoint because the answer won't be correct. Might be better to restrict RH to sample only - need to review whole area of derived non-linear values particularly in the case of humidity.

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

getInstantDewpoint

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

Specified by:
getInstantDewpoint in interface Humidity
Returns:
the instantaneous value in degrees C

getAverageDewpoint

public JigsawQuantity getAverageDewpoint(Interval interval)
Description copied from interface: Humidity
Returns the average dewpoint temperature over the interval. calculated dewpoints 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:
getAverageDewpoint in interface Humidity
Returns:
the average 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
Specified by:
getNumberOfSubComponents in class GeneralMetSequenceImpl
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
Specified by:
getSubHeading in class GeneralMetSequenceImpl
See Also:
Sequence.getNumberOfSubComponents(), Sequence.getSequenceHeading(String)

setSubHeading

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

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

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
Specified by:
getData in class GeneralSequenceImpl
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
Specified by:
getCoverage in class GeneralSequenceImpl
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()
Note that this method does not clone the linked Temperature sequence - the clone refers to the existing one. If you also clone the AirTemperature sequence, you should then call {#link #setTemperatureSequence(AirTemperature) on the clone}

Specified by:
clone in interface Sequence
Overrides:
clone in class GeneralSequenceImpl