ucar.nc2.dataset
Class CoordinateAxis1DTime

java.lang.Object
  extended by ucar.nc2.Variable
      extended by ucar.nc2.dataset.VariableDS
          extended by ucar.nc2.dataset.CoordinateAxis
              extended by ucar.nc2.dataset.CoordinateAxis1D
                  extended by ucar.nc2.dataset.CoordinateAxis1DTime
All Implemented Interfaces:
java.lang.Comparable, Enhancements, EnhanceScaleMissing, VariableEnhanced, VariableIF, VariableSimpleIF

public class CoordinateAxis1DTime
extends CoordinateAxis1D

A 1-dimensional Coordinate Axis representing Calendar time. Its coordinate values can be represented as Dates. May use udunit dates, or ISO Strings.

Version:
$Revision: 70 $ $Date: 2006-07-13 15:16:05Z $
Author:
caron

Nested Class Summary
 
Nested classes/interfaces inherited from class ucar.nc2.dataset.CoordinateAxis1D
CoordinateAxis1D.NamedAnything
 
Nested classes/interfaces inherited from class ucar.nc2.dataset.CoordinateAxis
CoordinateAxis.AxisComparator
 
Nested classes/interfaces inherited from class ucar.nc2.Variable
Variable.Cache
 
Field Summary
 
Fields inherited from class ucar.nc2.dataset.CoordinateAxis1D
named
 
Fields inherited from class ucar.nc2.dataset.CoordinateAxis
axisType, boundaryRef, isContiguous, positive, POSITIVE_DOWN, POSITIVE_UP
 
Fields inherited from class ucar.nc2.Variable
attributes, cache, dataType, debugCaching, defaultSizeToCache, dimensions, elementSize, group, isCoordinateAxis, isMetadata, isSection, isSlice, isVlen, ncfile, orgVar, parent, scalarIndex, sectionRanges, shape, shortName, sizeToCache, sliceDim, sliceRanges
 
Constructor Summary
CoordinateAxis1DTime(VariableDS org, java.lang.StringBuffer errMessages)
          Constructor.
 
Method Summary
 int findTimeIndexFromDate(java.util.Date d)
          Given a Date, find the corresponding time index on the time coordinate axis.
 DateRange getDateRange()
           
 java.util.Date[] getTimeDates()
          Get the list of times as Dates.
 TimeUnit getTimeResolution()
          only if isRegular() LOOK REDO
 Variable section(java.util.List section)
          Create a new Variable that is a logical subsection of this Variable.
 
Methods inherited from class ucar.nc2.dataset.CoordinateAxis1D
findCoordElement, findCoordElement, findCoordElementBounded, findCoordElementBounded, getBound1, getBound2, getCoordEdge, getCoordEdges, getCoordEdges, getCoordName, getCoordValue, getCoordValues, getIncrement, getIndex, getMaxValue, getMinValue, getNames, getStart, isLayer, isRegular, section, setLayer
 
Methods inherited from class ucar.nc2.dataset.CoordinateAxis
cacheOK, compareTo, equals, factory, getAxisType, getBoundaryRef, getInfo, getPositive, getUnitsString, hashCode, isContiguous, isNumeric, setAxisType, setBoundaryRef, setContiguous, setPositive
 
Methods inherited from class ucar.nc2.dataset.VariableDS
_read, _read, _readMemberData, addCoordinateSystem, convertScaleOffsetMissing, convertScaleOffsetMissing, convertScaleOffsetMissing, convertScaleOffsetMissing, convertScaleOffsetMissing, enhance, getCoordinateSystems, getDescription, getOriginalDataType, getProxyReader, getUnitString, getValidMax, getValidMin, hasFillValue, hasInvalidData, hasMissing, hasMissingValue, hasScaleOffset, isEnhanced, isFillValue, isInvalidData, isMissing, isMissingValue, removeCoordinateSystem, setFillValueIsMissing, setInvalidDataIsMissing, setMissingDataIsMissing, setProxyReader, setUnitsString, setUseNaNs, slice
 
