Class 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.

  • Method Details

    • factory

      public static CoordinateAxis1DTime factory(NetcdfDataset ncd, VariableDS org, Formatter errMessages) throws IOException
      Throws:
      IOException
    • section

      Description copied from class: CoordinateAxis1D
      Create a new CoordinateAxis1D as a section of this CoordinateAxis1D.
      Overrides:
      section in class CoordinateAxis1D
      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 class CoordinateAxis1D
      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)
    • getTimeDates

      public Date[] getTimeDates()
      Deprecated.
      use getCalendarDates() to correctly interpret calendars
      Does 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 findTimeIndexFromCalendarDate
      Does not handle non-standard Calendars
    • hasTime

      public boolean hasTime(Date date)
      Deprecated.
      use hasCalendarDate
      Does 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 class CoordinateAxis1D
    • 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"