我找到了一个关于ROpenSci的教程,用于将物种出现数据与气候数据叠加在一起:Where can I find the error logs of nginx, using fastcgi and django 我正在尝试使用R包装rWBClimate制作三种植物物种的物种发生图。我想使用气候模型根据气候变化(温度)预测未来物种的发生分布。
我知道如何获得模型温度并且我已经使用了子集函数,但每次我使用climate_map函数时都会收到一条错误,说明"在climate_map中出错(usmex.basin,temp.dat, return_map = F): 您不能为每个区域提供多个数据来映射"。
有人知道如何修复此错误吗?
代码:
library(devtools)
install_github("ropensci/rWBclimate")
library("rWBclimate")
library("spocc")
library("plyr")
library("sp")
dir.create("~/kmltmp")
options(kmlpath="~/kmltmp")
options(stringsAsFactors = FALSE)
require(rWBclimate)
usmex <- c(273:284, 328:365)
usmex.basin <- create_map_df(usmex)
temp.dat <- get_model_temp(usmex, type= "mavg", 2080, 2100)
#mavg=monthly averages #2080 is start year #2100 is end year
temp.dat <- subset(temp.dat, temp.dat$year ==2080) #for year 2080
temp.dat <- subset(temp.dat, temp.dat$gcm=="ukmo_hadcm3")
#general circulation model name ukmo_hadcm3
temp.dat <- subset(temp.dat, temp.dat$scenario!="b1")
#b1 scenario with a more ecologically friendly world
usmex.map.df <- climate_map(usmex.basin, temp.dat, return_map =F)
#return_map=F bc i need a dataframe where data items are matched to their
polygon that I can plot later on.
**Error in climate_map(usmex.basin, temp.dat, return_map = F) :
You can't have more than one piece of data for each region to map**
#Plant species:
splist <- c("Acanthospermum australe",
"Abutilon megapotamicum", "Alternanthera philoxeroides")
splist <-sort(splist)
require("spocc")
out <- occ(query=splist, from= "gbif", limit=100)
out <-fixnames(out, how="query")
out_df <- occ2df(out) #combine results from occ calls to a single data.frame