Methods inherited from class ucar.nc2.Variable
addAttribute, attributes, calcIsCoordinateVariable, extraInfo, findAttribute, findAttributeIgnoreCase, findDimensionIndex, getAttributes, getCoordinateDimension, getDataType, getDimension, getDimensions, getDimensionsAll, getDimensionsString, getElementSize, getIOVar, getName, getNameAndDimensions, getNameAndDimensions, getParentGroup, getParentStructure, getRanges, getRank, getSectionRanges, getShape, getShortName, getSize, getSizeToCache, getSPobject, hasCachedData, invalidateCache, isCaching, isMemberOfStructure, isMetadata, isScalar, isSection, isUnknownLength, isUnlimited, isUnsigned, isVariableLength, makeSection, makeSectionAddParents, makeSectionRanges, makeSectionWithParents, makeSlice, makeSliceRanges, read, read, read, read, readAllStructures, readAllStructuresSpec, readScalarByte, readScalarDouble, readScalarFloat, readScalarInt, readScalarLong, readScalarShort, readScalarString, remove, replaceDimension, setCachedData, setCaching, setDataType, setDimension, setDimensions, setDimensions, setDimensionsAnonymous, setElementSize, setIOVar, setIsCoordinateAxis, setName, setParentGroup, setParentStructure, setSizeToCache, setSPobject, toString, toStringDebug, writeCDL
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ucar.nc2.VariableSimpleIF
findAttributeIgnoreCase, getAttributes, getDataType, getDimensions, getName, getRank, getShape, getShortName
 
Methods inherited from interface ucar.nc2.VariableIF
findAttribute, findAttributeIgnoreCase, findDimensionIndex, getAttributes, getCoordinateDimension, getDataType, getDimension, getDimensions, getDimensionsAll, getElementSize, getName, getNameAndDimensions, getParentGroup, getParentStructure, getRanges, getRank, getShape, getShortName, getSize, isMemberOfStructure, isMetadata, isScalar, isUnlimited, isUnsigned, isVariableLength, read, read, read, read, readAllStructures, readAllStructuresSpec, readScalarByte, readScalarDouble, readScalarFloat, readScalarInt, readScalarLong, readScalarShort, readScalarString, toStringDebug
 

Constructor Detail

CoordinateAxis1DTime

public CoordinateAxis1DTime(VariableDS org,
                            java.lang.StringBuffer errMessages)
                     throws java.io.IOException
Constructor.

Parameters:
org - the underlying Variable
errMessages - put error messages here; may be null
Throws:
java.io.IOException
java.lang.IllegalArgumentException - if cant convert coordinate values to a Date
Method Detail

getTimeDates

public java.util.Date[] getTimeDates()
Get the list of times as Dates.

Returns:
array of java.util.Date, or null.

getDateRange

public DateRange getDateRange()

getTimeResolution

public TimeUnit getTimeResolution()
                           throws java.lang.Exception
only if isRegular() LOOK REDO

Throws:
java.lang.Exception

findTimeIndexFromDate

public int findTimeIndexFromDate(java.util.Date d)
Given a Date, find the corresponding time index on the time coordinate axis. Can only call this is hasDate() is true. This will return

Parameters:
d - date to look for
Returns:
corresponding time index on the time coordinate axis
Throws:
java.lang.UnsupportedOperationException - is no time axis or isDate() false

section

public Variable section(java.util.List section)
                 throws InvalidRangeException
Description copied from class: Variable
Create a new Variable that is a logical subsection of this Variable. No data is read until a read method is called on it.

Specified by:
section in interface VariableIF
Overrides:
section in class CoordinateAxis1D
Parameters:
section - List of type ucar.ma2.Range, with size equal to getRank(). Each Range corresponds to a Dimension, and specifies the section of data to read in that Dimension. A Range object may be null, which means use the entire dimension.
Returns:
a new Variable which is a logical section of this Variable.
Throws:
InvalidRangeException