Learn R Programming

ncdfCF (version 0.4.0)

CFAxis: CF axis object

Description

This class is a basic ancestor to all classes that represent CF axes. More useful classes use this class as ancestor.

Arguments

Super class

ncdfCF::CFObject -> CFAxis

Public fields

NCdim

The NCDimension that stores the netCDF dimension details. This is NULL for CFAxisScalar instances.

orientation

A character "X", "Y", "Z" or "T" to indicate the orientation of the axis, or an empty string if not known or different.

bounds

The boundary values of this axis, if set.

lbls

A list of CFLabel instances, if any are defined for the axis.

Active bindings

friendlyClassName

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

dimid

(read-only) The netCDF dimension id of this axis.

length

(read-only) The declared length of this axis.

coordinates

(read-only) Retrieve the coordinate values of the axis.

labels

Set or retrieve the labels for the axis. On assignment, the value must be an instance of CFLabel.

unlimited

(read-only) Logical to indicate if the axis has an unlimited dimension.

Methods

Inherited methods


Method new()

Create a new CF axis instance from a dimension and a variable in a netCDF resource. This method is called upon opening a netCDF resource by the initialize() method of a descendant class suitable for the type of axis.

Usage

CFAxis$new(grp, nc_var, nc_dim, orientation)

Arguments

grp

The NCGroup that this axis is located in.

nc_var

The NCVariable instance upon which this CF axis is based.

nc_dim

The NCDimension instance upon which this CF axis is based.

orientation

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

Returns

A basic CFAxis object.


Method print()

Prints a summary of the axis to the console. This method is typically called by the print() method of descendant classes.

Usage

CFAxis$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

CFAxis$brief()

Returns

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


Method shard()

Very concise information on the axis. The information returned by this function is very concise and most useful when combined with similar information from other axes.

Usage

CFAxis$shard()

Returns

Character string with very basic axis information.


Method peek()

Retrieve interesting details of the axis.

Usage

CFAxis$peek(with_groups = TRUE)

Arguments

with_groups

Should group information be included? The save option is TRUE (default) when the netCDF resource has groups because names may be duplicated among objects in different groups.

Returns

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


Method time()

Return the CFTime instance that represents time. This method is only useful for CFAxisTime instances and CFAxisScalar instances having time information. This stub is here to make the call to this method succeed with no result for the other axis descendants.

Usage

CFAxis$time()

Returns

NULL


Method sub_axis()

Return an axis spanning a smaller dimension range. This method is "virtual" in the sense that it does not do anything other than return NULL. This stub is here to make the call to this method succeed with no result for the other axis descendants that do not implement this method.

Usage

CFAxis$sub_axis(group, rng = NULL)

Arguments

group

The group to create the new axis in.

rng

The range of values from this axis to include in the returned axis. If the value of the argument is NULL, return the entire axis (possibly as a scalar axis).

Returns

NULL


Method indexOf()

Find indices in the axis domain. Given a vector of numerical, timestamp or categorical values x, find their indices in the values of the axis. With method = "constant" this returns the index of the value lower than the supplied values in x. With method = "linear" the return value includes any fractional part.

If bounds are set on the numerical or time axis, the indices are taken from those bounds. Returned indices may fall in between bounds if the latter are not contiguous, with the exception of the extreme values in x.

Usage

CFAxis$indexOf(x, method = "constant")

Arguments

x

Vector of numeric, timestamp or categorial values to find axis indices for. The timestamps can be either character, POSIXct or Date vectors. The type of the vector has to correspond to the type of the axis.

method

Single character value of "constant" or "linear".

Returns

Numeric vector of the same length as x. If method = "constant", return the index value for each match. If method = "linear", return the index value with any fractional value. Values of x outside of the range of the values in the axis are returned as 0 and .Machine$integer.max, respectively.


Method label_set()

Retrieve a set of character labels corresponding to the elements of an axis. An axis can have multiple sets of labels and by default the first set is returned.

Usage

CFAxis$label_set(index = 1L)

Arguments

index

An integer value indicating which set of labels to retrieve.

Returns

A character vector of string labels with as many elements as the axis has, or NULL when no labels have been set or when argument index is not valid.


Method write()

Write the axis to a netCDF file, including its attributes.

Usage

CFAxis$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

CFAxis$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.