ucar.nc2.dt
Interface PointCollection

All Known Subinterfaces:
PointObsDataset, StationCollection, StationObsDataset, StationRadialDataset
All Known Implementing Classes:
AddeStationObsDataset, CFstationObsDataset, DapperDataset, DqcStationObsDataset, MadisPointObsDataset, MadisStationObsDataset, NdbcDataset, OldUnidataPointObsDataset, OldUnidataStationObsDataset, PointObsDatasetImpl, SequenceObsDataset, StationObsDatasetImpl, UnidataPointObsDataset, UnidataStationObsDataset, UnidataStationObsDataset2, UnidataStationObsMultidimDataset

public interface PointCollection

A collection of data at unconnected locations. User can subset by bounding box and by date range. Underlying data can be of any type, but all points have the same type.

Author:
caron

Method Summary
 List getData()
          Get all data.
 List getData(CancelTask cancel)
          Get all data, allow user to cancel.
 List getData(LatLonRect boundingBox)
          Get all data within the specified bounding box.
 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)
          Get all data within the specified bounding box and date range.
 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.
 Class getDataClass()
          The getData() methods return objects of this Class
 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.
 DateUnit getTimeUnits()
          Get the units of Calendar time.
 

Method Detail

getDataClass

Class getDataClass()
The getData() methods return objects of this Class

Returns:
Class of the data

getTimeUnits

DateUnit getTimeUnits()
Get the units of Calendar time. To get a Date, from a time value, call DateUnit.makeDate(double value). To get units as a String, call DateUnit.getUnitsString().

Returns:
the units of Calendar time.

getData

List getData()
             throws IOException
Get all data. 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.

Returns:
List of type getDataClass()
Throws:
IOException - on io error
See Also:
as a (possibly) more efficient alternative

getData

List getData(CancelTask cancel)
             throws IOException
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

int getDataCount()
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

List getData(LatLonRect boundingBox)
             throws IOException
Get all data within the specified bounding box.

Parameters:
boundingBox - restrict data to this bounding nox
Returns:
List of type getDataClass()
Throws:
IOException - on io error
See Also:
as a (possibly) more efficient alternative

getData

List getData(LatLonRect boundingBox,
             CancelTask cancel)
             throws IOException
Get all data within the specified bounding box, allow user to cancel.

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

List getData(LatLonRect boundingBox,
             Date start,
             Date end)
             throws IOException
Get all data within the specified bounding box and date range.

Parameters:
boundingBox - restrict data to this bounding nox
start - restrict data to after this time
end - restrict data to before this time
Returns:
List of type getDataClass()
Throws:
IOException - on io error
See Also:
as a (possibly) more efficient alternative

getData

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

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

getDataIterator

DataIterator getDataIterator(int bufferSize)
                             throws IOException
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.