Learn R Programming

M3 (version 0.4)

get.matrix.all.grid.cell.ctrs: 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)

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).

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.

Warning

Currently, this function can only handle files with Lambert conic conformal, polar stereographic, and longitude/latitude projections.

Author

Jenise Swall

See Also

get.coord.for.dimension

Examples

Run this code
## 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")

Run the code above in your browser using DataLab