net.agmodel.weatherData
Class StationDataSetImpl

java.lang.Object
  |
  +--net.agmodel.physical.DataSetImpl
        |
        +--net.agmodel.weatherData.StationDataSetImpl
All Implemented Interfaces:
DataSet, Serializable, ServerResult, StationDataSet

public class StationDataSetImpl
extends DataSetImpl
implements StationDataSet, ServerResult

Encapsulates a set of met data from a single station for a given period, resolution

See Also:
Serialized Form

Field Summary
protected  String metSourceID
           
protected  Duration serverProcessingTime
           
protected  WeatherStation station
           
 
Fields inherited from class net.agmodel.physical.DataSetImpl
interval, resolution, sequences
 
Constructor Summary
StationDataSetImpl(String metSourceID, WeatherStation station, Interval interval, Duration resolution)
          Creates a data set without any data in it.
 
Method Summary
 void addSequence(MetSequence sequenceToAdd)
          Adds a weather data sequence into the data set.
 String getDSSAT(File outputDirectory, String instituteCode, String siteCode, TimeZone tz, String needDailyData, String noData)
          Writes the data into DSSAT v3.5 format weather data files.
 String getICASA(String instituteCode, String siteCode, TimeZone tz, String needDailyData, String noData)
          Gets a string containing ICASA format data.
protected  String getICASAID()
           
 String getMetSourceID()
          Gets the identifier of the metsource that the data came from.
 MetSequence getSequence(MetElement element)
          Gets the data, if it exists, for a particular weather element.
protected  Sequence[] getSequenceArray()
          Overides DataSetImpl getSequenceArray to list columns in same order as MetElements
 Duration getServerProcessingTime()
          Get the elapsed time taken by MetBroker and various databases to handle the request.\ This lumps together MetBroker's processing time (usually minimal), query processing on data sources (variable) and transmission time of data from the data source to MetBroker (often the slowest step).
 WeatherStation getWeatherStation()
          Get the details of the weather station that the data comes from
protected static String leftPad(String input, int desiredLength)
           
protected static String leftPad(String padchar, String input, int desiredLength)
           
 void setProcessingTime(Duration processingTime)
          Used by MetBroker to record the duration of processing time
 
Methods inherited from class net.agmodel.physical.DataSetImpl
addSequence, dumpDuration, getInterval, getNumberOfRows, getNumberOfSequences, getResolution, getSequence, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.agmodel.physical.DataSet
dumpDuration, getInterval, getNumberOfRows, getNumberOfSequences, getResolution, getSequence
 

Field Detail

metSourceID

protected String metSourceID

station

protected WeatherStation station

serverProcessingTime

protected Duration serverProcessingTime
Constructor Detail

StationDataSetImpl

public StationDataSetImpl(String metSourceID,
                          WeatherStation station,
                          Interval interval,
                          Duration resolution)
Creates a data set without any data in it. Usually not used by client applications.

Parameters:
metSourceID - the identifier assigned to the met source by MetBroker
station - the basic station details
Method Detail

addSequence

public void addSequence(MetSequence sequenceToAdd)
Adds a weather data sequence into the data set. The sequence should be of the same resolution as the data set. Each data set should contain only one sequence for each interface


getSequence

public MetSequence getSequence(MetElement element)
Gets the data, if it exists, for a particular weather element.

Specified by:
getSequence in interface StationDataSet
Parameters:
element - the weather element of interest.
Returns:
a concrete implementation of Sequence, or null if not data exists for that element.

setProcessingTime

public void setProcessingTime(Duration processingTime)
Used by MetBroker to record the duration of processing time


getServerProcessingTime

public Duration getServerProcessingTime()
Description copied from interface: StationDataSet
Get the elapsed time taken by MetBroker and various databases to handle the request.\ This lumps together MetBroker's processing time (usually minimal), query processing on data sources (variable) and transmission time of data from the data source to MetBroker (often the slowest step).

Specified by:
getServerProcessingTime in interface StationDataSet
Returns:
the elapsed time between when MetBroker receives the query and when it begins to return the answer.

getWeatherStation

public WeatherStation getWeatherStation()
Description copied from interface: StationDataSet
Get the details of the weather station that the data comes from

Specified by:
getWeatherStation in interface StationDataSet
Returns:
the location and period of operation of the station.

getMetSourceID

public String getMetSourceID()
Gets the identifier of the metsource that the data came from.

Specified by:
getMetSourceID in interface StationDataSet
Returns:
the met source identifier

getSequenceArray

protected Sequence[] getSequenceArray()
Overides DataSetImpl getSequenceArray to list columns in same order as MetElements

Overrides:
getSequenceArray in class DataSetImpl
Returns:
an array of sequences

getICASAID

protected String getICASAID()

leftPad

protected static String leftPad(String padchar,
                                String input,
                                int desiredLength)

leftPad

protected static String leftPad(String input,
                                int desiredLength)

getICASA

public String getICASA(String instituteCode,
                       String siteCode,
                       TimeZone tz,
                       String needDailyData,
                       String noData)
                throws SecurityException
Description copied from interface: StationDataSet
Gets a string containing ICASA format data.

Specified by:
getICASA in interface StationDataSet
Parameters:
instituteCode - a two letter institute code
siteCode - a two letter site code, allocated by the institute to the site
tz - the timezone for the output dates and times
needDailyData - a string explaining that daily data is needed
noData - a string to display if no data is available
Returns:
an ICASA format string, ready to be put into a file.
SecurityException
See Also:
ICASA standards

getDSSAT

public String getDSSAT(File outputDirectory,
                       String instituteCode,
                       String siteCode,
                       TimeZone tz,
                       String needDailyData,
                       String noData)
                throws IOException
Description copied from interface: StationDataSet
Writes the data into DSSAT v3.5 format weather data files.

Specified by:
getDSSAT in interface StationDataSet
Parameters:
outputDirectory - the directory in which to write output files
instituteCode - a two letter institute code
siteCode - a two letter site code, allocated by the institute to the site
tz - the timezone for the output dates and times
needDailyData - a string explaining that daily data is needed
noData - a string to display if no data is available
Returns:
a null string if successful, or an error message.
IOException
See Also:
ICASA standards