ucar.nc2.dt.point
Class SubsetServiceDataset

java.lang.Object
  extended by ucar.nc2.dt.point.SubsetServiceDataset
All Implemented Interfaces:
PointCollection, PointObsDataset, StationCollection, StationObsDataset, TypedDataset

public class SubsetServiceDataset
extends java.lang.Object
implements StationObsDataset


Constructor Summary
SubsetServiceDataset(java.lang.String ncml, java.lang.String stations)
           
 
Method Summary
 void close()
          Close all resources associated with this dataset.
 Attribute findGlobalAttributeIgnoreCase(java.lang.String name)
           
 LatLonRect getBoundingBox()
           
 java.util.List getData()
          Get all data.
 java.util.List getData(CancelTask cancel)
          Get all data, allow user to cancel.
 java.util.List getData(LatLonRect boundingBox)
          Get all data within the specified bounding box.
 java.util.List getData(LatLonRect boundingBox, CancelTask cancel)
          Get all data within the specified bounding box, allow user to cancel.
 java.util.List getData(LatLonRect boundingBox, java.util.Date start, java.util.Date end)
          Get all data within the specified bounding box and date range.
 java.util.List getData(LatLonRect boundingBox, java.util.Date start, java.util.Date end, CancelTask cancel)
          Get all data within the specified bounding box and date range, allow user to cancel.
 java.util.List getData(java.util.List stations)
          Get all data for a list of Stations.
 java.util.List getData(java.util.List stations, CancelTask cancel)
          Get all data for a list of Stations, allow user to cancel.
 java.util.List getData(java.util.List stations, java.util.Date start, java.util.Date end)
          Get data for a list of Stations within the specified date range.
 java.util.List getData(java.util.List stations, java.util.Date start, java.util.Date end, CancelTask cancel)
          Get data for a list of Stations within the specified date range, allow user to cancel.
 java.util.List getData(Station s)
          Get all data for this Station.
 java.util.List getData(Station s, CancelTask cancel)
          Get all data for this Station, allow user to cancel.
 java.util.List getData(Station s, java.util.Date start, java.util.Date end)
          Get data for this Station within the specified date range.
 java.util.List getData(Station s, java.util.Date start, java.util.Date end, CancelTask cancel)
          Get data for this Station within the specified date range, allow user to cancel.
 java.lang.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.
 DataIterator getDataIterator(Station s)
          Get all data for this Station.
 DataIterator getDataIterator(Station s, java.util.Date start, java.util.Date end)
          Get data for this Station within the specified date range.
 VariableSimpleIF getDataVariable(java.lang.String shortName)
          Get the named data Variable.
 java.util.List getDataVariables()
          The data Variables available in this dataset.
 java.lang.String getDescription()
           
 java.lang.String getDetailInfo()
           
 java.util.Date getEndDate()
           
 java.util.List getGlobalAttributes()
          List of global attributes.
 java.lang.String getLocationURI()
           
 NetcdfFile getNetcdfFile()
           
 java.util.Date getStartDate()
           
 Station getStation(java.lang.String name)
          Find a Station by name
 int getStationDataCount(Station s)
          How many Data objects are available for this Station?
 java.util.List getStations()
          Get all the Stations in the collection.
 java.util.List getStations(CancelTask cancel)
          Get all the Stations in the collection, allow user to cancel.
 java.util.List getStations(LatLonRect boundingBox)
          Get all the Stations within a bounding box.
 java.util.List getStations(LatLonRect boundingBox, CancelTask cancel)
          Get all the Stations within a bounding box, allow user to cancel.
 DateUnit getTimeUnits()
          Get the units of Calendar time.
 java.lang.String getTitle()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SubsetServiceDataset

public SubsetServiceDataset(java.lang.String ncml,
                            java.lang.String stations)
                     throws java.io.IOException
Throws:
java.io.IOException
Method Detail

getTitle

public java.lang.String getTitle()
Specified by:
getTitle in interface TypedDataset
Returns:
Title of the dataset.

getDescription

public java.lang.String getDescription()
Specified by:
getDescription in interface TypedDataset
Returns:
Text information about this dataset.

getLocationURI

