Skip to contents

Derive variables based on existing data.

Usage

derive(x, ...)

# S4 method for Daymet
derive(x, y, variable, varxy, ...)

# S4 method for Satellite
derive(x, variable)

Arguments

x

S4 object. A product of interest.

...

extra arguments to variable.

y

S4 object. A product of interest.

variable

character. A function to compute the variable of interest.

varxy

character. Variables used to derive variable.

Value

nothing. The data are saved directly in the cronus database.

Examples

if (FALSE) {
# Define required variables
region <- Region(name = "nebraska", type = "us state",
                 div = c(country = "United States", state = "Nebraska"))
date <- date_seq("2002-01-01", "2002-12-31")

## Daymet

# Create objects
x <- new("Daymet", region = region, date = date)
y <- new("Cropmaps", region = region, date = date)

# Create parameters (cardinal temperatures)
z <- new("Parameters", region = region, date = date)
tb_ct <- read(z, "default")$tb_ct

# Derive gdd (take a look at the gdd function)
derive(x, y, "gdd", varxy = c("tmin", "tmax", "cdl_default"), tb_ct = tb_ct)

## MOD09GA

# Create objects
x <- new("Mod09ga", region = region, date = date)

# Derive ndvi and cloudmask
derive(x, "ndvi")
derive(x, "cloudmask")
}