Package ucar.nc2.dataset
Class CoordinateAxis1DTime
- java.lang.Object
-
- ucar.nc2.CDMNode
-
- ucar.nc2.Variable
-
- ucar.nc2.dataset.VariableDS
-
- ucar.nc2.dataset.CoordinateAxis
-
- ucar.nc2.dataset.CoordinateAxis1D
-
- ucar.nc2.dataset.CoordinateAxis1DTime
-
- All Implemented Interfaces:
Comparable<VariableSimpleIF>
,Iterable<Attribute>
,IsMissingEvaluator
,AttributeContainer
,ucar.nc2.dataset.Enhancements
,ucar.nc2.dataset.EnhanceScaleMissingUnsigned
,VariableEnhanced
,ProxyReader
,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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CoordinateAxis1DTime.Builder<T extends CoordinateAxis1DTime.Builder<T>>
-
Nested classes/interfaces inherited from class ucar.nc2.dataset.CoordinateAxis
CoordinateAxis.AxisComparator
-
-
Field Summary
-
Fields inherited from class ucar.nc2.Variable
defaultCoordsSizeToCache, defaultSizeToCache, permitCaching
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CoordinateAxis1DTime.Builder<?>
builder()
Get Builder for this class that allows subclassing.static CoordinateAxis1DTime
factory(NetcdfDataset ncd, VariableDS org, Formatter errMessages)
int
findTimeIndexFromCalendarDate(CalendarDate d)
Given a Date, find the corresponding time index on the time coordinate axis.CalendarDate
getCalendarDate(int idx)
Get the the ith CalendarDate.CalendarDateRange
getCalendarDateRange()
Get calendar date rangeList<CalendarDate>
getCalendarDates()
Get the list of datetimes in this coordinate as CalendarDate objects.CalendarDate[]
getCoordBoundsDate(int i)
CalendarDate
getCoordBoundsMidpointDate(int i)
List<ucar.nc2.util.NamedObject>
getNames()
TimeUnit
getTimeResolution()
only if isRegular() LOOK REDOboolean
hasCalendarDate(CalendarDate date)
See if the given CalendarDate appears as a coordinateCoordinateAxis1DTime
section(Range r)
Create a new CoordinateAxis1D as a section of this CoordinateAxis1D.CoordinateAxis1DTime.Builder<?>
toBuilder()
Turn into a mutable Builder.-
Methods inherited from class ucar.nc2.dataset.CoordinateAxis1D
copyNoCache, findCoordElement, findCoordElementBounded, getBound1, getBound2, getCoordBounds, getCoordBoundsMidpoint, getCoordEdge, getCoordEdges, getCoordName, getCoordValue, getCoordValues, getIncrement, getMaxEdgeValue, getMaxValue, getMinEdgeValue, getMinValue, getStart, isContiguous, isInterval, isRegular
-
Methods inherited from class ucar.nc2.dataset.CoordinateAxis
equals, fromVariableDS, getAxisType, getBoundaryRef, getCalendarFromAttribute, getInfo, getPositive, getUnitsString, hashCode, isIndependentCoordinate, isNumeric
-
Methods inherited from class ucar.nc2.dataset.VariableDS
applyScaleOffset, applyScaleOffset, convertMissing, convertMissing, convertUnsigned, convertUnsigned, convertUnsigned, fillValueIsMissing, getCoordinateSystems, getDatasetLocation, getDescription, getEnhanceMode, getFillValue, getMissingDataArray, getMissingValues, getNetcdfFile, getOffset, getOriginalDataType, getOriginalName, getOriginalVariable, getScaledOffsetType, getScaleFactor, getSignedness, getUnsignedConversionType, getValidMax, getValidMin, hasFillValue, hasMissing, hasMissingValue, hasScaleOffset, hasValidData, invalidDataIsMissing, isFillValue, isInvalidData, isMissing, isMissingValue, lookupEnumString, missingDataIsMissing, readToStream, reallyRead, reallyRead, showScaleMissingProxy, toStringDebug
-
Methods inherited from class ucar.nc2.Variable
attributes, compareTo, createNewCache, findAttribute, findAttributeString, findDimensionIndex, getDataType, getDimension, getDimensions, getDimensionsString, getElementSize, getEnumTypedef, getFileTypeId, getFullName, getNameAndDimensions, getNameAndDimensions, getNameAndDimensions, getParentGroup, getParentStructure, getRanges, getRank, getShape, getShape, getShapeAsSection, getSize, getSizeToCache, getSPobject, hasCachedData, isCaching, isCoordinateVariable, isMemberOfStructure, isMetadata, isScalar, isUnlimited, isVariableLength, read, read, read, read, read, readScalarByte, readScalarDouble, readScalarFloat, readScalarInt, readScalarLong, readScalarShort, readScalarString, reduce, section, section, slice, toString
-
Methods inherited from interface ucar.nc2.AttributeContainer
findAttributeDouble, findAttributeIgnoreCase, findAttributeInteger, getName, hasAttribute, hasAttributeIgnoreCase, isEmpty, iterator
-
Methods inherited from interface ucar.nc2.dataset.Enhancements
addCoordinateSystem, removeCoordinateSystem
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface ucar.nc2.dataset.VariableEnhanced
getFullName, getShortName
-
Methods inherited from interface ucar.nc2.VariableSimpleIF
getShortName
-
-
-
-
Method Detail
-
factory
public static CoordinateAxis1DTime factory(NetcdfDataset ncd, VariableDS org, Formatter errMessages) throws IOException
- Throws:
IOException
-
section
public CoordinateAxis1DTime section(Range r) throws InvalidRangeException
Description copied from class:CoordinateAxis1D
Create a new CoordinateAxis1D as a section of this CoordinateAxis1D.- Overrides:
section
in classCoordinateAxis1D
- Parameters:
r
- the section range- Returns:
- a new CoordinateAxis1D as a section of this CoordinateAxis1D
- Throws:
InvalidRangeException
- if IllegalRange
-
getCalendarDate
public CalendarDate getCalendarDate(int idx)
Get the the ith CalendarDate.- Parameters:
idx
- index- Returns:
- the ith CalendarDate
-
getCalendarDateRange
public CalendarDateRange getCalendarDateRange()
Get calendar date range- Returns:
- calendar date range
-
getNames
public List<ucar.nc2.util.NamedObject> getNames()
-
getTimeResolution
public TimeUnit getTimeResolution() throws Exception
only if isRegular() LOOK REDO- Returns:
- time unit
- Throws:
Exception
- on bad unit string
-
findTimeIndexFromCalendarDate
public int findTimeIndexFromCalendarDate(CalendarDate 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- i, if time(i) <= d < time(i+1).
- 0, if d < time(0)
- n-1, if d > time(n-1), where n is length of time coordinates
- Parameters:
d
- date to look for- Returns:
- corresponding time index on the time coordinate axis
- Throws:
UnsupportedOperationException
- is no time axis or isDate() false
-
hasCalendarDate
public boolean hasCalendarDate(CalendarDate date)
See if the given CalendarDate appears as a coordinate- Parameters:
date
- test this- Returns:
- true if equals a coordinate
-
getCalendarDates
public List<CalendarDate> getCalendarDates()
Get the list of datetimes in this coordinate as CalendarDate objects.- Returns:
- list of CalendarDates.
-
getCoordBoundsDate
public CalendarDate[] getCoordBoundsDate(int i)
-
getCoordBoundsMidpointDate
public CalendarDate getCoordBoundsMidpointDate(int i)
-
toBuilder
public CoordinateAxis1DTime.Builder<?> toBuilder()
Description copied from class:Variable
Turn into a mutable Builder. Can use toBuilder().build() to copy.- Overrides:
toBuilder
in classCoordinateAxis1D
-
builder
public static CoordinateAxis1DTime.Builder<?> builder()
Get Builder for this class that allows subclassing.- See Also:
- "https://community.oracle.com/blogs/emcmanus/2010/10/24/using-builder-pattern-subclasses"
-
-