net.agmodel.weatherData
Class WeatherStation

java.lang.Object
  |
  +--net.agmodel.weatherData.WeatherStation
All Implemented Interfaces:
Comparable, Serializable

public final class WeatherStation
extends Object
implements Serializable, Comparable

A serializable representation of a place that weather data records are associated with. Sometimes weather stations are moved, but retain the same identifier, or are renamed. In this situation the most recent location or name are associated with the weather station. This is a compromise between accuracy and simplicity. The class is made final because it overrides the equals method. If any classes extend this and add a field then the equals method of this class is likely to not be transitive.

See Also:
Serialized Form

Constructor Summary
WeatherStation(String stationID, String placeName, Location location, Period operational, Duration shortestResolution, boolean[][] catalog)
          Creates a new WeatherStation object in situations where the metSourceDetails are not available and the station isn't part of a region
WeatherStation(String metSourceID, String metSourceName, String stationID, String placeName, Location location, Period operational, Duration shortestResolution)
          Creates a new WeatherStation object
WeatherStation(String regionID, String regionName, String stationID, String placeName, Location location, Period operational, Duration shortestResolution, boolean[][] catalog)
          Creates a new WeatherStation object in situations where the metSourceDetails are not available
WeatherStation(String metSourceID, String metSourceName, String regionID, String regionName, String stationID, String placeName, Location location, Period operational, Duration shortestResolution)
          Creates a new WeatherStation object
WeatherStation(String metSourceID, String metSourceName, String regionID, String regionName, String stationID, String placeName, Location location, Period operational, Duration shortestResolution, boolean[][] catalog)
          Creates a new WeatherStation object
 
Method Summary
 int compareTo(Object a)
          Stations are compared by location, and then by operational period (earlier first)
 boolean equals(Object o)
          Tests whether two objects represent the same weather station.
 double getAltitude()
           
 boolean[][] getCatalog()
          Get a catalog indicating which elements the station has ever recorded, and at which resolution(s).
 String getHostID()
          Deprecated. use getStationID() instead
 double getLatitude()
           
 double getLongitude()
           
 String getMetSourceID()
           
 String getMetSourceName()
           
 Period getOperational()
           
 Place getPlace()
           
 String getPlaceName()
           
 String getRegionID()
           
 String getRegionName()
           
 Duration getShortestResolution()
           
 String getStationID()
           
 boolean hasElementAtResolution(MetElement element, MetDuration resolution)
          Whether a station has ever recorded an element at a particular resolution.
 int hashCode()
           
 void setMetSourceDetails(String metSourceID, String metSourceName)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WeatherStation

public WeatherStation(String metSourceID,
                      String metSourceName,
                      String stationID,
                      String placeName,
                      Location location,
                      Period operational,
                      Duration shortestResolution)
Creates a new WeatherStation object

