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 classes
ncdfCF::CFObject -> ncdfCF::CFData -> CFAxis
Active bindings
friendlyClassName(read-only) A nice description of the class.
dimidThe netCDF dimension id of this axis. Setting this value to anything other than the correct value will lead to disaster.
length(read-only) The declared length of this axis.
orientationSet or retrieve the orientation of the axis, a single character with a value of "X", "Y", "Z", "T". Setting the orientation of the axis should only be done when the current orientation is unknown. Setting a wrong value may give unexpected errors in processing of data variables.
values(read-only) Retrieve the raw values of the axis. In general you should use the
coordinatesfield rather than this one.coordinates(read-only) Retrieve the coordinate values of the active coordinate set from the axis.
boundsSet or retrieve the bounds of this axis as a CFBounds object. When setting the bounds, the bounds values must agree with the coordinates of this axis.
auxiliarySet 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
CFLabelorCFAxisinstance orNULLwhen the active coordinate set is the primary axis coordinates.coordinate_names(read-only) 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 of this axis. Following elements refer to auxiliary coordinates.
coordinate_range(read-only) Retrieve the range of the coordinates of the axis as a vector of two values. The mode of the result depends on the sub-type of the axis.
active_coordinatesSet 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().unlimitedLogical to indicate if the axis is unlimited. The setting can only be changed if the axis has not yet been wriiten to file.
time(read-only) Retrieve the
CFTimeobject associated with the axis. Always returnsNULLbutCFAxisTimeoverrides this field.is_parametric(read-only) Logical flag that indicates if the axis has dimensional coordinates. Always
FALSEfor all axes except for CFAxisVertical which overrides this method.
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(
var,
group,
values,
start = 1L,
count = NA,
orientation = "",
attributes = data.frame()
)Arguments
varThe name of the axis when creating a new axis. When reading an axis from file, the NCVariable object that describes this instance.
groupThe CFGroup that this instance will live in.
valuesOptional. The values of the axis in a vector. Ignored when argument
varis aNCVariableobject.startOptional. Integer index where to start reading axis data from file. The index may be
NAto start reading data from the start.countOptional. Number of elements to read from file. This may be
NAto read to the end of the data.orientationOptional. The orientation of the axis: "X", "Y", "Z" "T", or "" (default) when not known or relevant.
attributesOptional. A
data.framewith the attributes of the axis. When an emptydata.frame(default) and argumentvaris anNCVariableinstance, attributes of the axis will be taken from the netCDF resource.
Method print()
Prints a summary of the axis to the console. This method is
typically called by the print() method of descendant classes.
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.
Method detach()
Detach the axis from its underlying netCDF resource, including any dependent CF objects.
Method copy_terms()
Copy the parametric terms of a vertical axis. This method is
only useful for CFAxisVertical instances having a parametric
formulation. This stub is here to make the call to this method succeed
with no result for the other descendant classes.
Method configure_terms()
Configure the function terms of a parametric vertical axis.
This method is only useful for CFAxisVertical instances having a
parametric formulation. This stub is here to make the call to this
method succeed with no result for the other descendant classes.
Method identical()
Tests if the axis passed to this method is identical to
self. This only tests for generic properties - class, length, name
and attributes - with further assessment done in sub-classes.
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.
Method copy()
Create a copy of this axis. 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.
Arguments
nameThe name for the new axis. If an empty string is passed, will use the name of this axis.
groupThe CFGroup where the copy of this axis will live.
Method copy_with_values()
Create a copy of this axis but using the supplied values.
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.
Arguments
nameThe name for the new axis. If an empty string is passed, will use the name of this axis.
groupThe CFGroup where the copy of this axis will live.
valuesThe values to the used with the copy of this axis.
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 self. 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.
Arguments
nameThe name for the new axis if the
rngargument is provided.groupThe CFGroup where the copy of this axis will live.
rngThe 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.
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.
Arguments
xVector 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.
methodSingle character value of "constant" or "linear".
rightmost.closedWhether or not to include the upper limit. Default is
TRUE.
Method attach_to_group()
Attach this axis to a group. If there is another object with the same name in this group an error is thrown. For associated objects (such as bounds, etc), if another object with the same name is otherwise identical to the associated object then that object will be linked from the variable, otherwise an error is thrown.
Usage
CFAxis$attach_to_group(grp, locations = list())Arguments
grpAn instance of CFGroup.
locationsOptional. A
listwhose named elements correspond to the names of objects associated with this axis, possibly including the axis itself. Each list element has a single character string indicating the group in the hierarchy where the object should be stored. As an example, if the variable has axes "lon" and "lat" and they should be stored in the parent group ofgrp, then specifylocations = list(lon = "..", lat = ".."). Locations can use absolute paths or relative paths from groupgrp. The axis and associated objects that are not in the list will be stored in groupgrp. If the argumentlocationsis not provided, all associated objects will be stored in this group.
Method write()
Write the axis to a netCDF file, including its attributes.