na_mask: Create a mask raster

View source: R/na_mask.R

na_maskR Documentation

Create a mask raster

Description

Create a mask raster, retaining NA and setting all non-NA cells to 1. Input raster will be resampled if necessary, using "max" resampling (i.e. if any contributing cells are not NA, the new cell will be set to 1).

Usage

na_mask(infile, outfile, res, extent)

Arguments

infile

Character. File path to input raster file.

outfile

Character. Output raster file path. Directory will be created (recursively) if it doesn't exist.

res

Numeric. A vector of one or two numbers giving the desired output resolution. If missing, the input resolution will be used. If a single number is provided, it will be used for both horizontal and vertical resolution.

extent

One of of: a numeric vector giving the desired extent of the output raster as c(xmin, xmax, ymin, ymax); an Extent object; or an object from which such an Extent object can be extracted.

Value

A raster is written to outfile, with NA cells transferred from infile and all other cells set to 1.


jscamac/edmaps documentation built on June 11, 2022, 1:26 a.m.