Learn R Programming

M3 (version 0.4)

get.coord.for.dimension: Get the grid coordinates for the grid rows or columns.

Description

For either the rows or the columns, return the coordinates of the centers or the edges of the grid cells.

Usage

get.coord.for.dimension(file, dimension, position = "ctr", units)

Value

A list containing two elements, coords and

units. If dimension is “row”, return as element

coords a vector containing the y-coordinates of the centers (“ctr”), left (“lower”), or right (“upper”) edges of each row, depending on the value of argument position. If

dimension is “column” or “col”, return as element

coords a vector containing the x-coordinates of the centers (“ctr”), left (“lower”), or right (“upper”) edges of each row, depending on the value of argument position. In both cases, return as element units the units of the coordinates (can be “km”, “m”, or “deg”).

Arguments

file

Name of Models3-formatted file of interest.

dimension

If “column”/“col”, will obtain coordinates for columns; if “row” will obtain coordinates for rows.

position

Choose whether to obtain coordinates of cell edges or centers for either grid rows or columns. If “ctr” (default), get the cell center. If “lower”, get bottom or left cell edge. If “upper”, get top or right cell edge.

units

Units for coordinates of grid rows or 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.

Author

Jenise Swall

See Also

get.matrix.all.grid.cell.ctrs, get.M3.var, get.grid.info.M3

Examples

Run this code
## As mentioned in notes above, user will not typically call
## this function directly.

## Find the path to a demo file with lambert conic conformal projection.
lcc.file <- system.file("extdata/ozone_lcc.ncf", package="M3")

## Get a list of the x-coordinates of the centers of the cells.
x.ctrs <- get.coord.for.dimension(lcc.file, dimension="col", units="km")

Run the code above in your browser using DataLab