ucar.nc2.iosp.adde
Class AddeStationObsDataset

java.lang.Object
  extended by ucar.nc2.dt.TypedDatasetImpl
      extended by ucar.nc2.dt.point.PointObsDatasetImpl
          extended by ucar.nc2.dt.point.StationObsDatasetImpl
              extended by ucar.nc2.iosp.adde.AddeStationObsDataset
All Implemented Interfaces:
PointCollection, PointObsDataset, StationCollection, StationObsDataset, TypedDataset

public class AddeStationObsDataset
extends StationObsDatasetImpl

An adde "point" dataset.

Version:
$Revision: 51 $ $Date: 2006-07-12 17:13:13Z $
Author:
caron

Field Summary
 
Fields inherited from class ucar.nc2.dt.point.StationObsDatasetImpl
stationHelper, stations
 
Fields inherited from class ucar.nc2.dt.point.PointObsDatasetImpl
formatter, timeUnit
 
Fields inherited from class ucar.nc2.dt.TypedDatasetImpl
boundingBox, dataVariables, desc, endDate, location, ncfile, parseInfo, startDate, title
 
Constructor Summary
AddeStationObsDataset(InvAccess access, CancelTask cancelTask)
          Open an ADDE Station Dataset from an InvAccess, which must be type ADDE and Station.
AddeStationObsDataset(String location, CancelTask cancelTask)
          Open an ADDE Station Dataset.
 
Method Summary
 List getData(CancelTask cancel)
          Get all data, allow user to cancel.
 List getData(LatLonRect boundingBox, CancelTask cancel)
          Get all data within the specified bounding box, allow user to cancel.
 List getData(LatLonRect boundingBox, Date start, Date end, CancelTask cancel)
          Get all data within the specified bounding box and date range, allow user to cancel.
 List getData(List stations, CancelTask cancel)
          Get all data for a list of Stations, allow user to cancel.
 List getData(List stations, Date start, Date end, CancelTask cancel)
          Get data for a list of Stations within the specified date range, allow user to cancel.
 List getData(Station s, CancelTask cancel)
          Get all data for this Station, allow user to cancel.
 List getData(Station s, Date start, Date end, CancelTask cancel)
          Get data for this Station within the specified date range, allow user to cancel.
 int getDataCount()
          Get estimate of number of data records (may not be exact).
 DataIterator getDataIterator(int bufferSize)
          Get an efficient iterator over all the data in the Collection.
 int getStationDataCount(Station s)
          How many Data objects are available for this Station?
 List getStations(CancelTask cancel)
          Get all the Stations in the collection, allow user to cancel.
static void main(String[] args)
           
protected  void setBoundingBox()
           
protected  void setEndDate()
           
protected  void setStartDate()
           
protected  void setTimeUnits()
           
 
Methods inherited from class ucar.nc2.dt.point.StationObsDatasetImpl
getData, getData, getData, getData, getDataClass, getDataIterator, getDataIterator, getDetailInfo, getScientificDataType, getStation, getStations, getStations, getStations, sortByTime
 
Methods inherited from class ucar.nc2.dt.point.PointObsDatasetImpl
getData, getData, getData, getMetersConversionFactor, getTime, getTimeUnits
 
Methods inherited from class ucar.nc2.dt.TypedDatasetImpl
close, findGlobalAttributeIgnoreCase, getBoundingBox, getDataVariable, getDataVariables, getDescription, getEndDate, getGlobalAttributes, getLocation, getLocationURI, getNetcdfFile, getStartDate, getTitle, removeDataVariable, setDescription, setLocationURI, setTitle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ucar.nc2.dt.TypedDataset
close, findGlobalAttributeIgnoreCase, getBoundingBox, getDataVariable, getDataVariables, getDescription, getEndDate, getGlobalAttributes, getLocationURI, getNetcdfFile, getStartDate, getTitle
 
Methods inherited from interface ucar.nc2.dt.PointCollection
getData, getData, getData, getTimeUnits
 

Constructor Detail

AddeStationObsDataset

public AddeStationObsDataset(InvAccess access,
                             CancelTask cancelTask)
                      throws IOException
Open an ADDE Station Dataset from an InvAccess, which must be type ADDE and Station.

Parameters:
access - open Invdataset from this access.
Throws:
IOException

AddeStationObsDataset

public AddeStationObsDataset(String location,
                             CancelTask cancelTask)
                      throws IOException
Open an ADDE Station Dataset.

Parameters:
location - location of file. This is a URL string, or a local pathname.
Throws:
IOException
Method Detail

setTimeUnits

protected void setTimeUnits()
Specified by:
setTimeUnits in class PointObsDatasetImpl

setStartDate

protected void setStartDate()
Specified by:
setStartDate in class TypedDatasetImpl

setEndDate

protected void setEndDate()
Specified by:
setEndDate in class TypedDatasetImpl

setBoundingBox

protected void setBoundingBox()
Specified by:
setBoundingBox in class TypedDatasetImpl

getStations

public List getStations(CancelTask cancel)
                 throws IOException
Description copied from interface: StationCollection
Get all the Stations in the collection, allow user to cancel.

Specified by:
getStations in interface StationCollection
Overrides:
getStations in class StationObsDatasetImpl
Parameters:
cancel - allow user to cancel. Implementors should return ASAP.
Returns:
List of Station
Throws:
IOException - on io error

