ucar.nc2.ft.point
Class StationTimeSeriesCollectionImpl

java.lang.Object
  extended by ucar.nc2.ft.point.OneNestedPointCollectionImpl
      extended by ucar.nc2.ft.point.StationTimeSeriesCollectionImpl
All Implemented Interfaces:
FeatureCollection, NestedPointFeatureCollection, StationCollection, StationTimeSeriesFeatureCollection
Direct Known Subclasses:
CompositeStationCollection, RemoteStationCollection, StandardStationCollectionImpl

public abstract class StationTimeSeriesCollectionImpl
extends OneNestedPointCollectionImpl
implements StationTimeSeriesFeatureCollection

Abstract superclass for implementations of StationFeatureCollection. Subclass must supply initStationHelper, may need to override getPointFeatureCollectionIterator().

Since:
Feb 5, 2008
Author:
caron

Field Summary
protected  PointFeatureCollectionIterator localIterator
           
protected  StationHelper stationHelper
           
 
Fields inherited from class ucar.nc2.ft.point.OneNestedPointCollectionImpl
npts
 
Constructor Summary
StationTimeSeriesCollectionImpl(String name)
           
 
Method Summary
 void finish()
          Make sure that the internal iterator is complete, and recover resources.
 PointFeatureCollection flatten(LatLonRect boundingBox, DateRange dateRange)
          Flatten into a PointFeatureCollection, discarding connectedness information.
 PointFeatureCollection flatten(List<String> stations, DateRange dateRange, List<VariableSimpleIF> varList)
          Flatten into a PointFeatureCollection, discarding connectedness information.
 LatLonRect getBoundingBox()
          Get the bounding box including all the stations.
 NestedPointFeatureCollectionIterator getNestedPointFeatureCollectionIterator(int bufferSize)
          Iterate through the collection, composed of NestedPointFeatureCollection.
 PointFeatureCollectionIterator getPointFeatureCollectionIterator(int bufferSize)
          Iterate through the collection, composed of PointFeatureCollection.
 Station getStation(PointFeature feature)
          Get the station that belongs to this feature
 Station getStation(String name)
          Find a Station by name.
 StationTimeSeriesFeature getStationFeature(Station s)
          Get the collection of data for a particular Station.
 List<Station> getStations()
          Get all the Stations in the collection.
 List<Station> getStations(LatLonRect boundingBox)
          Get all the Stations within a bounding box.
 List<Station> getStations(List<String> stnNames)
          Translate list of station names to list of Stations.
 boolean hasNext()
          Use the internal iterator to check if there is another StationTimeSeriesFeature in the iteration.
protected abstract  void initStationHelper()
           
 StationTimeSeriesFeature next()
          Use the internal iterator to get the next StationTimeSeriesFeature in the iteration.
 void resetIteration()
          Reset the internal iterator for another iteration over the StationTimeSeriesFeatures in this Collection.
 StationTimeSeriesFeatureCollection subset(LatLonRect boundingBox)
          Get a subsetted StationCollection from a LatLonRect
 StationTimeSeriesFeatureCollection subset(List<Station> stations)
          Get a subsetted StationCollection based on a list of Stations.
 
Methods inherited from class ucar.nc2.ft.point.OneNestedPointCollectionImpl
getCollectionFeatureType, getName, isMultipleNested, setSize, size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ucar.nc2.ft.NestedPointFeatureCollection
isMultipleNested, size
 
Methods inherited from interface ucar.nc2.ft.FeatureCollection
getCollectionFeatureType, getName
 

Field Detail

stationHelper

protected StationHelper stationHelper

localIterator

protected PointFeatureCollectionIterator localIterator
Constructor Detail

StationTimeSeriesCollectionImpl

public StationTimeSeriesCollectionImpl(String name)
Method Detail

initStationHelper

protected abstract void initStationHelper()

getPointFeatureCollectionIterator

public PointFeatureCollectionIterator getPointFeatureCollectionIterator(int bufferSize)
                                                                 throws IOException
Description copied from interface: NestedPointFeatureCollection
Iterate through the collection, composed of PointFeatureCollection. Use this only if isMultipleNested() = false.

Specified by:
getPointFeatureCollectionIterator in interface NestedPointFeatureCollection
Parameters:
bufferSize - how many bytes can be used to buffer data, use -1 to use default.
Returns:
an iterator through PointFeatureCollection objects.
Throws:
IOException - on read error

getStationFeature

public StationTimeSeriesFeature getStationFeature(Station s)
                                           throws IOException
Description copied from interface: StationTimeSeriesFeatureCollection
Get the collection of data for a particular Station.

Specified by:
getStationFeature in interface StationTimeSeriesFeatureCollection
Parameters:
s - get data for this station, must have come from this Collection
Returns:
collection of data for this Station.
Throws:
IOException - on i/o error

getStation

public Station getStation(PointFeature feature)
                   throws IOException
Description copied from interface: StationTimeSeriesFeatureCollection
Get the station that belongs to this feature

Specified by:
getStation in interface StationTimeSeriesFeatureCollection
Parameters:
feature - PointFeature obtained from a StationTimeSeriesFeature in this collection
Returns:
the Station is belongs to
Throws:
IOException - on i/o error

subset

public StationTimeSeriesFeatureCollection subset(LatLonRect boundingBox)
                                          throws IOException