Parameters:
metSourceID - an identifier for the host database that this station came from
metSourceName - the name of the database (in the client's preferred language)
stationID - the identifier used for this station on its host database
placeName - the name of the place (in the client's preferred language)
location - the station location
operational - the period over which the station has operated
shortestResolution - the shortest resolution data recorded at the station

WeatherStation

public WeatherStation(String metSourceID,
                      String metSourceName,
                      String regionID,
                      String regionName,
                      String stationID,
                      String placeName,
                      Location location,
                      Period operational,
                      Duration shortestResolution)
Creates a new WeatherStation object

Parameters:
metSourceID - an identifier for the host database that this station came from
metSourceName - the name of the database (in the client's preferred language)
regionID - an identifier for the region within the host database, if any, that this station is part of
regionName - the name of the region (in the client's preferred language)
stationID - the identifier used for this station on its host database
placeName - the name of the place (in the client's preferred language)
location - the station location
operational - the period over which the station has operated
shortestResolution - the shortest resolution data recorded at the station

WeatherStation

public WeatherStation(String metSourceID,
                      String metSourceName,
                      String regionID,
                      String regionName,
                      String stationID,
                      String placeName,
                      Location location,
                      Period operational,
                      Duration shortestResolution,
                      boolean[][] catalog)
Creates a new WeatherStation object

Parameters:
metSourceID - an identifier for the host database that this station came from
metSourceName - the name of the database (in the client's preferred language)
regionID - an identifier for the region within the host database, if any, that this station is part of
regionName - the name of the region (in the client's preferred language)
stationID - the identifier used for this station on its host database
placeName - the name of the place (in the client's preferred language)
operational - the period over which the station has operated
shortestResolution - the shortest resolution data recorded at the station
catalog - an array indicating which elements have ever been recorded and at what resolution. The first index corresponds to MetDuration.ord and the second to MetElement.ord

WeatherStation

public WeatherStation(String regionID,
                      String regionName,
                      String stationID,
                      String placeName,
                      Location location,
                      Period operational,
                      Duration shortestResolution,
                      boolean[][] catalog)
Creates a new WeatherStation object in situations where the metSourceDetails are not available

Parameters:
regionID - an identifier for the region within the host database, if any, that this station is part of
regionName - the name of the region (in the client's preferred language)
stationID - the identifier used for this station on its host database
placeName - the name of the place (in the client's preferred language)
operational - the period over which the station has operated
shortestResolution - the shortest resolution data recorded at the station
catalog - an array indicating which elements have ever been recorded and at what resolution. The first index corresponds to MetDuration.ord and the second to MetElement.ord
See Also:
for a useful companion method.

WeatherStation

public WeatherStation(String stationID,
                      String placeName,
                      Location location,
                      Period operational,
                      Duration shortestResolution,
                      boolean[][] catalog)
Creates a new WeatherStation object in situations where the metSourceDetails are not available and the station isn't part of a region

Parameters:
stationID - the identifier used for this station on its host database
placeName - the name of the place (in the client's preferred language)
operational - the period over which the station has operated
shortestResolution - the shortest resolution data recorded at the station
catalog - an array indicating which elements have ever been recorded and at what resolution. The first index corresponds to MetDuration.ord and the second to MetElement.ord
See Also:
for a useful companion method.
Method Detail

getOperational

public Period getOperational()

getHostID

public String getHostID()
Deprecated. use getStationID() instead

returns the identifier used for the station (not the host database)


getStationID

public String getStationID()

getShortestResolution

public Duration getShortestResolution()

getRegionName

public String getRegionName()

getRegionID

public String getRegionID()

compareTo

public int compareTo(Object a)
Stations are compared by location, and then by operational period (earlier first)

Specified by:
compareTo in interface Comparable

getPlace

public Place getPlace()

getLongitude

public double getLongitude()

getLatitude

public double getLatitude()

getAltitude

public double getAltitude()

getPlaceName

public String getPlaceName()

toString

public String toString()
Overrides:
toString in class Object

getCatalog

public boolean[][] getCatalog()
Get a catalog indicating which elements the station has ever recorded, and at which resolution(s).
Note that this only shows data that is available from this station through MetBroker.
The first index in the returned array corresponds to MetElement.ord. The second index corresponds to MetDuration.ord.

Returns:
the corresponding array element is true if the element is available at the specified resolution at any time in the station's history

hasElementAtResolution

public boolean hasElementAtResolution(MetElement element,
                                      MetDuration resolution)
Whether a station has ever recorded an element at a particular resolution.
Note that this only shows data that is available from this station through MetBroker.

Parameters:
element - the element of interest
resolution - the resolution of interest
Returns:
true if the element is available at the specified resolution at any time in the station's history

setMetSourceDetails

public void setMetSourceDetails(String metSourceID,
                                String metSourceName)

getMetSourceID

public String getMetSourceID()

getMetSourceName

public String getMetSourceName()

equals

public boolean equals(Object o)
Tests whether two objects represent the same weather station.

Overrides:
equals in class Object
Parameters:
o - the other object
Returns:
true if the other object is a WeatherStation with the same metsourceID and stationID (case sensitive)

hashCode

public int hashCode()
Overrides:
hashCode in class Object