Skip to contents

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::CFData -> 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

Inherited methods


Method new()

Create a new instance of this class. The values of this axis are always a sequence, but the sequence may start with any positive value such that the length of this instance falls within the length of the axis on file, if there is one.

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

Usage

CFAxisDiscrete$new(var, group, start = 1L, count)

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.

group

The CFGroup that this instance will live in.

start

Optional. Integer value that indicates the starting value of this axis. Defults to 1L.

count

Number of elements in the axis.


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 copy()

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

Usage

CFAxisDiscrete$copy(name = "", group)

Arguments

name

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

group

The CFGroup where the copy of this axis will live.

Returns

The newly created 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. Outside values will be dropped.

Usage

CFAxisDiscrete$indexOf(x, method = "constant", rightmost.closed = TRUE)

Arguments

x

Vector of numeric values to find axis indices for.

method

Ignored.

rightmost.closed

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


Method slice()

Given a range of coordinate values, returns the indices into the axis that fall within the supplied range. If the axis has auxiliary coordinates selected then these will be used for the identification of the indices to return.

Usage

CFAxisDiscrete$slice(rng)

Arguments

rng

A vector whose extreme values indicate the indices of coordinates to return. The mode of the vector has to be integer or agree with any auxiliary coordinates selected.

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 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(name = "", group, rng = NULL)

Arguments

name

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

group

The CFGroup where the copy of this axis will live.

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 CFAxisDiscrete instance covering the indicated range of indices. If the value of the argument is NULL, return a copy of self as the new axis.


Method append()

Append a vector of values at the end of the current values of the axis.

Usage

CFAxisDiscrete$append(from)

Arguments

from

An instance of CFAxisDiscrete whose length to add to this axis.

group

The CFGroup where the copy of this axis will live.

Returns

A new CFAxisDiscrete instance with a length that is the sum of the lengths of this axis and the from 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.