rast_math: Evaluates a raster or raster using logical tests

Description Usage Arguments Details Value Note

Description

Evaluates a raster or raster using logical tests

Usage

1
2
rast_math(x, tmpdir = NULL, format = "GTiff", NAval = NULL,
  filename = NULL)

Arguments

x

Any raster calculation statement

tmpdir

Location raster will be written to if too big to handle in memory

format

Default format for rasters, here geotiff

NAval

Value to set to NA, default is NULL

filename

Output raster name, with gdal compliant extension

Details

The file writing part is a bit complicated. The name you provide the function will force a write to disk only if the calculation can be done in memory. Otherwise, if raster wrote a temporary file to disk because it was too big for memory, the function returns that object. This is why the function gives control as to where you can write a filename.

Value

Raster* resulting from raster algebra statement

Note

This function was modified from one found in my old ldefuncs.rs.R. As noted there, this should be improved to run in blocks, and perhaps parallelize, while calculation is being done. In future this function, if it proves useful, should go into separate R library for raster functions.


PrincetonUniversity/agroEcoTradeoff documentation built on May 8, 2019, 3:12 p.m.