CoordinatesTime: Time coordinates

CoordinatesTimeR Documentation

Time coordinates

Description

This class implements the coordinates class for time. Time coordinates can use any of the calendars defined by the CF Metadata Conventions.

This class will store the explicit values of the time coordinate, and optionally its boundaries, just like other instances of the base class Coordinates. Additionally, it stores an instance of CFTime, which converts the raw values to intelligible coordinates, such as "2026-06-01T12:04:15".

Super classes

zarr::zarr_object -> Coordinates -> CoordinatesTime

Active bindings

values

(read-only) Retrieve the coordinate values as timestamps.

bounds

Set or retrieve the boundary values around time coordinates. When setting, assign a matrix with 2 rows and as many columns as there are coordinates values. When retrieving, a matrix as just described or NULL if boundary values have not been set.

bounds_raw

(read-only) Retrieve the boundary values around time coordinates, packed if possible. If the boundary values are packed, a vector of length 2 is returned, otherwise a matrix with 2 rows and as many columns as there are coordinates values or NULL if boundary values have not been set.

time

(read-only) The CFTime instance managing the coordinates.

offsets

(read-only) Retrieve the numeric offsets of the time coordinate values.

Methods

Public methods

Inherited methods

CoordinatesTime$new()

Create a new coordinates instance for use with a coordinate system axis for time.

Usage
CoordinatesTime$new(
  name,
  direction,
  unit,
  epoch,
  calendar = "standard",
  values,
  bounds = NULL,
  attributes = list()
)
Arguments
name

Character string. Name of the coordinate set.

direction

Character string. Direction of increasing coordinate values. Must be either "FUTURE" or "PAST".

unit

Character string. Unit of measure of the time coordinates. Must be "second", "minute", "hour", "day" or "year", or the abbreviation or plural thereof.

epoch

Character string. An ISO 8601 time stamp providing the reference point for time coordinate calculations.

calendar

Character string, optional. The calendar to use for the time coordinates. Must be one of the calendars supported by the CF Metadata Conventions. If not given, defaults to "standard".

values

A vector of values. They may be numeric, in which case they are taken to be offsets from the epoch in the given unit and the values may not be packed, or character, in which case they must be ISO 8601 time stamps.

bounds

Optional. If the boundaries are regularly spaced, a vector with the offset to the boundary lower and higher than the coordinate value, respectively. If the boundaries are irregularly spaced, a matrix with two rows and as many columns as there are elements, with the offset to the boundary below the coordinate value in row 1 and the offset to the boundary above the coordinate value in row 2. The boundaries represent the finite extent around the boundary value that this value is representative for. If this argument is not provided, the coordinate values are assumed to represent a point value.

attributes

Optional. A list of attributes of the coordinates.

Returns

An instance of this class or an error.


CoordinatesTime$copy()

Return an exact copy of these coordinates.

Usage
CoordinatesTime$copy()
Returns

A new instance of CoordinatesTime.


CoordinatesTime$slice()

Retrieve the indices of the time axis falling between two extreme values.

Usage
CoordinatesTime$slice(x, rightmost.closed = FALSE)
Arguments
x

A vector of two timestamps in between of which all indices into the time axis to extract.

rightmost.closed

Whether or not to include the upper limit. Default is FALSE.

Returns

An integer vector giving the indices in the time axis between values in x, or NULL if none of the values are valid.


geozarr documentation built on Sept. 16, 2026, 1:07 a.m.