public java.lang.String getLocationURI()
Specified by:
getLocationURI in interface TypedDataset
Returns:
The URI location of the dataset

getStartDate

public java.util.Date getStartDate()
Specified by:
getStartDate in interface TypedDataset
Returns:
Start date for the entire dataset.

getEndDate

public java.util.Date getEndDate()
Specified by:
getEndDate in interface TypedDataset
Returns:
End date for the entire dataset.

getBoundingBox

public LatLonRect getBoundingBox()
Specified by:
getBoundingBox in interface TypedDataset
Returns:
he boundingBox for the entire dataset.

getGlobalAttributes

public java.util.List getGlobalAttributes()
Description copied from interface: TypedDataset
List of global attributes.

Specified by:
getGlobalAttributes in interface TypedDataset
Returns:
List of type ucar.nc2.Attribute

findGlobalAttributeIgnoreCase

public Attribute findGlobalAttributeIgnoreCase(java.lang.String name)
Specified by:
findGlobalAttributeIgnoreCase in interface TypedDataset
Parameters:
name - attribute name
Returns:
the global attribute with the given name, ingnoring case.

getDataVariables

public java.util.List getDataVariables()
Description copied from interface: TypedDataset
The data Variables available in this dataset. Should just be data variable others might be searching for, not metadata or coordinate system variables, etc. The shape of this VariableSimpleIF does not necessarily match the

Specified by:
getDataVariables in interface TypedDataset
Returns:
List of type VariableSimpleIF

getDataVariable

public VariableSimpleIF getDataVariable(java.lang.String shortName)
Description copied from interface: TypedDataset
Get the named data Variable.

Specified by:
getDataVariable in interface TypedDataset
Parameters:
shortName - of data Variable.
Returns:
VariableSimpleIF or null.

getNetcdfFile

public NetcdfFile getNetcdfFile()
Specified by:
getNetcdfFile in interface TypedDataset
Returns:
underlying NetcdfFile, or null if none.

close

public void close()
           throws java.io.IOException
Description copied from interface: TypedDataset
Close all resources associated with this dataset.

Specified by:
close in interface TypedDataset
Throws:
java.io.IOException - on I/O error

getDetailInfo

public java.lang.String getDetailInfo()
Specified by:
getDetailInfo in interface TypedDataset
Returns:
debug / underlying implementation details

getDataClass

public java.lang.Class getDataClass()
Description copied from interface: PointCollection
The getData() methods return objects of this Class

Specified by:
getDataClass in interface PointCollection

getTimeUnits

public DateUnit getTimeUnits()
Description copied from interface: PointCollection
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().

Specified by:
getTimeUnits in interface PointCollection

getData

public java.util.List getData()
                       throws java.io.IOException
Description copied from interface: PointCollection
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.

Specified by:
getData in interface PointCollection
Returns:
List of type getDataClass()
Throws:
java.io.IOException
See Also:
as a (possibly) more efficient alternative

getData

public java.util.List getData(CancelTask cancel)
                       throws java.io.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.

Specified by:
getData in interface PointCollection
Parameters:
cancel - allow user to cancel. Implementors should return ASAP.
Returns:
List of type getDataClass()
Throws:
java.io.IOException
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.

Specified by:
getDataCount in interface PointCollection

getData

public java.util.List getData(LatLonRect boundingBox)
                       throws java.io.IOException
Description copied from interface: PointCollection
Get all data within the specified bounding box.

Specified by:
getData in interface PointCollection
Returns:
List of type getDataClass()
Throws:
java.io.IOException
See Also:
as a (possibly) more efficient alternative

getData

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

Specified by:
getData in interface PointCollection
cancel - allow user to cancel. Implementors should return ASAP.
Returns:
List of type getDataClass()
Throws:
java.io.IOException
See Also:
as a (possibly) more efficient alternative

getData

public java.util.List getData(LatLonRect boundingBox,
                              java.util.Date start,
                              java.util.Date end)
                       throws java.io.IOException
Description copied from interface: PointCollection
Get all data within the specified bounding box and date range.

Specified by:
getData in interface PointCollection
Returns:
List of type getDataClass()
Throws:
java.io.IOException
See Also:
as a (possibly) more efficient alternative

getData

