CFAxisCharacter | R Documentation |
This class represent CF axes that use categorical character labels as coordinate values. Note that this is different from a CFLabel, which is associated with an axis but not an axis itself.
This is an extension to the CF Metadata Conventions. As per CF, axes are required to have numerical values, which is relaxed here.
ncdfCF::CFObject
-> ncdfCF::CFAxis
-> CFAxisCharacter
friendlyClassName
(read-only) A nice description of the class.
dimnames
(read-only) The coordinates of the axis as a character vector.
ncdfCF::CFObject$append_attribute()
ncdfCF::CFObject$attribute()
ncdfCF::CFObject$delete_attribute()
ncdfCF::CFObject$dim()
ncdfCF::CFObject$print_attributes()
ncdfCF::CFObject$set_attribute()
ncdfCF::CFObject$update_coordinates_attribute()
ncdfCF::CFObject$write_attributes()
ncdfCF::CFAxis$can_append()
ncdfCF::CFAxis$configure_terms()
ncdfCF::CFAxis$copy_terms()
ncdfCF::CFAxis$detach()
ncdfCF::CFAxis$peek()
ncdfCF::CFAxis$print()
ncdfCF::CFAxis$shard()
ncdfCF::CFAxis$write()
new()
Create a new instance of this class.
Creating a new character axis is more easily done with the
makeCharacterAxis()
function.
CFAxisCharacter$new( var, values, start = 1L, count = NA, attributes = data.frame() )
var
The name of the axis when creating a new axis. When reading an axis from file, the NCVariable object that describes this instance.
values
Optional. The values of the axis in a vector. These must be
character values. Ignored when argument var
is a NCVariable object.
start
Optional. Integer index where to start reading axis data
from file. The index may be NA
to start reading data from the start.
count
Optional. Number of elements to read from file. This may be
NA
to read to the end of the data.
attributes
Optional. A data.frame
with the attributes of the
axis. When an empty data.frame
(default) and argument var
is an
NCVariable instance, attributes of the axis will be taken from the
netCDF resource.
brief()
Some details of the axis.
CFAxisCharacter$brief()
A 1-row data.frame
with some details of the axis.
copy()
Create a copy of this axis. The copy is completely separate from this axis, meaning that the new axis and all of its components are made from new instances. If this axis is backed by a netCDF resource, the copy will retain the reference to the resource.
CFAxisCharacter$copy(name = "")
name
The name for the new axis. If an empty string is passed, will use the name of this axis.
The newly created axis.
copy_with_values()
Create a copy of this axis but using the supplied values. The attributes are copied to the new axis. Boundary values and auxiliary coordinates are not copied.
After this operation the attributes of the newly created axes may not be accurate, except for the "actual_range" attribute. The calling code should set, modify or delete attributes as appropriate.
CFAxisCharacter$copy_with_values(name = "", values)
name
The name for the new axis. If an empty string is passed, will use the name of this axis.
values
The values to the used with the copy of this axis.
The newly created axis.
slice()
Given a range of domain coordinate values, returns the indices into the axis that fall within the supplied range.
CFAxisCharacter$slice(rng)
rng
A character vector whose extreme (alphabetic) values indicate the indices of coordinates to return.
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 values of the axis fall within the range of
coordinates.
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.
CFAxisCharacter$subset(name = "", rng = NULL)
name
The name for the new axis. If an empty string is passed (default), will use the name of this axis.
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.
A new CFAxisCharacter
instance covering the indicated range of
indices. If the value of the argument rng
is NULL
, return a copy of
this axis as the new axis.
identical()
Tests if the axis passed to this method is identical to
self
.
CFAxisCharacter$identical(axis)
axis
The CFAxisCharacter
instance to test.
TRUE
if the two axes are identical, FALSE
if not.
append()
Append a vector of values at the end of the current values of the axis.
CFAxisCharacter$append(from)
from
An instance of CFAxisCharacter
whose values to append to
the values of self
.
A new CFAxisCharacter
instance with values from self
and the
from
axis appended.
indexOf()
Find indices in the axis domain. Given a vector of character
strings x
, find their indices in the coordinates of the axis.
CFAxisCharacter$indexOf(x, method = "constant", rightmost.closed = TRUE)
x
Vector of character strings to find axis indices for.
method
Ignored.
rightmost.closed
Ignored.
Numeric vector of the same length as x
. Values of x
that are
not equal to a coordinate of the axis are returned as NA
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.