get.matrix.all.grid.cell.ctrs {M3} | R Documentation |
Obtain a matrix giving the locations of the grid cell centers
Description
Obtain a two-column matrix giving the locations of the grid cell centers in grid units.
Usage
get.matrix.all.grid.cell.ctrs(file, units)
Arguments
file |
File name of Models3-formatted file which contains information about the projection. Currently, this function can only handle files with a Lambert conic conformal or polar stereographic projection. |
units |
Units for coordinates of grid rows and columns. Must be one of “m”, “km”, or “deg”. If unspecified, the default is “deg” if the file has a longitude/latitude grid, and “km” otherwise. |
Value
Matrix with number of rows equal to the number of grid cells and two columns. The first column contains the x-coordinate of the grid cell centers; the second column contains the y-coordinate of the grid cell centers. The rows are listed in order such that all cell centers with same y-coordinate are grouped together, with groups ordered by the y-coordinate, and ordered within these groups by the x-coordinate).
Warning
Currently, this function can only handle files with Lambert conic conformal, polar stereographic, and longitude/latitude projections.
Note
This function relies on calls get.coord.for.dimensions
.
Author(s)
Jenise Swall
See Also
Examples
## As mentioned in notes above, user will not typically call
## this function directly.
## Find the path to a demo file on lambert conic conformal projection.
lcc.file <- system.file("extdata/ozone_lcc.ncf", package="M3")
## Get a list of the x- and y-coordinates of the centers of all
## grid cells.
ctrs <- get.matrix.all.grid.cell.ctrs(lcc.file, units="km")