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
,Enhancements
,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
-
Nested classes/interfaces inherited from class ucar.nc2.Variable
Variable.Cache
-
-
Field Summary
-
Fields inherited from class ucar.nc2.dataset.CoordinateAxis1D
coords, wasRead
-
Fields inherited from class ucar.nc2.dataset.CoordinateAxis
axisType, boundaryRef, isContiguous, ncd, positive
-
Fields inherited from class ucar.nc2.dataset.VariableDS
orgDataType, orgName, orgVar
-
Fields inherited from class ucar.nc2.Variable
attributes, cache, dataType, debugCaching, defaultCoordsSizeToCache, defaultSizeToCache, dimensions, elementSize, hashCode, isVariableLength, ncfile, permitCaching, proxyReader, shape, sizeToCache, spiObject
-
Fields inherited from class ucar.nc2.CDMNode
annotations, dodsname, group, immutable, parentstruct, shortName, sort
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
CoordinateAxis1DTime(CoordinateAxis1DTime.Builder<?> builder, Group parentGroup)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected CoordinateAxis1DTime.Builder<?>
addLocalFieldsToBuilder(CoordinateAxis1DTime.Builder<? extends CoordinateAxis1DTime.Builder<?>> b)
static CoordinateAxis1DTime.Builder<?>
builder()
Get Builder for this class that allows subclassing.protected CoordinateAxis1DTime
copy()
Deprecated.UsetoBuilder()
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.int
findTimeIndexFromDate(Date d)
Deprecated.use findTimeIndexFromCalendarDateCalendarDate
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)
DateRange
getDateRange()
Deprecated.use getCalendarDateRange()List<NamedObject>
getNames()
Get the list of names, to be used for user selection.Date
getTimeDate(int idx)
Deprecated.use getCalendarDate()Date[]
getTimeDates()
Deprecated.use getCalendarDates() to correctly interpret calendarsTimeUnit
getTimeResolution()
only if isRegular() LOOK REDOboolean
hasCalendarDate(CalendarDate date)
See if the given CalendarDate appears as a coordinateboolean
hasTime(Date date)
Deprecated.use hasCalendarDateprotected void
readValues()
CoordinateAxis1DTime
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
addLocalFieldsToBuilder, copyNoCache, correctLongitudeWrap, findCoordElement, 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
addLocalFieldsToBuilder, equals, factory, fromVariableDS, getAxisType, getBoundaryRef, getCalendarFromAttribute, getInfo, getPositive, getUnitsString, hashCode, isIndependentCoordinate, isNumeric, setAxisType, setBoundaryRef, setPositive
-
Methods inherited from class ucar.nc2.dataset.VariableDS
_read, _read, addCoordinateSystem, addEnhancement, addLocalFieldsToBuilder, applyScaleOffset, applyScaleOffset, clearCoordinateSystems, convert, convertMissing, convertMissing, convertUnsigned, convertUnsigned, convertUnsigned, enhance, fillValueIsMissing, getCoordinateSystems, getDatasetLocation, getDescription, getEnhanceMode, getFillValue, getMissingDataArray, getMissingValues, getNetcdfFile, getOffset, getOriginalDataType, getOriginalName, getOriginalVariable, getScaledOffsetType, getScaleFactor, getSignedness, getUnsignedConversionType, getValidMax, getValidMin, hasCachedDataRecurse, hasFillValue, hasMissing, hasMissingValue, hasScaleOffset, hasValidData, invalidDataIsMissing, isFillValue, isInvalidData, isMissing, isMissingValue, lookupEnumString, missingDataIsMissing, readToStream, reallyRead, reallyRead, removeCoordinateSystem, removeEnhancement, setCaching, setFillValueIsMissing, setInvalidDataIsMissing, setMissingDataIsMissing, setName, setOriginalVariable, setUnitsString, showScaleMissingProxy, toStringDebug
-
Methods inherited from class ucar.nc2.Variable
_readScalarData, addAll, addAttribute, addLocalFieldsToBuilder, attributes, compareTo, createNewCache, extraInfo, findAttribute, findAttributeDouble, findAttributeIgnoreCase, findAttributeInteger, findAttributeString, findDimensionIndex, getAttributes, getDAPName, getDAPName, getDataType, getDimension, getDimensions, getDimensionsAll, getDimensionsString, getElementSize, getEnumTypedef, getFileTypeId, getFullName, getNameAndDimensions, getNameAndDimensions, getNameAndDimensions, getNameAndDimensions, getNameAndDimensions, getNameAndDimensions, getParentGroup, getParentGroupOrRoot, getParentStructure, getProxyReader, getRanges, getRank, getScalarData, getShape, getShape, getShapeAll, getShapeAsSection, getSize, getSizeToCache, getSPobject, hasCachedData, invalidateCache, isCaching, isCoordinateVariable, isEmpty, isImmutable, isMemberOfStructure, isMetadata, isScalar, isUnknownLength, isUnlimited, isVariableLength, read, read, read, read, read, readScalarByte, readScalarDouble, readScalarFloat, readScalarInt, readScalarLong, readScalarShort, readScalarString, readToByteChannel, reduce, remove, removeAttribute, removeAttributeIgnoreCase, resetDimensions, resetShape, section, section, setCachedData, setCachedData, setDataType, setDimension, setDimensions, setDimensions, setDimensionsAnonymous, setElementSize, setEnumTypedef, setImmutable, setIsScalar, setParentGroup, setProxyReader, setSizeToCache, setSPobject, setValues, setValues, slice, toString, writeCDL, writeCDL
-
Methods inherited from class ucar.nc2.CDMNode
annotate, annotation, getDODSName, getFullNameEscaped, getGroup, getImmutable, getName, getShortName, getSort, localhash, setDODSName, setParentStructure, setShortName, setSort, unwrap
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface ucar.nc2.AttributeContainer
findAttValueIgnoreCase, getName, hasAttribute, hasAttributeIgnoreCase, iterator
-
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
getName, getShortName
-
-
-
-
Constructor Detail
-
CoordinateAxis1DTime
protected CoordinateAxis1DTime(CoordinateAxis1DTime.Builder<?> builder, Group parentGroup)
-
-
Method Detail
-
factory
public static CoordinateAxis1DTime factory(NetcdfDataset ncd, VariableDS org, Formatter errMessages) throws IOException
- Throws:
IOException
-
copy
@Deprecated protected CoordinateAxis1DTime copy()
Deprecated.UsetoBuilder()
- Overrides:
copy
in classCoordinateAxis1D
-
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<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 classCoordinateAxis1D
- Returns:
- List of ucar.nc2.util.NamedObject, or empty list.
-
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)
-
readValues
protected void readValues()
- Overrides:
readValues
in classCoordinateAxis1D
-
getTimeDates
public Date[] getTimeDates()
Deprecated.use getCalendarDates() to correctly interpret calendarsDoes not handle non-standard Calendars
-
getTimeDate
public Date getTimeDate(int idx)
Deprecated.use getCalendarDate()Does not handle non-standard Calendars
-
getDateRange
public DateRange getDateRange()
Deprecated.use getCalendarDateRange()Does not handle non-standard Calendars
-
findTimeIndexFromDate
public int findTimeIndexFromDate(Date d)
Deprecated.use findTimeIndexFromCalendarDateDoes not handle non-standard Calendars
-
hasTime
public boolean hasTime(Date date)
Deprecated.use hasCalendarDateDoes not handle non-standard Calendars
-
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
-
addLocalFieldsToBuilder
protected CoordinateAxis1DTime.Builder<?> addLocalFieldsToBuilder(CoordinateAxis1DTime.Builder<? extends CoordinateAxis1DTime.Builder<?>> b)
-
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"
-
-