knitr::opts_chunk$set(echo = TRUE, fig.width=7) # library(tidyverse) # library(forcats) # library(sp) #for maps # library(tmap) #for maps library(climcropr) library(raster) library(rnaturalearth) #for maps library(dismo) #for ecocrop library(knitr) #for tables with kable # extent object for use in plots ext <- raster::extent(-180,180,-60,85) #BEWARE names seem to be different in new df_ecocrop$COMNAME #e.g. broom-corn is sorghum test_crops <- c('potato','broom-corn','maize','oat','barley','apple','lentil','groundnut','sugarbeet', "rice","chickpea") #test_crops <- c('potato','broom-corn','maize','barley')
df_crop_ph <- data.frame(cropname=test_crops) for(cropnum in 1:length(test_crops)) { cropname <- test_crops[cropnum] df_crop_ph$phmin[cropnum] <- get_ecocrop(cropname,'phmin') df_crop_ph$phmax[cropnum] <- get_ecocrop(cropname,'phmax') df_crop_ph$phopmn[cropnum] <- get_ecocrop(cropname,'phopmn') df_crop_ph$phopmx[cropnum] <- get_ecocrop(cropname,'phopmx') #cat(cropname, " min,max = ", df_crop_ph$phmin[cropnum], ",", df_crop_ph$phmax[cropnum]) } kable(df_crop_ph)
#TODO re-enable eval=TRUE, disabling now to look at non pH params #test_crops <- c('potato','broom-corn','maize','barley') for(cropnum in 1:length(test_crops)) { cropname <- test_crops[cropnum] rst <- suit_soil_ph(cropname, plot=FALSE) par(mar=c(0,0,2,0)) #bltr plot(rst, main=paste0(cropname," soil pH suit=1, opt=2"), ext=ext) plot(ne_countries(), add=TRUE, border='grey', lwd=0.1) }
\pagebreak
dfvals <- data.frame(values=levels(df_ecocrop$DRA), stringsAsFactors = FALSE) kable(dfvals) df_crop_drain <- data.frame(cropname=test_crops) for(cropnum in 1:length(test_crops)) { cropname <- test_crops[cropnum] df_crop_drain$DRA[cropnum] <- get_ecocrop(cropname,'DRA') df_crop_drain$DRAR[cropnum] <- get_ecocrop(cropname,'DRAR') #cat(cropname, " min,max = ", df_crop_ph$phmin[cropnum], ",", df_crop_ph$phmax[cropnum]) } #for example crops kable(df_crop_drain)
The harmonised world soil database has drainage data in these categories which don't seem to relate directly.
\pagebreak
dfvals <- data.frame(values=levels(df_ecocrop$DEP), stringsAsFactors = FALSE) kable(dfvals) df_crop_depth <- data.frame(cropname=test_crops) for(cropnum in 1:length(test_crops)) { cropname <- test_crops[cropnum] df_crop_depth$DEP[cropnum] <- get_ecocrop(cropname,'DEP') df_crop_depth$DEPR[cropnum] <- get_ecocrop(cropname,'DEPR') #cat(cropname, " min,max = ", df_crop_ph$phmin[cropnum], ",", df_crop_ph$phmax[cropnum]) } #for example crops kable(df_crop_depth)
World harmonised soil database has :
REF_DEPTH
Reference soil depth of all soil units are set at 100 cm, except for Rendzinas and Rankers of FAO-74 and Leptosols of FAO-90, where the reference soil depth is set at 30 cm, and for Lithosols of FAO-74 and Lithic Leptosols of FAO-90, where it is set at 10 cm.
ROOTS
Depth of obstacles to roots.
\pagebreak
dfvals <- data.frame(values=levels(df_ecocrop$TEXT), stringsAsFactors = FALSE) kable(dfvals) df_crop_texture <- data.frame(cropname=test_crops) for(cropnum in 1:length(test_crops)) { cropname <- test_crops[cropnum] df_crop_texture$TEXT[cropnum] <- get_ecocrop(cropname,'TEXT') df_crop_texture$TEXTR[cropnum] <- get_ecocrop(cropname,'TEXTR') #cat(cropname, " min,max = ", df_crop_ph$phmin[cropnum], ",", df_crop_ph$phmax[cropnum]) } #for example crops kable(df_crop_texture)
Not clear how this could be related to ecocrop texture.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.