This class is a basic ancestor to all classes that represent CF objects, specifically data variables and axes. More useful classes use this class as ancestor.
NCvarThe NCVariable instance that this CF object represents.
friendlyClassName(read-only) A nice description of the class.
id(read-only) The identifier of the CF object.
name(read-only) The name of the CF object.
fullname(read-only) The fully-qualified name of the CF object.
groupRetrieve the NCGroup that this object is located in.
attributesSet or retrieve a data.frame with the attributes of
the CF object.
new()Create a new CF object instance from a variable in a netCDF resource. This method is called upon opening a netCDF resource. It is rarely, if ever, useful to call this constructor directly from the console. Instead, use the methods from higher-level classes such as CFVariable.
CFObject$new(nc_var)nc_varThe NCVariable instance upon which this CF object is based.
A CFobject instance.
attribute()Retrieve attributes of any CF object.
CFObject$attribute(att, field = "value")attVector of character strings of attributes to return.
fieldThe field of the attribute to return values from. This must be "value" (default) or "type".
If the field argument is "type", a character string. If field
is "value", a single value of the type of the attribute, or a vector
when the attribute has multiple values. If no attribute is named with a
value of argument att NA is returned.
print_attributes()Print the attributes of the CF object to the console.
CFObject$print_attributes(width = 50L)widthThe maximum width of each column in the data.frame when
printed to the console.
set_attribute()Add an attribute. If an attribute name already exists, it
will be overwritten.
CFObject$set_attribute(name, type, value)nameThe name of the attribute. The name must begin with a letter and be composed of letters, digits, and underscores, with a maximum length of 255 characters. UTF-8 characters are not supported in attribute names.
typeThe type of the attribute, as a string value of a netCDF data type.
valueThe value of the attribute. This can be of any supported type, including a vector or list of values. Matrices, arrays and like compound data structures should be stored as a data variable, not as an attribute and they are thus not allowed. In general, an attribute should be a character value, a numeric value, a logical value, or a short vector or list of any of these. Values passed in a list will be coerced to their common mode.
Self, invisibly.
append_attribute()Append the text value of an attribute. If an attribute
name already exists, the value will be appended to the existing
value of the attribute. If the attribute name does not exist it will
be created. The attribute must be of "NC_CHAR" or "NC_STRING" type; in
the latter case having only a single string value.
CFObject$append_attribute(name, value, sep = "; ", prepend = FALSE)nameThe name of the attribute. The name must begin with a letter and be composed of letters, digits, and underscores, with a maximum length of 255 characters. UTF-8 characters are not supported in attribute names.
valueThe character value of the attribute to append. This must be a character string.
sepThe separator to use. Default is "; ".
prependLogical to flag if the supplied value should be placed
before the existing value. Default is FALSE.
Self, invisibly.
delete_attribute()Delete an attribute. If an attribute name is not present
this method simply returns.
CFObject$delete_attribute(name)nameThe name of the attribute to delete.
Self, invisibly.
write_attributes()Write the attributes of this object to a netCDF file.
CFObject$write_attributes(nc, nm)ncThe handle to the netCDF file opened for writing.
nmThe NC variable name or "NC_GLOBAL" to write the attributes to.
Self, invisibly.
add_coordinates()Add names of axes to the "coordinates" attribute, avoiding duplicates and retaining previous values.
CFObject$add_coordinates(crds)crdsVector of axis names to add to the attribute.
Self, invisibly.
clone()The objects of this class are cloneable with this method.
CFObject$clone(deep = FALSE)deepWhether to make a deep clone.