Learn R Programming

pRecipe (version 3.0.1-3)

sellonlatbox: Select Longitude Latitude Box

Description

The function sellonlatbox subsets the data in space within a bounding box.

Usage

sellonlatbox(x, y)

# S4 method for Raster sellonlatbox(x, y)

# S4 method for data.table sellonlatbox(x, y)

# S4 method for character sellonlatbox(x, y)

Value

Raster* object; data.table

Arguments

x

Raster* object; data.table (see details); filename (character, see details)

y

numeric. Bounding box in the form: (xmin, xmax, ymin, ymax)

Details

If `x` is a data.table, its columns should be named: "lon", "lat", "date", and "value"

If `x` is a filename, it should point to a *.nc file.

Examples

Run this code
if (FALSE) {
download_data("gldas-vic", tempdir(), timestep = "yearly")
r <- raster::brick(paste0(tempdir(),
"/gldas-vic_tp_mm_land_194801_201412_025_yearly.nc"))
s <- sellonlatbox(r, c(12.24, 18.85, 48.56, 51.12))
}

Run the code above in your browser using DataLab