Class CoordinateTime2D

  • All Implemented Interfaces:
    Coordinate

    @Immutable
    public class CoordinateTime2D
    extends CoordinateTimeAbstract
    implements Coordinate
    Both runtime and time coordinates are tracked here. The time coordinate is dependent on the runtime, at least on the offset. isOrthogonal means all time coordinate offsets are the same for each runtime. isRegular means all time coordinate offsets are the same for each "runtime hour of day" (from FMRC).
    Since:
    1/22/14
    • Constructor Detail

      • CoordinateTime2D

        public CoordinateTime2D​(int code,
                                CalendarPeriod timeUnit,
                                List<CoordinateTime2D.Time2D> vals,
                                CoordinateRuntime runtime,
                                List<Coordinate> times,
                                int[] time2runtime)
        Ctor. Most general, a CoordinateTime for each runtime.
        Parameters:
        code - pdsFirst.getTimeUnit()
        timeUnit - time duration, based on code
        vals - complete set of Time2D values, may be null (used only during creation)
        runtime - list of runtimes
        times - list of times, one for each runtime, offsets relative to its runtime, may not be null
      • CoordinateTime2D

        public CoordinateTime2D​(int code,
                                CalendarPeriod timeUnit,
                                List<CoordinateTime2D.Time2D> vals,
                                CoordinateRuntime runtime,
                                CoordinateTimeAbstract otime,
                                List<Coordinate> times,
                                int[] time2runtime)
        Ctor. orthogonal - all offsets are the same for all runtimes, so 2d time array is (runtime X otime)
        Parameters:
        code - pdsFirst.getTimeUnit()
        timeUnit - time duration, based on code
        vals - complete set of Time2D values, may be null (used only during creation)
        runtime - list of runtimes
        otime - list of offsets, all the same for each runtime
        times - list of times, one for each runtime, offsets relative to its runtime, may be null (Only available during creation, not stored in index)
      • CoordinateTime2D

        public CoordinateTime2D​(int code,
                                CalendarPeriod timeUnit,
                                List<CoordinateTime2D.Time2D> vals,
                                CoordinateRuntime runtime,
                                List<Coordinate> regList,
                                List<Coordinate> times,
                                int[] time2runtime)
        Ctor. regular - all offsets are the same for each "runtime hour of day", eg all 0Z runtimes have the same offsets, all 6Z runtimes have the same offsets, etc. 2d time array is (runtime X otime(hour), where hour = runtime hour of day
        Parameters:
        code - pdsFirst.getTimeUnit()
        timeUnit - time duration, based on code
        vals - complete set of Time2D values, may be null (used only during creation)
        runtime - list of runtimes
        regList - list of offsets, one each for each possible runtime hour of day.
        times - list of times, one for each runtime, offsets relative to its runtime, may be null (Only available during creation, not stored in index)
    • Method Detail

      • isTimeInterval

        public boolean isTimeInterval()
      • isOrthogonal

        public boolean isOrthogonal()
      • isRegular

        public boolean isRegular()
      • getNtimes

        public int getNtimes()
      • getNruns

        public int getNruns()
      • getOffset

        public int getOffset​(int runIndex)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • getTimeIntervalName

        @Nullable
        public String getTimeIntervalName()
        Check if all time intervals have the same length. Only if isTimeInterval.
        Returns:
        time interval name or MIXED_INTERVALS
      • getRefDate

        public CalendarDate getRefDate​(int runIdx)
      • getRuntime

        public long getRuntime​(int runIdx)
      • getOrgValue

        public CoordinateTime2D.Time2D getOrgValue​(int runIdx,
                                                   int timeIdx)
        Get the time coordinate at the given indices, into the 2D time coordinate array
        Parameters:
        runIdx - run index
        timeIdx - time index
        Returns:
        time coordinate
      • getIndex

        public boolean getIndex​(CoordinateTime2D.Time2D want,
                                int[] wholeIndex)
        find the run and time indexes of want the inverse of getOrgValue
        Parameters:
        want - find time coordinate that matches
        wholeIndex - return index here
      • matchTimeCoordinate

        public int matchTimeCoordinate​(int runIdx,
                                       CoordinateTime2D.Time2D value)
        Find the index matching a runtime and time coordinate
        Parameters:
        runIdx - which run
        value - time coordinate
        Returns:
        index in the time coordinate of the value
      • hasUniqueTimes

        public boolean hasUniqueTimes()
      • getTimeIndicesFromMrutp

        public int[] getTimeIndicesFromMrutp​(int timeIdx)
      • getTimesForSerialization

        public List<? extends Coordinate> getTimesForSerialization()
        public by accident - do not use
      • findTimeIndexFromVal

        public int findTimeIndexFromVal​(int runIdx,
                                        Object val)
        Find index in time coordinate from the time value
        Parameters:
        val - TimeCoordIntvValue or Integer
        Returns:
        indx in the time coordinate
      • getOffsetsSorted

        public List<?> getOffsetsSorted()
        Get a sorted list of the unique time coordinates
        Returns:
        List or List