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<VariableSimpleIF>, 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.

Author:
caron

Nested Class Summary
 
Nested classes/interfaces inherited from class ucar.nc2.dataset.CoordinateAxis
CoordinateAxis.AxisComparator
 
Field Summary
 
Fields inherited from class ucar.nc2.Variable
defaultSizeToCache
 
Method Summary
static CoordinateAxis1DTime factory(NetcdfDataset ncd, VariableDS org, java.util.Formatter errMessages)
           
 int findTimeIndexFromDate(java.util.Date d)
          Given a Date, find the corresponding time index on the time coordinate axis.
 DateRange getDateRange()
           
 java.util.List<NamedObject> getNames()
          Get the list of names, to be used for user selection.
 java.util.Date getTimeDate(int idx)
           
 java.util.Date[] getTimeDates()
          Get the list of times as Dates.
 TimeUnit getTimeResolution()
          only if isRegular() LOOK REDO
 boolean hasTime(java.util.Date date)
          See if the given Date appears is a coordinate
 
Methods inherited from class ucar.nc2.dataset.CoordinateAxis1D
copyNoCache, findCoordElement, findCoordElement, findCoordElementBounded, getBound1, getBound2, getCoordEdge, getCoordEdges, getCoordEdges, getCoordName, getCoordValue, getCoordValues, getIncrement, getMaxValue, getMinValue, getStart, isLayer, isRegular, section, setLayer
 
Methods inherited from class ucar.nc2.dataset.CoordinateAxis
equals, factory, getAxisType, getBoundaryRef, getInfo, getPositive, getUnitsString, hashCode, isContiguous, isNumeric, setAxisType, setBoundaryRef, setContiguous, setPositive
 
Methods inherited from class ucar.nc2.dataset.VariableDS
addCoordinateSystem, clearCoordinateSystems, convertScaleOffsetMissing, convertScaleOffsetMissing, convertScaleOffsetMissing, convertScaleOffsetMissing, convertScaleOffsetMissing, convertScaleOffsetMissing, enhance, getCoordinateSystems, getDescription, getOriginalDataType, getOriginalName, getOriginalVariable, getProxyReader, getUseNaNs, getValidMax, getValidMin, hasFillValue, hasInvalidData, hasMissing, hasMissingValue, hasScaleOffset, isFillValue, isInvalidData, isMissing, isMissingFast, isMissingValue, lookupEnumString, removeCoordinateSystem, setFillValueIsMissing, setInvalidDataIsMissing, setMissingDataIsMissing, setName, setOriginalVariable, setProxyReader, setUnitsString, setUseNaNs, toStringDebug
 
Methods inherited from class ucar.nc2.Variable
addAttribute, compareTo, createNewCache, findAttribute, findAttributeIgnoreCase, findDimensionIndex, getAttributes, getDataType, getDimension, getDimensions, getDimensionsAll, getDimensionsString, getElementSize, getName, getNameAndDimensions, getNameAndDimensions, getNameAndDimensions, getNameAndDimensions, getNameAndDimensions, getNameEscaped, getParentGroup, getParentStructure, getRanges, getRank, getShape, getShape, getShapeAsSection, getShortName, getSize, getSizeToCache, getSPobject, hasCachedData, invalidateCache, isCaching, isCoordinateVariable, isImmutable, isMemberOfStructure, isMetadata, isScalar, isUnknownLength, isUnlimited, isUnsigned, isVariableLength, read, read, read, read, read, readScalarByte, readScalarDouble, readScalarFloat, readScalarInt, readScalarLong, readScalarShort, readScalarString, readToByteChannel, remove, removeAttribute, removeAttributeIgnoreCase, resetDimensions, resetShape, section, section, setCachedData, setCaching, setDataType, setDimension, setDimensions, setDimensions, setDimensionsAnonymous, setElementSize, setEnumTypedef, setImmutable, setIsScalar, setParentGroup, setParentStructure, setSizeToCache, setSPobject, slice, toString, writeCDL
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ucar.nc2.VariableIF
findAttribute, findAttributeIgnoreCase, findDimensionIndex, getAttributes, getDataType, getDimension, getDimensions, getDimensionsAll, getElementSize, getName, getNameAndDimensions, getNameEscaped, getParentGroup, getParentStructure, getRanges, getRank, getShape, getShapeAsSection, getShortName, getSize, isCoordinateVariable, isMemberOfStructure, isMetadata, isScalar, isUnlimited, isUnsigned, isVariableLength, read, read, read, read, readScalarByte, readScalarDouble, readScalarFloat, readScalarInt, readScalarLong, readScalarShort, readScalarString, section
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Method Detail

factory

public static CoordinateAxis1DTime factory(NetcdfDataset ncd,
                                           VariableDS org,
                                           java.util.Formatter errMessages)
                                    throws java.io.IOException
Throws:
java.io.IOException

getTimeDates

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

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

getTimeDate

public java.util.Date getTimeDate(int idx)

getDateRange

public DateRange getDateRange()

getNames

public java.util.List<NamedObject> getNames()
Description copied from class: CoordinateAxis1D
Get the list of names, to be used for user selection. The ith one refers to the ith coordinate.

Overrides:
getNames in class CoordinateAxis1D
Returns:
List of ucar.nc2.util.NamedObject, or empty list.

getTimeResolution

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

Returns:
time unit
Throws:
java.lang.Exception - on bad unit string

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

hasTime

public boolean hasTime(java.util.Date date)
See if the given Date appears is a coordinate

Parameters:
date - test this
Returns:
true if equals a coordinate