Description copied from interface: StationTimeSeriesFeatureCollection
Get a subsetted StationCollection from a LatLonRect

Specified by:
subset in interface NestedPointFeatureCollection
Specified by:
subset in interface StationTimeSeriesFeatureCollection
Parameters:
boundingBox - spatial subset. may be null
Returns:
subsetted collection
Throws:
IOException - on i/o error

subset

public StationTimeSeriesFeatureCollection subset(List<Station> stations)
                                          throws IOException
Description copied from interface: StationTimeSeriesFeatureCollection
Get a subsetted StationCollection based on a list of Stations.

Specified by:
subset in interface StationTimeSeriesFeatureCollection
Parameters:
stations - only contain these stations
Returns:
subsetted collection
Throws:
IOException - on i/o error

flatten

public PointFeatureCollection flatten(List<String> stations,
                                      DateRange dateRange,
                                      List<VariableSimpleIF> varList)
                               throws IOException
Description copied from interface: StationTimeSeriesFeatureCollection
Flatten into a PointFeatureCollection, discarding connectedness information.

Specified by:
flatten in interface StationTimeSeriesFeatureCollection
Parameters:
stations - only contain these stations; if null or empty use all
dateRange - only points in this date range. may be null.
varList - only these member variables. may be null. currently ignored
Returns:
a PointFeatureCollection, may be null if its empty.
Throws:
IOException - on read error

flatten

public PointFeatureCollection flatten(LatLonRect boundingBox,
                                      DateRange dateRange)
                               throws IOException
Description copied from interface: NestedPointFeatureCollection
Flatten into a PointFeatureCollection, discarding connectedness information. Optionally subset.

Specified by:
flatten in interface NestedPointFeatureCollection
Overrides:
flatten in class OneNestedPointCollectionImpl
Parameters:
boundingBox - only points in this lat/lon bounding box. may be null.
dateRange - only points in this date range. may be null.
Returns:
a PointFeatureCollection, may be null if its empty.
Throws:
IOException - on read error

getStations

public List<Station> getStations()
Description copied from interface: StationCollection
Get all the Stations in the collection.

Specified by:
getStations in interface StationCollection
Returns:
List of Station

getStations

public List<Station> getStations(List<String> stnNames)
Description copied from interface: StationCollection
Translate list of station names to list of Stations. Skip any not found

Specified by:
getStations in interface StationCollection
Parameters:
stnNames - list of stnNames
Returns:
corresponding list of Stations

getStations

public List<Station> getStations(LatLonRect boundingBox)
                          throws IOException
Description copied from interface: StationCollection
Get all the Stations within a bounding box.

Specified by:
getStations in interface StationCollection
Parameters:
boundingBox - spatial subset
Returns:
List of Station
Throws:
IOException - on i/o error

getStation

public Station getStation(String name)
Description copied from interface: StationCollection
Find a Station by name.

Specified by:
getStation in interface StationCollection
Parameters:
name - name/id of the station
Returns:
Station or null if not found

getBoundingBox

public LatLonRect getBoundingBox()
Description copied from interface: StationCollection
Get the bounding box including all the stations.

Specified by:
getBoundingBox in interface StationCollection
Returns:
bounding box as a LatLonRect

getNestedPointFeatureCollectionIterator

public NestedPointFeatureCollectionIterator getNestedPointFeatureCollectionIterator(int bufferSize)
                                                                             throws IOException
Description copied from interface: NestedPointFeatureCollection
Iterate through the collection, composed of NestedPointFeatureCollection. Use this only if isMultipleNested() = true.

Specified by:
getNestedPointFeatureCollectionIterator in interface NestedPointFeatureCollection
Overrides:
getNestedPointFeatureCollectionIterator in class OneNestedPointCollectionImpl
Parameters:
bufferSize - how many bytes can be used to buffer data, use -1 to use default.
Returns:
an iterator through NestedPointFeatureCollection objects.
Throws:
IOException - on read error

hasNext

public boolean hasNext()
                throws IOException
Description copied from interface: StationTimeSeriesFeatureCollection
Use the internal iterator to check if there is another StationTimeSeriesFeature in the iteration.

Specified by:
hasNext in interface StationTimeSeriesFeatureCollection
Returns:
true is there is another StationTimeSeriesFeature in the iteration.
Throws:
IOException - on read error

finish

public void finish()
Description copied from interface: StationTimeSeriesFeatureCollection
Make sure that the internal iterator is complete, and recover resources. You must complete the iteration (until hasNext() returns false) or call finish().

Specified by:
finish in interface StationTimeSeriesFeatureCollection
See Also:
PointFeatureIterator.finish()

next

public StationTimeSeriesFeature next()
                              throws IOException
Description copied from interface: StationTimeSeriesFeatureCollection
Use the internal iterator to get the next StationTimeSeriesFeature in the iteration. You must call hasNext() before you call this.

Specified by:
next in interface StationTimeSeriesFeatureCollection
Returns:
the next StationTimeSeriesFeature in the iteration
Throws:
IOException - on read error

resetIteration

public void resetIteration()
                    throws IOException
Description copied from interface: StationTimeSeriesFeatureCollection
Reset the internal iterator for another iteration over the StationTimeSeriesFeatures in this Collection.

Specified by:
resetIteration in interface StationTimeSeriesFeatureCollection
Throws:
IOException - on read error


Copyright © 1999-2011 UCAR/Unidata. All Rights Reserved.