extractPts {satin} | R Documentation |
Extract ocean data values from a satin object
Description
Extract data values for pixels selected from an image of a satin object.
Usage
extractPts(X, points = NULL)
Arguments
X |
a satin object as returned by |
points |
a data frame with point(s) longitude and latitude coordinates where to extract data values. |
Details
If provided, points
must have two columns with x and y coordinates. When not specified, points
can be selected by clicking on the image. Note that for selecting the points in this manner, the plot of the satin object has to be created using colbar = FALSE
.
Value
A data frame with at least 7 columns: For each point, a sequential id
number; (x, y
) coordinates, either specified via the points
argument or selected by clicking on the image; (lon
and lat
) coordinates of pixels closer to the desired points; and for quality control purposes, the distance between them (d
, km). The remaining column(s) are the parameter values for every image in the satin object.
Author(s)
Héctor Villalobos
Examples
# load data, define coordinates and extract values
data(dsst)
plot(dsst)
coord <- data.frame(x = seq(-130, -114, 2), y = seq(20, 36, 2))
values <- extractPts(dsst, points = coord)
values
# if no points are given the user can select them by clicking on the image
if (interactive()){
plot(dsst, colbar = FALSE)
values2 <- extractPts(dsst) # *** click on the image ***
values2
}