getStationDataCount

public int getStationDataCount(Station s)
Description copied from interface: StationCollection
How many Data objects are available for this Station?

Specified by:
getStationDataCount in interface StationCollection
Overrides:
getStationDataCount in class StationObsDatasetImpl
Parameters:
s - station
Returns:
count or -1 if unknown.

getData

public List getData(CancelTask cancel)
             throws IOException
Description copied from interface: PointCollection
Get all data, allow user to cancel. Return null if too expensive to implement. Call getDataCount() to get estimate of size. This will return a list of getDataClass(), but the actual data may or may not already be read in to memory. In any case, you call dataType.getData() to get the data.

Parameters:
cancel - allow user to cancel. Implementors should return ASAP.
Returns:
List of type getDataClass()
Throws:
IOException - on io error
See Also:
as a (possibly) more efficient alternative

getDataCount

public int getDataCount()
Description copied from interface: PointCollection
Get estimate of number of data records (may not be exact). Return -1 if not able to estimate.

Returns:
number of data records or -1

getData

public List getData(Station s,
                    CancelTask cancel)
             throws IOException
Description copied from interface: StationCollection
Get all data for this Station, allow user to cancel.

Parameters:
s - for this Station
cancel - allow user to cancel. Implementors should return ASAP.
Returns:
List of getDataClass()
Throws:
IOException - on io error

getData

public List getData(Station s,
                    Date start,
                    Date end,
                    CancelTask cancel)
             throws IOException
Description copied from interface: StationCollection
Get data for this Station within the specified date range, allow user to cancel.

Specified by:
getData in interface StationCollection
Overrides:
getData in class StationObsDatasetImpl
Parameters:
s - for this Station
start - restrict data to after this time
end - restrict data to before this time
cancel - allow user to cancel. Implementors should return ASAP.
Returns:
List of getDataClass()
Throws:
IOException - on io error

getData

public List getData(List stations,
                    CancelTask cancel)
             throws IOException
Description copied from interface: StationCollection
Get all data for a list of Stations, allow user to cancel.

Specified by:
getData in interface StationCollection
Overrides:
getData in class StationObsDatasetImpl
Parameters:
stations - for these Stations
cancel - allow user to cancel. Implementors should return ASAP.
Returns:
List of getDataClass()
Throws:
IOException - on io error
See Also:
as a (possibly) more efficient alternative

getData

public List getData(List stations,
                    Date start,
                    Date end,
                    CancelTask cancel)
             throws IOException
Description copied from interface: StationCollection
Get data for a list of Stations within the specified date range, allow user to cancel.

Specified by:
getData in interface StationCollection
Overrides:
getData in class StationObsDatasetImpl
Parameters:
stations - for these Stations
start - restrict data to after this time
end - restrict data to before this time
cancel - allow user to cancel. Implementors should return ASAP.
Returns:
List of getDataClass()
Throws:
IOException - on io error
See Also:
as a (possibly) more efficient alternative

getData

public List getData(LatLonRect boundingBox,
                    CancelTask cancel)
             throws IOException
Description copied from interface: PointCollection
Get all data within the specified bounding box, allow user to cancel.

Specified by:
getData in interface PointCollection
Overrides:
getData in class StationObsDatasetImpl
Parameters:
boundingBox - restrict data to this bounding nox
cancel - allow user to cancel. Implementors should return ASAP.
Returns:
List of type getDataClass()
Throws:
IOException - on io error
See Also:
as a (possibly) more efficient alternative

getData

public List getData(LatLonRect boundingBox,
                    Date start,
                    Date end,
                    CancelTask cancel)
             throws IOException
Description copied from interface: PointCollection
Get all data within the specified bounding box and date range, allow user to cancel.

Specified by:
getData in interface PointCollection
Overrides:
getData in class StationObsDatasetImpl
Parameters:
boundingBox - restrict data to this bounding nox
start - restrict data to after this time
end - restrict data to before this time
cancel - allow user to cancel. Implementors should return ASAP.
Returns:
List of type getDataClass()
Throws:
IOException - on io error
See Also:
as a (possibly) more efficient alternative

main

public static void main(String[] args)

getDataIterator

public DataIterator getDataIterator(int bufferSize)
                             throws IOException
Description copied from interface: PointCollection
Get an efficient iterator over all the data in the Collection. You must fully process the data, or copy it out of the StructureData, as you iterate over it. DO NOT KEEP ANY REFERENCES to the dataType object or the StructureData object.

This is the efficient way to get all the data, it can be 100 times faster than getData(). This will return an iterator over type getDataClass(), and the actual data has already been read into memory, that is, dataType.getData() will not incur any I/O. This is accomplished by buffering bufferSize amount of data at once.

We dont need a cancelTask, just stop the iteration if the user want to cancel.

Example for point observations:
 

Iterator iter = pointObsDataset.getDataIterator(); while (iter.hasNext()) { PointObsDatatype pobs = (PointObsDatatype) iter.next(); StructureData sdata = pobs.getData(); // process fully }

Parameters:
bufferSize - if > 0, the internal buffer size, else use the default. Typically 100k - 1M for best results.
Returns:
iterator over type getDataClass(), no guarenteed order.
Throws:
IOException - on io error


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