nc.get.dim.axes: Get dimension axes

Description Usage Arguments Details Value Examples

View source: R/helpers.r

Description

Get dimension axes for the given variable.

Usage

1
nc.get.dim.axes(f, v, dim.names)

Arguments

f

The file (an object of class ncdf4)

v

The name of a variable

dim.names

Optionally, dimension names (to avoid looking them up repeatedly)

Details

This function returns the dimension axes for a given variable as a named character vector; the names are the names of the corresponding dimensions. If no variable is supplied, the function will return data for all dimensions found in the file.

Axes are X, Y, Z (depth, plev, etc), T (time), and S (space, for reduced grids).

This routine will attempt to infer axes for dimensions if no 'axis' attribute is found on a dimension variable, using the nc.get.dim.axes.from.names function.

Value

A named character vector mapping dimension names to axes.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Get dimension axes from file.
## Not run: 
f <- nc_open("pr.nc")
## Get dim axes for a specified variable
dim.axes <- nc.get.dim.axes(f, "pr")
## Get all dim axes in file
dim.axes <- nc.get.dim.axes(f)
nc_close(f)

## End(Not run)

ncdf4.helpers documentation built on Oct. 15, 2021, 5:19 p.m.