ucar.nc2.dt.point
Class RecordDatasetHelper

java.lang.Object
  extended by ucar.nc2.dt.point.RecordDatasetHelper

public class RecordDatasetHelper
extends java.lang.Object

Helper class for using the netcdf-3 record dimension. Can be used for PointObs or StationObs.

Author:
caron

Nested Class Summary
 class RecordDatasetHelper.RecordPointObs
           
 class RecordDatasetHelper.RecordStationObs
           
 
Field Summary
protected  double altScaleFactor
           
protected  java.lang.String altVName
           
protected  LatLonRect boundingBox
           
protected  java.lang.StringBuffer errs
           
protected  java.lang.String latVName
           
protected  java.lang.String lonVName
           
protected  double maxDate
           
protected  double minDate
           
protected  NetcdfDataset ncfile
           
protected  java.lang.String nomTimeVName
           
protected  Dimension obsDim
           
protected  java.lang.String obsTimeVName
           
protected  StructureDS recordVar
           
protected  boolean showErrors
           
protected  DataType stationIdType
           
protected  java.lang.String stnDescVName
           
protected  java.util.Map<java.lang.Object,Station> stnHash
           
protected  java.lang.String stnIdVName
           
protected  java.lang.String stnNameVName
           
protected  DateUnit timeUnit
           
 
Constructor Summary
RecordDatasetHelper(NetcdfDataset ncfile, java.lang.String obsTimeVName, java.lang.String nomTimeVName, java.util.List typedDataVariables)
          Constructor.
RecordDatasetHelper(NetcdfDataset ncfile, java.lang.String obsTimeVName, java.lang.String nomTimeVName, java.util.List typedDataVariables, java.lang.StringBuffer errBuffer)
           
RecordDatasetHelper(NetcdfDataset ncfile, java.lang.String obsTimeVName, java.lang.String nomTimeVName, java.util.List typedDataVariables, java.lang.String recDimName, java.lang.StringBuffer errBuffer)
          Constructor.
 
Method Summary
 java.util.List getData(java.util.ArrayList records, LatLonRect boundingBox, CancelTask cancel)
           
 java.util.List getData(java.util.ArrayList records, LatLonRect boundingBox, double startTime, double endTime, CancelTask cancel)
           
 int getRecordCount()
           
 Structure getRecordVar()
           
 DateUnit getTimeUnit()
           
 java.util.ArrayList readAllCreateObs(CancelTask cancel)
          This reads through all the records in the dataset, and constructs a list of RecordPointObs or RecordStationObs.
 void setLocationInfo(java.lang.String latVName, java.lang.String lonVName, java.lang.String altVName)
           
 void setShortNames(java.lang.String latVName, java.lang.String lonVName, java.lang.String altVName, java.lang.String obsTimeVName, java.lang.String nomTimeVName)
           
 void setStationInfo(java.lang.String stnIdVName, java.lang.String stnDescVName)
          Set extra information used by station obs datasets.
 void setTimeUnit(DateUnit timeUnit)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ncfile

protected NetcdfDataset ncfile

obsTimeVName

protected java.lang.String obsTimeVName

nomTimeVName

protected java.lang.String nomTimeVName

stnIdVName

protected java.lang.String stnIdVName

stnNameVName

protected java.lang.String stnNameVName

stnDescVName

protected java.lang.String stnDescVName

latVName

protected java.lang.String latVName

lonVName

protected java.lang.String lonVName

altVName

protected java.lang.String altVName

stationIdType

protected DataType stationIdType

stnHash

protected java.util.Map<java.lang.Object,Station> stnHash

recordVar

protected StructureDS recordVar

obsDim

protected Dimension obsDim

boundingBox

protected LatLonRect boundingBox

minDate

protected double minDate

maxDate

protected double maxDate

timeUnit

protected DateUnit timeUnit

altScaleFactor

protected double altScaleFactor

errs

protected java.lang.StringBuffer errs

showErrors

protected boolean showErrors
Constructor Detail

RecordDatasetHelper

public RecordDatasetHelper(NetcdfDataset ncfile,
                           java.lang.String obsTimeVName,
                           java.lang.String nomTimeVName,
                           java.util.List typedDataVariables)
Constructor.

Parameters:
ncfile - the netccdf file
typedDataVariables - list of data variables; all record variables will be added to this list, except . You can remove extra
obsTimeVName - observation time variable name (required)
nomTimeVName - nominal time variable name (may be null)
Throws:
java.lang.IllegalArgumentException - if ncfile has no unlimited dimension.

RecordDatasetHelper

public RecordDatasetHelper(NetcdfDataset ncfile,
                           java.lang.String obsTimeVName,
                           java.lang.String nomTimeVName,
                           java.util.List typedDataVariables,
                           java.lang.StringBuffer errBuffer)

RecordDatasetHelper

public RecordDatasetHelper(NetcdfDataset ncfile,
                           java.lang.String obsTimeVName,
                           java.lang.String nomTimeVName,
                           java.util.List typedDataVariables,
                           java.lang.String recDimName,
                           java.lang.StringBuffer errBuffer)
Constructor.

Parameters:
ncfile - the netccdf file
typedDataVariables - list of data variables; all record variables will be added to this list, except . You can remove extra
obsTimeVName - observation time variable name (required)
nomTimeVName - nominal time variable name (may be null)
Throws:
java.lang.IllegalArgumentException - if ncfile has no unlimited dimension and recDimName is null.
Method Detail

setStationInfo

public void setStationInfo(java.lang.String stnIdVName,
                           java.lang.String stnDescVName)
Set extra information used by station obs datasets.

Parameters:
stnIdVName - the obs variable that is used to find the station in the stnHash; may be type int or a String (char).
stnDescVName - optional station var containing station description

setLocationInfo

public void setLocationInfo(java.lang.String latVName,
                            java.lang.String lonVName,
                            java.lang.String altVName)

getRecordVar

public Structure getRecordVar()

getRecordCount

public int getRecordCount()

setTimeUnit

public void setTimeUnit(DateUnit timeUnit)

getTimeUnit

public DateUnit getTimeUnit()

readAllCreateObs

public java.util.ArrayList readAllCreateObs(CancelTask cancel)
                                     throws java.io.IOException
This reads through all the records in the dataset, and constructs a list of RecordPointObs or RecordStationObs. It does not cache the data.

If stnIdVName is not null, its a StationDataset, then construct a Station HashMap of StationImpl objects. Add the RecordStationObs into the list of obs for that station.

Parameters:
cancel - allow user to cancel
Returns:
List of RecordPointObs or RecordStationObs
Throws:
java.io.IOException

setShortNames

public void setShortNames(java.lang.String latVName,
                          java.lang.String lonVName,
                          java.lang.String altVName,
                          java.lang.String obsTimeVName,
                          java.lang.String nomTimeVName)

getData

public java.util.List getData(java.util.ArrayList records,
                              LatLonRect boundingBox,
                              CancelTask cancel)
                       throws java.io.IOException
Throws:
java.io.IOException

getData

public java.util.List getData(java.util.ArrayList records,
                              LatLonRect boundingBox,
                              double startTime,
                              double endTime,
                              CancelTask cancel)
                       throws java.io.IOException
Throws:
java.io.IOException