public java.util.List getData(LatLonRect boundingBox,
                              java.util.Date start,
                              java.util.Date end,
                              CancelTask cancel)
                       throws java.io.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
cancel - allow user to cancel. Implementors should return ASAP.
Returns:
List of type getDataClass()
Throws:
java.io.IOException
See Also:
as a (possibly) more efficient alternative

getDataIterator

public DataIterator getDataIterator(int bufferSize)
                             throws java.io.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
 }
 

Specified by:
getDataIterator in interface PointCollection
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:
java.io.IOException

getStations

public java.util.List getStations()
                           throws java.io.IOException
Description copied from interface: StationCollection
Get all the Stations in the collection.

Specified by:
getStations in interface StationCollection
Returns:
List of Station
Throws:
java.io.IOException

getStations

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

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

getStations

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

Specified by:
getStations in interface StationCollection
Returns:
List of Station
Throws:
java.io.IOException

getStations

public java.util.List getStations(LatLonRect boundingBox,
                                  CancelTask cancel)
                           throws java.io.IOException
Description copied from interface: StationCollection
Get all the Stations within a bounding box, allow user to cancel.

Specified by:
getStations in interface StationCollection
cancel - allow user to cancel. Implementors should return ASAP.
Returns:
List of Station
Throws:
java.io.IOException

getStation

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

Specified by:
getStation in interface StationCollection

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
Parameters:
s - station
Returns:
count or -1 if unknown.

getData

public java.util.List getData(Station s)
                       throws java.io.IOException
Description copied from interface: StationCollection
Get all data for this Station.

Specified by:
getData in interface StationCollection
Returns:
List of getDataClass()
Throws:
java.io.IOException

getData

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

Specified by:
getData in interface StationCollection
cancel - allow user to cancel. Implementors should return ASAP.
Returns:
List of getDataClass()
Throws:
java.io.IOException

getData

public java.util.List getData(Station s,
                              java.util.Date start,
                              java.util.Date end)
                       throws java.io.IOException
Description copied from interface: StationCollection
Get data for this Station within the specified date range.

Specified by:
getData in interface StationCollection
Returns:
List of getDataClass()
Throws:
java.io.IOException

getData

public java.util.List getData(Station s,
                              java.util.Date start,
                              java.util.Date end,
                              CancelTask cancel)
                       throws java.io.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
cancel - allow user to cancel. Implementors should return ASAP.
Returns:
List of getDataClass()
Throws:
java.io.IOException

getData

public java.util.List getData(java.util.List stations)
                       throws java.io.IOException
Description copied from interface: StationCollection
Get all data for a list of Stations.

Specified by:
getData in interface StationCollection
Returns:
List of getDataClass()
Throws:
java.io.IOException
See Also:
as a (possibly) more efficient alternative

getData

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

Specified by:
getData in interface StationCollection
cancel - allow user to cancel. Implementors should return ASAP.
Returns:
List of getDataClass()
Throws:
java.io.IOException
See Also:
as a (possibly) more efficient alternative

getData

public java.util.List getData(java.util.List stations,
                              java.util.Date start,
                              java.util.Date end)
                       throws java.io.IOException
Description copied from interface: StationCollection
Get data for a list of Stations within the specified date range.

Specified by:
getData in interface StationCollection
Returns:
List of getDataClass()
Throws:
java.io.IOException
See Also:
as a (possibly) more efficient alternative

getData

public java.util.List getData(java.util.List stations,
                              java.util.Date start,
                              java.util.Date end,
                              CancelTask cancel)
                       throws java.io.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
cancel - allow user to cancel. Implementors should return ASAP.
Returns:
List of getDataClass()
Throws:
java.io.IOException
See Also:
as a (possibly) more efficient alternative

getDataIterator

public DataIterator getDataIterator(Station s)
Description copied from interface: StationCollection
Get all data for this Station.

Specified by:
getDataIterator in interface StationCollection
Returns:
iterator over type getDataClass()

getDataIterator

public DataIterator getDataIterator(Station s,
                                    java.util.Date start,
                                    java.util.Date end)
Description copied from interface: StationCollection
Get data for this Station within the specified date range.

Specified by:
getDataIterator in interface StationCollection
Returns:
Iterator over type getDataClass()