SelBox | R Documentation |
Subset a spatial region from spatial data giving a vector with the maximum and minimum of latitudes and longitudes of the selected region.
SelBox(data, lon, lat, region, londim = "lon", latdim = "lat", mask = NULL)
data |
An array with minimum two dimensions of latitude and longitude. |
lon |
Numeric vector of longitude locations of the cell centers of the
grid of |
lat |
Numeric vector of latitude locations of the cell centers of the
grid of |
region |
A vector of length four indicating the minimum longitude, the maximum longitude, the minimum latitude and the maximum latitude. |
londim |
A character string indicating the name of the longitudinal dimension. The default value is 'lon'. |
latdim |
A character string indicating the name of the latitudinal dimension. The default value is 'lat'. |
mask |
A matrix with the same spatial dimensions of |
A list of length 4:
$data
, an array with the same dimensions as the input
data
array, but with spatial dimension reduced to the selected
region
.
$lat
, a vector with the new corresponding latitudes for the
selected region
.
$lon
, a vector with the new corresponding longitudes for the
selected region
.
$mask
, if parameter mask
is supplied, an array with
reduced length of the dimensions to the selected region
.
Otherwise, a NULL element is returned.
# Example with synthetic data:
data <- 1:(20 * 3 * 2 * 4)
dim(data) <- c(lon = 20, lat = 3, time = 2, model = 4)
lon <- seq(2, 40, 2)
lat <- c(1, 5, 10)
a <- SelBox(data = data, lon = lon, lat = lat, region = c(2, 20, 1, 5),
londim = "lon", latdim = "lat", mask = NULL)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.