Find the nearest-neighbour coordinates of x
in the coordinate arrays of coords
.
romsmap(x, ...) # S3 method for SpatialPolygonsDataFrame romsmap(x, coords, crop = FALSE, lonlat = TRUE, ...) # S3 method for default romsmap(x, coords, crop = FALSE, lonlat = TRUE, ...) # S3 method for SpatialLinesDataFrame romsmap(x, coords, crop = FALSE, lonlat = TRUE, ...) # S3 method for SpatialPointsDataFrame romsmap(x, coords, crop = FALSE, lonlat = TRUE, ...)
x | object to transform to the grid space, e.g. a |
---|---|
... | unused |
coords | romscoords RasterStack |
crop | logical, if |
lonlat | logical, if |
input object with coordinates transformed to space of the coords
The input coords
is a assumed to be a 2-layer RasterStack or RasterBrick
and using FNN::get.knnx()
the nearest matching position of the coordinates
of x
is found in the grid space of coords
. The motivating use-case is the
curvilinear longitude and latitude arrays of ROMS model output.
No account is made for the details of a ROMS cell, though this may be included in future. We tested only with the "lon_u" and "lat_u" arrays.
Do not use this for extraction purposes without checking the output, this is best used for exploration
and visualization. Re-mapping ROMS data is better done by looking up the coords_points
within spatial objects,
and transferring via the grid index.
#> Warning: The `x` argument of `as_tibble.matrix()` must have column names if `.name_repair` is omitted as of tibble 2.0.0. #> Using compatibility `.name_repair`. #> This warning is displayed once every 8 hours. #> Call `lifecycle::last_warnings()` to see where this warning was generated.