is.in.grid-methods: Checks if the points (xy$x, xy$y) are in the 'fvcom.grid'...

Description Arguments Value Examples

Description

Checks if the points (xy$x, xy$y) are in the fvcom.grid grid.

Arguments

grid

A fvcom.grid instance.

xy

A data.frame with components x and y with the x and y locations of the points.

units

Either 'll' for latitude and longitude or 'm' for meters.

Value

A vector of logical values of length nrow(xy). The ith element is TRUE if (xy$x[i], xy$y[i]) is in grid and FALSE otherwise.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
{
# Create a regular grid of test points
nodes = get.nodes(ocean.demo.grid)
lattice.grid = expand.grid(x=seq(min(nodes$x), max(nodes$x), len=25),
                           y=seq(min(nodes$y), max(nodes$y), len=25))
# Check which points are in the grid
in.grid = is.in.grid(ocean.demo.grid, lattice.grid, units="m")
# Plot the points that are in the grid
with(lattice.grid[in.grid,], plot(x, y))
}

ocean documentation built on Jan. 15, 2017, 4:16 p.m.