visad.data.netcdf.in
Class CfView

java.lang.Object
  extended byvisad.data.netcdf.in.View
      extended byvisad.data.netcdf.in.CfView

final class CfView
extends View

A view of a netCDF dataset according to the Climate and Forecast (CF) conventions.

If this class can't be initialized, then an error message is printed to System.err and the JVM is terminated.

See Also:
http://www.cgd.ucar.edu/cms/eaton/netcdf/CF-current.htm

Nested Class Summary
(package private)  class CfView.DataIterator
          Iterates over the virtual VisAD data objects in a netCDF dataset according to the CF conventions.
 
Nested classes inherited from class visad.data.netcdf.in.View
View.Domain
 
Constructor Summary
(package private) CfView(Netcdf netcdf, QuantityDB quantDb)
          Constructs from a netCDF dataset and a quantity database.
(package private) CfView(Netcdf netcdf, QuantityDB quantDb, boolean charToText)
          Constructs from a netCDF dataset and a quantity database.
 
Method Summary
protected  View.Domain getDomain(Variable var)
          Returns the domain of a netCDF variable.
protected  RealType getRealType(Variable var)
          Return the VisAD RealType of a netCDF variable.
protected  Unit getUnitFromAttribute(Variable var)
          Returns the unit of a netCDF variable according to the variable's unit attribute.
protected  String getUnitString(Variable var)
          Returns the string value of the unit attribute of a netCDF variable.
 VirtualDataIterator getVirtualDataIterator()
          Gets an iterator over the virtual VisAD data objects determined by this view.
protected  boolean isIgnorable(Variable var)
          Indicates if a given variable should be ignored during iteration.
 
Methods inherited from class visad.data.netcdf.in.View
getAttributeString, getAttributeString, getConventionsString, getCoordinateVariable, getData, getData, getDimensions, getDomainSet, getInstance, getInstance, getLongName, getNetcdf, getOuterDimensionNameSet, getRangeSet, getRealType, getRealTypeFromLongName, getRealTypeFromName, getScalarType, getTextType, getVariable, getVetter, isCharToText, isCoordinateVariable, isLatitude, isLongitude, isLongitude, isNumeric, isNumeric, isTime, isTime, newName, setOuterDimensionNameSet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CfView

CfView(Netcdf netcdf,
       QuantityDB quantDb)
Constructs from a netCDF dataset and a quantity database. The quantity database will be supplemented with another database specific to this view.

Parameters:
netcdf - The netCDF dataset.
quantDb - The default quantity database.
Throws:
NullPointerException - if the netCDF dataset argument is null.
IllegalArgumentException - if the netCDF dataset doesn't follow the conventions of this view.

CfView

CfView(Netcdf netcdf,
       QuantityDB quantDb,
       boolean charToText)
Constructs from a netCDF dataset and a quantity database. The quantity database will be supplemented with another database specific to this view.

Parameters:
netcdf - The netCDF dataset.
quantDb - The default quantity database.
charToText - Convert char variables to Text if true
Throws:
NullPointerException - if the netCDF dataset argument is null.
IllegalArgumentException - if the netCDF dataset doesn't follow the conventions of this view.
Method Detail

getUnitString

protected String getUnitString(Variable var)
Returns the string value of the unit attribute of a netCDF variable. Returns null if the unit attribute is missing or invalid. Because the CF netCDF convention requires the use of the unit attribute, this method prints a warning message to System.err if the variable doesn't have a unit attribute.

Overrides:
getUnitString in class View
Parameters:
var - A netCDF variable.
Returns:
The unit of the values of var or null.

getUnitFromAttribute

protected Unit getUnitFromAttribute(Variable var)

Returns the unit of a netCDF variable according to the variable's unit attribute. Returns null if the unit attribute is missing or invalid.

This implementation uses getUnitString(Variable) and View.getUnitFromAttribute(Variable).

Overrides:
getUnitFromAttribute in class View
Parameters:
var - A netCDF variable.
Returns:
The unit of var or null.
Throws:
NullPointerException - if the variable is null.

getRealType

protected RealType getRealType(Variable var)
                        throws TypeException

Return the VisAD RealType of a netCDF variable. If the variable is a type of timestamp and references a non-supported calendar system, then a warning message is printed to System.err and an attempt is made to create a new RealType with a different name.

This implementation uses * View#getRealType(Variable).

Overrides:
getRealType in class View
Parameters:
var - The netCDF variable.
Returns:
The VisAD RealType of var.
Throws:
TypeException - if a corresponding RealType needed to be created but couldn't.

getVirtualDataIterator

public VirtualDataIterator getVirtualDataIterator()
Gets an iterator over the virtual VisAD data objects determined by this view.

Overrides:
getVirtualDataIterator in class View
Returns:
An iterator for the virtual VisAD data objects in the view.

isIgnorable

protected boolean isIgnorable(Variable var)

Indicates if a given variable should be ignored during iteration.

This implementation returns the logical "or" of View.isCoordinateVariable(Variable), #isAuxCoordVar(Variable), and #isBoundaryVar(Variable).

Specified by:
isIgnorable in class View
Returns:
true if and only if the variable should be ignored.

getDomain

protected View.Domain getDomain(Variable var)
                         throws TypeException,
                                IOException
Returns the domain of a netCDF variable. This method supports CF auxilliary coordinate variables.

Specified by:
getDomain in class View
Parameters:
var - A netCDF variable.
Returns:
The domain of the given variable.
Throws:
NullPointerException - if the variable is null.
IllegalArgumentException - if the rank of the variable is zero.
TypeException - if a RealType needed to be created but couldn't.
IOException - if a netCDF read-error occurs.