CFVariableBase | R Documentation |
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
axes
List 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.)
crs
The 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.
cell_measure
The CFCellMeasure object of this variable, if defined.
new()
Create an instance of this class.
CFVariableBase$new(var, group, axes, crs)
var
The NC variable that describes this data object.
group
The group that this data object should live in.
axes
A list
of CFAxis descendant instances that describe the
axes of the data object.
crs
The 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")
want
Character 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" axis.
summarise()
Summarise the temporal domain 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, fun, period, era = NULL, ...)
name
Character 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).
fun
A 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.
period
The 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 axis.
era
Optional, integer vector of years to summarise over by the
specified period
. The extreme values of the years will be used. This
can also be a list of multiple such vectors. The elements in the list,
if used, should have names as these will be used to label the results.
...
Additional parameters passed on to fun
.
A CFData
object, or a list thereof with as many CFData
objects as fun
returns values.
clone()
The objects of this class are cloneable with this method.
CFVariableBase$clone(deep = FALSE)
deep
Whether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.