Learn R Programming

ncdf4.helpers (version 0.3-7)

nc.get.dim.axes: Get dimension axes

Description

Get dimension axes for the given variable.

Usage

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

Value

A named character vector mapping dimension names to axes.

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.

Examples

Run this code
## Get dimension axes from file.
if (FALSE) {
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)
}

Run the code above in your browser using DataLab