Learn R Programming

ncdfCF (version 0.3.0)

NCObject: NetCDF base object

Description

This class is a basic ancestor to all classes that represent netCDF objects, specifically groups, dimensions, variables and the user-defined types in a netCDF file. More useful classes use this class as ancestor.

The fields in this class are common among all netCDF objects. In addition, this class manages the attributes for its descendent classes.

Arguments

Public fields

id

Numeric identifier of the netCDF object.

name

The name of the netCDF object.

attributes

data.frame with the attributes of the netCDF object.

Methods


Method new()

Create a new netCDF object. This class should not be instantiated directly, create descendant objects instead.

Usage

NCObject$new(id, name)

Arguments

id

Numeric identifier of the netCDF object.

name

Character string with the name of the netCDF object.


Method print_attributes()

This function prints the attributes of the netCDF object to the console. Through object linkages, this also applies to the CF data variables and axes, which each link to a netCDF object.

Usage

NCObject$print_attributes(width = 50L)

Arguments

width

The maximum width of each column in the data.frame when printed to the console.


Method attribute()

This method returns netCDF object attributes.

Usage

NCObject$attribute(att, field = "value")

Arguments

att

Vector of attribute names whose values to return.

field

The field of the attributes to return values from. This must be "value" (default), "type" or "length".

Returns

If the field argument is "type" or "length", a character vector named with the att values that were found in the attributes. If argument field is "value", a list with elements named with the att values, containing the attribute value(s), except when argument att names a single attribute, in which case that attribute value is returned as a character string. If no attribute is named with a value of argument att an empty list is returned, or an empty string if there was only one value in argument att.


Method clone()

The objects of this class are cloneable with this method.

Usage

NCObject$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.