powered by
Get dimension corresponding to a given axis.
nc.get.dim.for.axis(f, v, axis)
An object of class ncdim4 if a dimension is found for the specified axis; NA otherwise.
ncdim4
NA
The file (an object of class ncdf4)
ncdf4
The source variable: a string naming a variable in a file or an object of class ncvar4.
ncvar4
The axis to retrieve the dimension for: a string consisting of either X, Y, Z, T, or S.
This function returns the dimension (of class 'ncdim4') corresponding to the specified axis (X, Y, Z, T, or S).
## 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