mask_grids: Mask Grids Based on Single Parameter

Description Usage Arguments Value See Also Examples

Description

Builds mask(s) based on a user-specified threshold for a single variable (e.g., mean precipitation or temperature). Grid cells greater than or equal to threshold value are reclassified as 1, values less than the threshold as 0. May be applied to a stack of grids (e.g., multi-date climate layers).

Usage

1
mask_grids(climate.stack, threshold, filename = "", ...)

Arguments

climate.stack

Raster* object. Each layer corresponds to a different temporal window (e.g., month) for a single climate variable. Object may be single or multi-layer.

threshold

Numeric. Threshold value (lower-bound, inclusive) for a single climate variable.

filename

Character. Optional output root filename passed to writeRaster, default output file type is GeoTiff. If not specified, output is written to a temporary file.

...

Other arguments passed to writeRaster.

Value

RasterBrick. One output mask layer for each input data layer. If filename is specified, output file format is GeoTiff with unsigned integer data type.

See Also

intersect_masks, reclassify.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# Climate data for North America to use in this example
data(prec_NA)  # mean monthly precipitation (mm)
data(temp_NA)    # mean monthly temperature (deg. C)

# Mask grid cells that meet minimum monthly precipitation values (>= 25 mm)
#   for vegetation growth
precip_mask <- mask_grids(prec_NA, 25)

# Mask grid cells that meet min. monthly growing season temperature (>= 5 deg. C)
GS_temp_mask <- mask_grids(temp_NA, 5)

# Mask grid cells that meet min. monthly C4 temperature (>= 22 deg. C)
C4_temp_mask <- mask_grids(temp_NA, 22)

# Plot monthly growing season temperature masks
plot(GS_temp_mask)

# Plot C4 temperature mask for July only
plot(C4_temp_mask[[7]])

rebeccalpowell/grassmapr documentation built on June 20, 2019, 8:07 p.m.