This class is a basic ancestor to CFVariable and CFArray. It should not be instantiated directly, use the descendant classes instead.
This class provides access to common properties of data variables and the data they contain.
ncdfCF::CFObject -> CFVariableBase
axesList of instances of classes descending from CFAxis that
are the axes of the data object. If there are any scalar axes, they are
listed after the axes that associate with the dimensions of the data.
(In other words, axes 1..n describe the 1..n data dimensions, while
any axes n+1..m are scalar axes.)
crsThe coordinate reference system of this variable, as an
instance of CFGridMapping. If this field is NULL, the horizontal
component of the axes are in decimal degrees of longitude and latitude.
new()Create an instance of this class.
CFVariableBase$new(var, group, axes, crs)varThe NC variable that describes this data object.
groupThe group that this data object should live in.
axesA list of CFAxis descendant instances that describe the
axes of the data object.
crsThe CFGridMapping instance of this data object, or NULL
when no grid mapping is available.
An instance of this class.
time()Return the time object from the axis representing time.
CFVariableBase$time(want = "time")wantCharacter string with value "axis" or "time", indicating what is to be returned.
If want = "axis" the CFAxisTime axis; if want = "time" the
CFTime instance of the axis, or NULL if the variable does not have a
"time" dimension.
summarise()Summarise the temporal dimension of the data, if present, to a lower resolution, using a user-supplied aggregation function.
Attributes are copied from the input data variable or data array. Note
that after a summarisation the attributes may no longer be accurate.
This method tries to sanitise attributes (such as removing
scale_factor and add_offset, when present, as these will no longer
be appropriate in most cases) but the onus is on the calling code (or
yourself as interactive coder). Attributes like standard_name and
cell_methods likely require an update in the output of this method,
but the appropriate new values are not known to this method. Use
CFArray$set_attribute() on the result of this method to set or update
attributes as appropriate.
CFVariableBase$summarise(name, period, fun)nameCharacter vector with a name for each of the results that
fun returns. So if fun has 2 return values, this should be a vector
of length 2. Any missing values are assigned a default name of
"result_#" (with '#' being replaced with an ordinal number).
periodThe period to summarise to. Must be one of either "day", "dekad", "month", "quarter", "season", "year". A "quarter" is the standard calendar quarter such as January-March, April-June, etc. A "season" is a meteorological season, such as December-February, March-May, etc. (any December data is from the year preceding the January data). The period must be of lower resolution than the resolution of the time dimension.
funA function or a symbol or character string naming a function
that will be applied to each grouping of data. The function must return
an atomic value (such as sum() or mean()), or a vector of atomic
values (such as range()). Lists and other objects are not allowed and
will throw an error that may be cryptic as there is no way that this
method can assert that fun behaves properly so an error will pop up
somewhere, most probably in unexpected ways. The function may also be
user-defined so you could write a wrapper around a function like lm()
to return values like the intercept or any coefficients from the object
returned by calling that function.
A CFData object, or a list thereof with as many CFData
objects as fun returns values, created in the same group as self
with the summarised data.
clone()The objects of this class are cloneable with this method.
CFVariableBase$clone(deep = FALSE)deepWhether to make a deep clone.