-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
do_many,do_any, and final_model #79
Comments
Hello @eliascherenet can you provide more details about your code? It seems as though modleR wasn't installed on your computer, or not loaded correctly. |
dear Andrea,
Please find attached my code and i need your help where to set the code in
order to calculate the uncertainty and sensitivity analysis.
Elias
…On Wed, Oct 7, 2020 at 8:03 AM AndreaSanchezTapia ***@***.***> wrote:
Hello @eliascherenet <https://github.com/eliascherenet> can you provide
more details about your code? It seems as though modleR wasn't installed on
your computer, or not loaded correctly.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#79 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AD4I2LCVI7YVF6JPIJ2QOD3SJPZBHANCNFSM4SENBPZQ>
.
--
+++++++++++++++++++++++++++++++++++++++++++++
Elias Cherenet Weldemariam(MSc, BSc)
Lecturer(GIS and Remote Sensing)
Coordinator, Department of Geo-information Science (GIS)
Haramaya University, Ethiopia
Email: [email protected], [email protected] Skype: elias.weld,
+251(0)966429087
++++++++++++++++++++++++++++++++++++++++++++++
|
dear Andrea,,
I hope you have got my attachment file in my previous email. Looking your
help soon.
regards
…On Wed, Oct 7, 2020 at 8:28 AM Elias Cherenet ***@***.***> wrote:
dear Andrea,
Please find attached my code and i need your help where to set the code in
order to calculate the uncertainty and sensitivity analysis.
Elias
On Wed, Oct 7, 2020 at 8:03 AM AndreaSanchezTapia <
***@***.***> wrote:
> Hello @eliascherenet <https://github.com/eliascherenet> can you provide
> more details about your code? It seems as though modleR wasn't installed on
> your computer, or not loaded correctly.
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#79 (comment)>, or
> unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AD4I2LCVI7YVF6JPIJ2QOD3SJPZBHANCNFSM4SENBPZQ>
> .
>
--
+++++++++++++++++++++++++++++++++++++++++++++
Elias Cherenet Weldemariam(MSc, BSc)
Lecturer(GIS and Remote Sensing)
Coordinator, Department of Geo-information Science (GIS)
Haramaya University, Ethiopia
Email: ***@***.***, ***@***.*** Skype: elias.weld,
+251(0)966429087
++++++++++++++++++++++++++++++++++++++++++++++
--
+++++++++++++++++++++++++++++++++++++++++++++
Elias Cherenet Weldemariam(MSc, BSc)
Lecturer(GIS and Remote Sensing)
Coordinator, Department of Geo-information Science (GIS)
Haramaya University, Ethiopia
Email: [email protected], [email protected] Skype: elias.weld,
+251(0)966429087
++++++++++++++++++++++++++++++++++++++++++++++
|
Hello Elias, GitHub does not allow for attachments. |
dear Andrea,
I found this " modelr" from the installation but didn't get the one
mentioned in the GitHub" modleR " .
I do not know if this is the same and have similar function.
please find also my code here:
library(maptools) ## For wrld_simpl
library(raster)
library(dismo)
library(rgdal)
library(raster)
library(ggplot2)
library(parallel)
library(tidyr)
library(dplyr)
file <- paste(system.file(package="dismo"), "/ex/sena.csv", sep="")
file
sp<- read.csv("C:/Users/user/Desktop/ex/sena.csv")
head(sp)
colnames(sp)
class(sp)## this is data frame not spatial point, to change from datafram
to spatial...
setwd("C:/Users/user/Desktop/ex/wc2.1_10m_elev")
#sp$species<- 1 # to add new columun
#sp<-sp[,c('lon','lat','species')]## to combine the new column and other
column from original data
#head(sp)
#class(sp)
#coordinates(sp)<- ~lon + lat
#class(sp)
#head(sp)
sp
library(maptools)
data(wrld_simpl)
plot(wrld_simpl, xlim=c(27,27), ylim=c(-35,35), axes=TRUE,col="light
yellow")
# restore the box around the map
box()
# plot points
points(sp$long, sp$lat, col='orange', pch=20, cex=0.75)
# plot points again to add a border, for better visibility
points(sp$long, sp$lat, col='red', cex=0.75)
coordinates(sp) <- ~long+lat
crs(sp) <- crs(wrld_simpl)
class(sp)
#class(wrld_simpl)
#ovr <- over(sp, wrld_simpl)
#head(ovr)
#tail(ovr)
#cntr <- ovr$NAME
#i <- which(is.na(cntr))
#i
#j <- which(cntr != sp$country)
#cbind(cntr, sp$country)[j,]
#plot(sp)
#plot(wrld_simpl, add=T, border='blue', lwd=1)
#points(sp[j, ], col='yellow', pch=20, cex=2)
sp<-sp[c('species')]
class(sp)
head(sp)
bio1 <- raster::getData('worldclim', var='bio', res=5)
bio <- stack(bio1)
bio
#plot(bio)
elev <- raster("wc2.1_5m_elev.tif")
elev
#plot(elev)
bio <- stack(bio1,elev)
bio <- raster::stack(bio1)
#plot(bio)
bio
e <- extent(bio)
p <- as(e, 'SpatialPolygons')
projection(p) <- crs(bio)
mask_raster <- function(raster, shape){
outr <- crop(raster, extent(shape))
outr <- mask(outr, p)
return(outr)
}
bio<- mask_raster(raster= bio1, shape = p)
elev <- mask_raster(raster= elev, shape = p)
bio2 <- stack(bio1,elev)
bio2
#plot(bio2)
names(bio2)
#######################
r <- bio2[[c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20)]]
names(r)
#names(r) <- c("Temp","Prec")
############
myshp <- readOGR("C:/Users/user/Desktop/ex/Africa.shp")
#plot(myshp)
bion2 <- raster(r, crs=proj4string(myshp))
r2 <- crop(r, extent(myshp))
bion3 <- mask(r2, myshp)
#plot(bion3)
#plot(myshp, add=TRUE, lwd=2)
bion3 <- stack(bion3)
bion3
#################################
myshp <- readOGR("C:/Users/user/Desktop/ex/Africa.shp")
plot(myshp)
bion2 <- raster(r, crs=proj4string(myshp))
r2 <- crop(r, extent(myshp))
bion3 <- mask(r2, myshp)
#plot(bion3)
plot(myshp, add=TRUE, lwd=2)
bion3 <- stack(bion3)
bion3
plot(bion3)
plot(bion3[[1]])
############
install.packages("rgeos")
e<-drawExtent()
sp<-crop(sp,e)
points(sp,col='red')
biok<-crop(bion3,e)
plot(biok)
plot(biok[[1]])
#install.packages("usdm")
library(usdm)
ex<- raster::extract(biok,sp)
head(ex)
v1<- vifstep(ex)
#v2<- vifcor(bion3, th=0.7)
v1
#v2
bm2<-exclude(biok,v1)
head(bm2)
plot(bm2[[1]])
vif(bion3)
#####################
#e<-drawExtent()
#sp<-crop(sp,e)
#points(sp,col='blues9')
#bio
#install.packages("usdm")
library(usdm)
#ex<- raster::extract(bio2,sp)
#head(ex)
v1<- vifstep(bion3, th=10)
v2<- vifcor(bion3, th=0.7)
v1
v2
bm2<-exclude(bion3,v1)
#plot(bm2[[1]])
###### to select important variables after VIF
#bm2<-
bio2[[c('bio2','bio3','bio4','bio8','bio12','bio13','bio14','bio16','bio18','wc2.1_10m_elev')]]
#names(bm2) <-
c('bio2','bio3','bio4','bio8','bio12','bio13','bio14','bio16','bio18','wc2.1_10m_elev')
#bm2
#plot(bm2)
#bm2<-
bio2[[c('bio1','bio2','bio4','bio12','bio13','bio14','bio17','bio18','wc2.1_10m_elev')]]
#names(bm2) <-
c('bio1','bio2','bio4','bio12','bio13','bio14','bio17','bio18','wc2.1_10m_elev')
#bm2
#plot(bm2)
##############333
#bm2<-
bio2[[c('bio1','bio3','bio8','bio9','bio10','bio12','bio14','bio17','wc2.1_10m_elev')]]
#names(bm2) <-
c('bio1','bio3','bio8','bio9','bio10','bio12','bio14','bio17','wc2.1_10m_elev')
#bm2
#plot(bm2)
################3333
#bm2<-
bio2[[c('bio1','bio3','bio7','bio9','bio10','bio12','bio14','bio15','bio17','wc2.1_10m_elev')]]
#names(bm2) <-
c('bio1','bio3','bio7','bio9','bio10','bio12','bio14','bio15','bio17','wc2.1_10m_elev')
#bm2
#plot(bm2)
######################
bm2<-
bion3[[c('bio1','bio6','bio8','bio9','bio12','bio14','bio17','bio18','wc2.1_5m_elev')]]
names(bm2) <-
c('bio1','bio6','bio8','bio9','bio12','bio14','bio17','bio18','wc2.1_5m_elev')
bm2
#plot(bm2)
vif(bm2)
###cliping raster
myshp <- readOGR("C:/Users/user/Desktop/ex/Africa.shp")
plot(myshp)
biom2 <- raster(bm2, crs=proj4string(myshp))
r2 <- crop(bm2, extent(myshp))
biom3 <- mask(r2, myshp)
#plot(biom3)
#plot(myshp, add=TRUE, lwd=2)
biom3 <- stack(biom3)
## crop
points(sp,cex=0.5,pch=16)
proj4string(sp)<-projection(raster())
mapview(sp)
install.packages('mapview')
library(mapview)
getmethodNames()
mapview(wrld_simpl)
installAll()
library(sdm)
d <- sdmData(species~.,sp,predictors = bm2, bg=list(n=800),
method='gRandom',remove=TRUE,seed=47)
d
m <- sdm(species~.,d, methods =
c('glm','svm','rf','brt','gam','fda','mars','mda'),
replications= c('boot'),n=10, parallelSetting=list(ncore=4,
method='parallel'),seed=47)
m
p <-predict(m,bion3,'prediction2020.img', overwrite=TRUE)
p
plot(p)
rcurve(m)
plot(sdm::getVarImp(m,1:80))
getVarImp(m)
install.packages("shiny")
library(shiny)
installAll()
gui(m)
library(rgdal) # for vector work; sp package should always load with
rgdal.
library (raster)
en<- ensemble(m,p,'ens2020.img',setting =
list(method='weighted',stat='TSS',opt=2),overwrite=TRUE,uncertainty =
TRUE,sensitivity = 0.9,consensus_level = 0.5)
en
plot(en)
biof2<-raster::getData('CMIP5',var='bio',res=5,rcp=45,
year=70,model='AC')
biof <- stack(biof2,elev)
names(bio2)
names(biof)
names(biof)<-names(bio2)
names(biof)<-names(bio2)
names(biof)
##########################
#####################
#elev
#plot(elev)
#biof <- stack(biof2,elev)
#biof
#names(biof)
#biok <- raster::stack(biof2)
#plot(biok)
#e <- extent(biok)
#p <- as(e, 'SpatialPolygons')
#projection(p) <- crs(biok)
#mask_raster <- function(raster, shape){
# outr <- crop(raster, extent(shape))
#outr <- mask(outr, p)
#return(outr)
#}
#biok<- mask_raster(raster= biof2, shape = p)
#elev <- mask_raster(raster= elev, shape = p)
#biol <- stack(biox,elev)
#biol
#plot(biol)
##############3
###cliping to afrcia extent
myshp <- readOGR("C:/Users/user/Desktop/ex/Africa.shp")
#plot(myshp)
biof3 <- raster(biof, crs=proj4string(myshp))
r2 <- crop(biof, extent(myshp))
biof3 <- mask(r2, myshp)
#plot(biof3)
names(biof3)
#plot(myshp, add=TRUE, lwd=2)
###end of clipping
pf<-predict(m,biof3,'predictf4570.img',overwrite=TRUE)
#plot(pf)
##plot(stack(p,pf))
#pf5<-calc(pf,mean)
#plot(pf5, main='predicted future')
enf5<-ensemble(m,pf,'RCP 4.5 2070.img',overwrite=TRUE,
setting = list(methods='weighted',stat='TSS',opt=2))
#plot(enf5, main='average ensf')
#enf55<-calc(enf5,mean)
#plot(enf55, main= 'mean of ensf')
plot(stack(en,enf5))
plot(en)
plot(enf5)
plot(stack(en,enf5))
ch<-enf5-en
plot(ch, main= 'Change')
getEvaluation(m,stat='AUC') ##or
ev<-getEvaluation(m,stat=c('AUC','TSS','threshold'), opt = 2)
mean(ev$threshold)
pa<-raster(en)
pa[]<-ifelse(en[]>='0.4821103',1,0)
plot(pa)
pf<-raster(enf5)
pf[]<-ifelse(enf5[]>='0.4821103',1,0)
plot(pf,main='prediction70 after mean')
pac<-pf-pa
plot(pac, main='Pf-PA')
cl<-colorRampPalette(c('red','gray','darkgreen'))
plot(pac,col=cl(3),main='PF-PA')
library(sp)
library(raster)
#z<-raster::writeRaster(pac, "changemap.tif")
#z <- raster(z) writeRaster(pac, filename="changemap.tif", overwrite=TRUE)
rcurve(m,id=2)
plot(sdm::getVarImp(m,9))
getVarImp(m)
Elias
…On Fri, Oct 9, 2020 at 10:01 PM AndreaSanchezTapia ***@***.***> wrote:
Hello Elias, GitHub does not allow for attachments.
Can you post a reproducible example of your code? Are you sure that modleR
is correctly installed on your computer?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#79 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AD4I2LCCJYAHS4Q75DTAW7DSJ5MY7ANCNFSM4SENBPZQ>
.
--
+++++++++++++++++++++++++++++++++++++++++++++
Elias Cherenet Weldemariam(MSc, BSc)
Lecturer(GIS and Remote Sensing)
Coordinator, Department of Geo-information Science (GIS)
Haramaya University, Ethiopia
Email: [email protected], [email protected] Skype: elias.weld,
+251(0)966429087
++++++++++++++++++++++++++++++++++++++++++++++
|
dear Andrea, |
Hello Elias, when reading your script I can see that you are not using modleR but other packages, such as sdm and usdm.
|
final_model(species_name = species[1], Abarema_langsdorffii |
dear Andrea,
Good afternoon,
when i tried to run the final_model script I got this error. I would like
to ask your quick help , on how to fix this problem. I tried to shorten the
path but failed to execute.
Elias
[image: image.png]
…On Mon, Oct 12, 2020 at 6:54 PM AndreaSanchezTapia ***@***.***> wrote:
Hello Elias, when reading your script I can see that you are not using
modleR but other packages, such as sdm and usdm.
As far as modleR goes, if
library(modleR)
tells you there is no package, you must install it, via
remotes::install_github()
Check the README for installation:
remotes::install_github("Model-R/modleR",
build = TRUE,
dependencies = TRUE,
build_opts = c("--no-resave-data", "--no-manual"),
build_vignettes = TRUE)
devtools::load_all() is a command used for development and it is not
meant to be run, you can skip that.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#79 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AD4I2LFLX3SGUNPXHP6TBBDSKMRD5ANCNFSM4SENBPZQ>
.
--
+++++++++++++++++++++++++++++++++++++++++++++
Elias Cherenet Weldemariam(MSc, BSc)
Lecturer(GIS and Remote Sensing)
Coordinator, Department of Geo-information Science (GIS)
Haramaya University, Ethiopia
Email: [email protected], [email protected] Skype: elias.weld,
+251(0)966429087
++++++++++++++++++++++++++++++++++++++++++++++
|
Hi Elias, your attachment is not coming through. Could you send a .zip file with your example data to [email protected], please? Occurrences for one species, scripts and one or two explanatory variables should be enough. I would like to examine a reproducible example of your code. |
I was running the following code:
final_model(species_name = species[1],
algorithms = NULL, #if null it will take all the algorithms in disk
models_dir = test_folder,
which_models = c("raw_mean",
"bin_mean",
"bin_consensus"),
consensus_level = 0.5,
uncertainty = TRUE,
overwrite = TRUE)
ens <- ensemble_model
However, I found the following error
Error in final_model(species_name = species[1], algorithms = NULL, models_dir = test_folder, :
could not find function "final_model"
Error in ensemble_model(species_name = species[1], occurrences = occs, :
could not find function "ensemble_model"
I need your help on how to fix this issue.
The text was updated successfully, but these errors were encountered: