create.pgrid | R Documentation |
create.pgrid
creates a grid of locations from the boundaries of domain and other information.
create.pgrid( xmin, xmax, ymin, ymax, nx, ny, midpoints = FALSE, poly.coords = NULL )
xmin |
The minimum value of the boundary of the x coordinates of the spatial domain. |
xmax |
The maximum value of the boundary of the x coordinates of the spatial domain. |
ymin |
The minimum value of the boundary of the y coordinates of the spatial domain. |
ymax |
The maximum value of the boundary of the y coordinates of the spatial domain. |
nx |
The number of gridpoints/cells/pixels in the x direction. |
ny |
The number of gridpoints/cells/pixels in the y direction. |
midpoints |
A logical value ( |
poly.coords |
An n \times 2 matrix with the coordinates specifying the polygon vertices of the true spatial domain of interest within the rectangular boundaries provided by |
The key argument in the function midpoints. If this is TRUE
, it is assumed that the boundaries of the spatial domain correspond to the midpoints of the cell/pixel in the grid. Otherwise, it is assumed that the boundaries correspond to the actual borders of the region of interest. If poly.coords
is supplied, the grid returned is the grid of midpoints contained in the convex hull of poly.coords
.
Returns an object of class pgrid
with the following components:
pgrid |
An n \times 2 matrix of locations (the midpoints of the pixelized grid). |
m |
The number of rows in pgrid. |
p.in.grid |
A vector of 0s and 1s indicating whether the midpoint of each pixel is in the convex hull of |
ubx |
The pixel boundaries in the x direction. |
uby |
The pixel boundaries in the y direction. |
upx |
The pixel midpoints in the x direction. |
upy |
The pixel midpoints in the y direction. |
Joshua French
pgrida <- create.pgrid(0, 1, 0, 1, nx = 50, ny = 50, midpoints = FALSE) pgridb <- create.pgrid(.01, .99, .01, .99, nx = 50, ny = 50, midpoints = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.