crop_data: Crop precipitation data sets

crop_dataR Documentation

Crop precipitation data sets

Description

The function crop_data crops the data sets using a shapefile mask.

Usage

crop_data(x, y)

## S4 method for signature 'Raster'
crop_data(x, y)

## S4 method for signature 'data.table'
crop_data(x, y)

## S4 method for signature 'character'
crop_data(x, y)

Arguments

x

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

y

filename (character). Path to a *.shp file

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.

Value

Raster* object; data.table

Examples

## Not run: 
download_data("gldas-vic", tempdir(), timestep = "yearly")
r <- raster::brick(paste0(tempdir(),
"/gldas-vic_tp_mm_land_194801_201412_025_yearly.nc"))
s <- crop_data(r, "cze.shp")

## End(Not run)

pRecipe documentation built on May 29, 2024, 9:11 a.m.