knitr::opts_chunk$set(echo = TRUE, fig.width=7)

# library(tidyverse)
# library(forcats)
# library(sp) #for maps
# library(tmap) #for maps
# library(knitr) #for tables with kable
library(climcropr)
library(raster)
library(rnaturalearth) #for maps
library(dismo) #for ecocrop

# extent object for use in plots
ext <- extent(-180,180,-60,80)

TODO add in intro to the simpler method and comparison with ecocrop here. from documents/climcropr-ecocrop-simpler.Rmd - keep it very brief

To create an ecocrop maximum suitability map for a crop you can use the ecocrop_a_raster function.

This accepts raster stacks of climate data for monthly inputs.

Currently the options are :

  1. st_clim_all : a raster stack with 36 layers named on01–on12 for min, oa01-oa12 for mean and op01-012 for precip.
  2. st_tmin, st_tavg, st_prec : 3 separate raster stacks of 12 layers each, names don't matter (order does)

Within the climcropr package some example climate data are provided in one of the required formats.

The monthly climate data are provided in a raster stack called st_clim.

These are a 30 year average for the period 1981-2005 (centred on the year 1995) from the UEA CRU TS3.22 Dataset.

Harris, I., Jones, P.D., Osborn, T.J., Lister, D.H., 2014. Updated high-resolution grids of monthly climatic observations - the CRU TS3.10 Dataset: UPDATED HIGH-RESOLUTION GRIDS OF MONTHLY CLIMATIC OBSERVATIONS. International Journal of Climatology 34, 623–642. doi:10.1002/joc.3711

# call function using example climate data in the package
data("st_clim")
ec_out_sorghum <- ecocrop_a_raster('Sorghum (high altitude)', 
                                   st_clim_all = st_clim, 
                                   rainfed = TRUE )


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