Learn R Programming

ncdf4.helpers (version 0.3-7)

nc.get.dim.for.axis: Get dimension corresponding to a given axis

Description

Get dimension corresponding to a given axis.

Usage

nc.get.dim.for.axis(f, v, axis)

Value

An object of class ncdim4 if a dimension is found for the specified axis; NA otherwise.

Arguments

f

The file (an object of class ncdf4)

v

The source variable: a string naming a variable in a file or an object of class ncvar4.

axis

The axis to retrieve the dimension for: a string consisting of either X, Y, Z, T, or S.

Details

This function returns the dimension (of class 'ncdim4') corresponding to the specified axis (X, Y, Z, T, or S).

Examples

Run this code
## Get dimension for X axis
if (FALSE) {
f <- nc_open("pr.nc")
x.axis.dim <- nc.get.dim.axes.from.names(f, "pr", "X")
nc_close(f)
}

Run the code above in your browser using DataLab