Learn R Programming

ncdfCF (version 0.7.0)

names.CFDataset: Names or axis values of an CF object

Description

Retrieve the variable or axis names of an ncdfCF object. The names() function gives the names of the variables in the data set, preceded by the path to the group if the resource uses groups. The return value of the dimnames() function differs depending on the type of object:

  • CFDataset, CFVariable: The dimnames are returned as a vector of the names of the axes of the data set or variable, preceded with the path to the group if the resource uses groups. Note that this differs markedly from the base::dimnames() functionality.

  • CFAxisNumeric, CFAxisLongitude, CFAxisLatitude, CFAxisVertical: The coordinate values along the axis as a numeric vector.

  • CFAxisTime: The coordinate values along the axis as a character vector containing timestamps in ISO8601 format. This could be dates or date-times if time information is available in the axis.

  • CFAxisCharacter: The coordinate values along the axis as a character vector.

  • CFAxisDiscrete: The index values of the axis, either along the entire axis, or a portion thereof.

Usage

# S3 method for CFDataset
names(x)

groups(x)

# S3 method for CFDataset groups(x)

Value

A vector as described in the Description section.

Arguments

x

An CFObject whose axis names to retrieve. This could be CFDataset, CFVariable, or a class descending from CFAxis.

Examples

Run this code
fn <- system.file("extdata",
  "pr_day_EC-Earth3-CC_ssp245_r1i1p1f1_gr_20230101-20231231_vncdfCF.nc",
  package = "ncdfCF")
ds <- open_ncdf(fn)

# Names of data variables
names(ds)

# CFDataset
dimnames(ds)

# CFVariable
pr <- ds[["pr"]]
dimnames(pr)

# CFAxisNumeric
lon <- ds[["lon"]]
dimnames(lon)

# CFAxisTime
t <- ds[["time"]]
dimnames(t)

Run the code above in your browser using DataLab