Learn R Programming

ncdfCF (version 0.1.1)

ncdfDimnames: Dimnames of an ncdfObject instance

Description

Retrieve the dimension names of an ncdfCF object. The return value differs depending on the type of object:

  • ncdfDataset, ncdfVariable: The dimnames are returned as a vector of the names of the dimensions of the dataset or variable. Note that this differs markedly from the base::dimnames() functionality.

  • ncdfDimensionNumeric: The values of the elements along the dimension as a numeric vector.

  • ncdfDimensionCharacter: The values of the elements along the dimension as a character vector.

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

Usage

# S4 method for ncdfVariable
dimnames(x)

# S4 method for ncdfDataset dimnames(x)

# S4 method for ncdfDimensionCharacter dimnames(x)

# S4 method for ncdfDimensionNumeric dimnames(x)

# S4 method for ncdfDimensionTime dimnames(x)

Value

A vector as described in the Description section.

Arguments

x

An ncdfObject whose dimension names to retrieve. This could be ncdfDataset, ncdfVariable, ncdfDimensionNumeric or ncdfDimensionTime.

Examples

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

# ncdfDataset
dimnames(ds)

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

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

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

Run the code above in your browser using DataLab