CFAxisNumeric: Numeric CF axis object

CFAxisNumericR Documentation

Numeric CF axis object

Description

This class represents a numeric axis. Its values are numeric. This class is used for axes with numeric values but without further knowledge of their nature. More specific classes descend from this class.

Super classes

ncdfCF::CFObject -> ncdfCF::CFAxis -> CFAxisNumeric

Active bindings

friendlyClassName

(read-only) A nice description of the class.

dimnames

(read-only) The coordinates of the axis as a vector. These are by default the values of the axis, but it could also be a set of auxiliary coordinates, if they have been set.

Methods

Public methods

Inherited methods

Method new()

Create a new instance of this class.

Creating a new axis is more easily done with the makeAxis() function.

Usage
CFAxisNumeric$new(
  var,
  values,
  start = 1L,
  count = NA,
  orientation = "",
  attributes = data.frame()
)
Arguments
var

The name of the axis when creating a new axis. When reading an axis from file, the NCVariable object that describes this instance.

values

Optional. The values of the axis in a vector. The values have to be numeric with the maximum value no larger than the minimum value + 360, and monotonic. Ignored when argument var is a NCVariable object.

start

Optional. Integer index where to start reading axis data from file. The index may be NA to start reading data from the start.

count

Optional. Number of elements to read from file. This may be NA to read to the end of the data.

orientation

Optional. The orientation of the axis: "X", "Y", "Z" "T", or "" (default) when not known or relevant.

attributes

Optional. A data.frame with the attributes of the axis. When an empty data.frame (default) and argument var is an NCVariable instance, attributes of the axis will be taken from the netCDF resource.


Method print()

Summary of the axis printed to the console.

Usage
CFAxisNumeric$print(...)
Arguments
...

Arguments passed on to other functions. Of particular interest is ⁠width = ⁠ to indicate a maximum width of attribute columns.

Returns

self, invisibly.


Method brief()

Some details of the axis.

Usage
CFAxisNumeric$brief()
Returns

A 1-row data.frame with some details of the axis.


Method range()

Retrieve the range of coordinate values in the axis.

Usage
CFAxisNumeric$range()
Returns

A numeric vector with two elements with the minimum and maximum values in the axis, respectively.


Method indexOf()

Retrieve the indices of supplied coordinates on the axis. If the axis has boundary values then the supplied coordinates must fall within the boundaries of an axis coordinate to be considered valid.

Usage
CFAxisNumeric$indexOf(x, method = "constant", rightmost.closed = TRUE)
Arguments
x

A numeric vector of coordinates whose indices into the axis to extract.

method

Extract index values without ("constant", the default) or with ("linear") fractional parts.

rightmost.closed

Whether or not to include the upper limit. This parameter is ignored for this class, it always is TRUE.

Returns

A vector giving the indices in x of valid coordinates provided. Values of x outside of the range of the coordinates in the axis are returned as NA. If the axis has boundary values, then values of x that do not fall on or between the boundaries of an axis coordinate are returned as NA.


Method slice()

Given a range of domain coordinate values, returns the indices into the axis that fall within the supplied range. If the axis has bounds, any coordinate whose boundary values fall entirely or partially within the supplied range will be included in the result.

Usage
CFAxisNumeric$slice(rng)
Arguments
rng

A numeric vector whose extreme values indicate the indices of coordinates to return.

Returns

An integer vector of length 2 with the lower and higher indices into the axis that fall within the range of coordinates in argument rng. Returns NULL if no (boundary) values of the axis fall within the range of coordinates.


Method copy()

Create a copy of this axis. The copy is completely separate from self, meaning that both self and all of its components are made from new instances.

Usage
CFAxisNumeric$copy(name = "")
Arguments
name

The name for the new axis. If an empty string is passed, will use the name of this axis.

Returns

The newly created axis.


Method copy_with_values()

Create a copy of this axis but using the supplied values. The attributes are copied to the new axis. Boundary values and auxiliary coordinates are not copied.

After this operation the attributes of the newly created axes may not be accurate, except for the "actual_range" attribute. The calling code should set, modify or delete attributes as appropriate.

Usage
CFAxisNumeric$copy_with_values(name = "", values)
Arguments
name

The name for the new axis. If an empty string is passed, will use the name of this axis.

values

The values to the used with the copy of this axis.

Returns

The newly created axis.


Method identical()

Tests if the axis passed to this method is identical to self.

Usage
CFAxisNumeric$identical(axis)
Arguments
axis

The CFAxisNumeric or sub-class instance to test.

Returns

TRUE if the two axes are identical, FALSE if not.


Method append()

Append a vector of values at the end of the current values of the axis. Boundary values are appended as well but if either this axis or the from axis does not have boundary values, neither will the resulting axis.

Usage
CFAxisNumeric$append(from)
Arguments
from

An instance of CFAxisNumeric whose values to append to the values of this axis.

Returns

A new CFAxisNumeric instance with values from this axis and the from axis appended.


Method subset()

Return an axis spanning a smaller coordinate range. This method returns an axis which spans the range of indices given by the rng argument.

Usage
CFAxisNumeric$subset(name = "", rng = NULL)
Arguments
name

The name for the new axis. If an empty string is passed (default), will use the name of this axis.

rng

The range of indices whose values from this axis to include in the returned axis. If the value of the argument is NULL, return a copy of the axis.

Returns

A new CFAxisNumeric instance covering the indicated range of indices. If the value of the argument rng is NULL, return a copy of this axis as the new axis.


ncdfCF documentation built on Sept. 13, 2025, 5:07 p.m.