SelBox: Select apatial region from multidimensional arrays

Description Usage Arguments Value Examples

View source: R/SelBox.R

Description

This function subsets an spatial region from spatial data giving a vector with the maximum and minimum of latitudes and longitudes of the selected region.

Usage

1
SelBox(data, lon, lat, region, londim = NULL, latdim = NULL, mask = NULL)

Arguments

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 data'.

lat

Numeric vector of latitude locations of the cell centers of the grid of data'.

region

A vector of length four indicating the minimum longitude, the maximum longitude, the minimum latitude and the maximum latitude.

londim

An integer number indicating the position of the longitude dimension in the data object. If NULL (by deafault), the function search for a dimension call 'lon' in the data input.

latdim

An integer number indicating the position of the latitude dimension in the data object. If NULL (by deafault), the function search for a dimension call 'lat' in the data input.

mask

A matrix with the same spatial dimensions of data.

Value

A list of length 4:

Examples

1
2
3
4
5
6
7
8
9
## 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 = 1, latdim = 2, mask = NULL)
str(a)

ClimProjDiags documentation built on Jan. 7, 2021, 5:10 p.m.