CFAxisDiscrete: CF discrete axis object

CFAxisDiscreteR Documentation

CF discrete axis object

Description

This class represent discrete CF axes, i.e. those axes whose coordinate values do not represent a physical property. The coordinate values are ordinal values equal to the index into the axis.

Super classes

ncdfCF::CFObject -> ncdfCF::CFAxis -> CFAxisDiscrete

Active bindings

friendlyClassName

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

dimnames

(read-only) The coordinates of the axis as an integer vector, or labels for every axis element if they have been set.

Methods

Public methods

Inherited methods

Method new()

Create a new instance of this class.

Usage
CFAxisDiscrete$new(grp, nc_var, nc_dim, orientation, dim_only = FALSE)
Arguments
grp

The group that contains the netCDF variable.

nc_var

The netCDF variable that describes this instance.

nc_dim

The netCDF dimension that describes the dimensionality.

orientation

The orientation (X, Y, Z, or T) or "" if different or unknown.

dim_only

Flag if this axis only has a dimension on file but no NC variable.


Method print()

Summary of the axis printed to the console.

Usage
CFAxisDiscrete$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
CFAxisDiscrete$brief()
Returns

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


Method indexOf()

Find indices in the axis domain. Given a vector of numerical values x, find their indices in the values of the axis. In effect, this returns index values into the axis, but outside values will be dropped.

Usage
CFAxisDiscrete$indexOf(x, method = "constant")
Arguments
x

Vector of numeric values to find axis indices for.

method

Ignored.

Returns

Numeric vector of the same length as x. Values of x outside of the range of the values in the axis are returned as 0 and .Machine$integer.max, respectively.


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
CFAxisDiscrete$subset(group, rng = NULL)
Arguments
group

The group to create the new axis in.

rng

The range of indices from this axis to include in the returned axis.

Returns

A CFAxisDiscrete instance covering the indicated range of indices. If the rng argument includes only a single value, an CFAxisScalar instance is returned with the value from this axis. If the value of the argument is NULL, return the entire axis (possibly as a scalar axis).


Method write()

Write the axis to a netCDF file, including its attributes, but only if it has an associated NC variable in the file.

Usage
CFAxisDiscrete$write(nc = NULL)
Arguments
nc

The handle of the netCDF file opened for writing or a group in the netCDF file. If NULL, write to the file or group where the axis was read from (the file must have been opened for writing). If not NULL, the handle to a netCDF file or a group therein.

Returns

Self, invisibly.


Method clone()

The objects of this class are cloneable with this method.

Usage
CFAxisDiscrete$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


ncdfCF documentation built on April 16, 2025, 9:08 a.m.