CFAxis {ncdfCF} | R Documentation |
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.
This super-class does manage the "coordinates" of the axis, i.e. the values along the axis. This could be the values of the axis as stored on file, but it can also be the values from an auxiliary coordinate set, in the form of a CFLabel instance. The coordinate set to use in display, selection and processing is selectable through methods and fields in this class.
Super class
ncdfCF::CFObject
-> CFAxis
Public fields
NCdim
The NCDimension that stores the netCDF dimension details.
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.
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.
values
(read-only) Retrieve the raw values of the axis. In general you should use the
coordinates
field rather than this one.coordinates
(read-only) Retrieve the coordinate values of the active coordinate set from the axis.
auxiliary
Set or retrieve auxiliary coordinates for the axis. On assignment, the value must be an instance of CFLabel or a CFAxis descendant, which is added to the end of the list of coordinate sets. On retrieval, the active
CFLabel
orCFAxis
instance orNULL
when the active coordinate set is the primary axis coordinates.coordinate_names
Retrieve the names of the coordinate sets defined for the axis, as a character vector. The first element in the vector is the name of the axis and it refers to the values of the coordinates as stored in the netCDF file. Following elements refer to auxiliary coordinates.
active_coordinates
Set or retrieve the name of the coordinate set to use with the axis for printing to the console as well as for processing methods such as
subset()
.unlimited
(read-only) Logical to indicate if the axis has an unlimited dimension.
Methods
Public 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.
Creating a new axis is more easily done with the makeAxis()
function.
Usage
CFAxis$new(nc_var, nc_dim, orientation)
Arguments
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 safe 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 having time
information. This stub is here to make the call to this method succeed
with no result for the other descendant classes.
Usage
CFAxis$time()
Returns
NULL
Method identical()
Tests if the axis passed to this method is identical to
self
. This only tests for generic properties - class, length and name
with further assessment done in sub-classes.
Usage
CFAxis$identical(axis)
Arguments
axis
The
CFAxis
instance to test.
Returns
TRUE
if the two axes are identical, FALSE
if not.
Method can_append()
Tests if the axis passed to this method can be appended to
self
. This only tests for generic properties - class, mode of the
values and name - with further assessment done in sub-classes.
Usage
CFAxis$can_append(axis)
Arguments
axis
The
CFAxis
descendant instance to test.
Returns
TRUE
if the passed axis can be appended to self
, FALSE
if
not.
Method subset()
Return an axis spanning a smaller coordinate 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 CFAxis
descendants that do not
implement this method.
Usage
CFAxis$subset(group, rng = NULL)
Arguments
group
The group to create the new axis in.
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 the entire axis.
Returns
NULL
Method indexOf()
Find indices in the axis domain. Given a vector of
numerical, timestamp or categorical coordinates x
, find their indices
in the coordinates of the axis.
This is a virtual method. For more detail, see the corresponding method in descendant classes.
Usage
CFAxis$indexOf(x, method = "constant", rightmost.closed = TRUE)
Arguments
x
Vector of numeric, timestamp or categorial coordinates 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 values.
method
Single character value of "constant" or "linear".
rightmost.closed
Whether or not to include the upper limit. Default is
TRUE
.
Returns
Numeric vector of the same length as x
.
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 notNULL
, 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.