ecocrop_a_raster: ecocrop_a_raster

Description Usage Arguments Details Examples

Description

run ecocrop for all cells in a passed raster stack for the specified crop

Usage

1
2
3
ecocrop_a_raster(crop, st_clim_all = NULL, st_tmin = NULL, st_tavg = NULL,
  use_tmax = FALSE, st_tmax = NULL, st_prec = NULL, rainfed = TRUE,
  filename = NULL, plot = TRUE, simpler = TRUE, diagnostic = FALSE, ...)

Arguments

crop

the crop either a name or ecocrop object

st_clim_all

single raster stack containing all climate inputs (see data(st_clim))

st_tmin

min temp by month in a raster stack

st_tavg

mean temp by month in a raster stack

st_prec

precipitation by month in a raster stack

rainfed

default TRUE

filename

optional output file

simpler

trial of simpler suitability calc, done via cr_suit_simpler()

diagnostic

whether to output suitabilities by the different attributes

...

extra parameters to pass to writeRaster

Details

based on code from run_ecocrop() by Adam Sparks CURRENTLY USES dismo::ecocrop() function, we may wish to refactor this to give us more control over

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
#subset climate data to make faster run
st_clim2 <- raster::crop(st_clim, extent(-10,10,0,60))
rast_potato_suit2 <- ecocrop_a_raster('potato',st_clim2,simpler=TRUE)
plot(rast_potato_suit2)
#world takes a few mins to run
#rast_potato_suit <- ecocrop_a_raster('potato',st_clim)
#st_potato_suit <- ecocrop_a_raster('potato',st_clim, simpler=TRUE, diagnostic=TRUE)
#st_maize_suit <- ecocrop_a_raster('maize',st_clim, simpler=TRUE, diagnostic=TRUE)
#subset climate data to make faster run, here testing simpler method on maize
#st_clim2 <- raster::crop(st_clim, extent(-10,10,0,60))
#rast_maize_suit2 <- ecocrop_a_raster('maize',st_clim2,simpler=TRUE, diagnostic=FALSE)
#rast_potato_suit <- ecocrop_a_raster('potato',st_clim,simpler=TRUE, diagnostic=FALSE)
#to use climate tmax rather than tavg
#wheat_tmax <- ecocrop_a_raster('wheat', st_clim2, simpler=TRUE, use_tmax=TRUE)

AndySouth/climcropr documentation built on May 20, 2019, 5:08 p.m.