get.coord.for.dimension {M3}R Documentation

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)

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.

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

Note

Usually, the user will not call this function directly; instead, it will be called by other functions such as get.matrix.all.grid.cell.ctrs and get.M3.var.

Author(s)

Jenise Swall

See Also

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

Examples

## 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")

[Package M3 version 0.4 Index]