Closed goldingn closed 9 years ago
I can confirm that this still produces an error:
sdm <- workflow(SpOcc(species = 'Eresus sandaliatus', extent = c(-10, 45, 10, 65), databases = 'gbif'),
Bioclim(extent = c(-10, 45, 10, 65)),
OneHundredBackground,
BiomodModel(modelType = 'MAXENT'),
SurfaceMap
)
Caught errors: Error in modOut[[i]][[j]][[k]]: subscript out of bounds
I'm looking into this now
The warnings that arrived with the error above suggest I was missing a nessecary file:
In addition: Warning messages:
1: package ‘spocc’ was built under R version 3.2.2
2: In .Models.check.args(data, models, models.options, NbRunEval, DataSplit, :
The maxent.jar file is missing. You need to download this file (http://www.cs.princeton.edu/~schapire/maxent) and put the maxent.jar file in your working directory -> MAXENT was switched off
When I downloaded this file into my working directory I no longer had the error, though a new error arrived:
Error in file(file, "rt") : cannot open the connection
In addition: Warning messages:
1: running command 'java' had status 1
2: running command 'java -mx512m -jar W:/PYWELL_SHARED/Pywell Projects/BRC/Tom August/ZOON/zoon_package/maxent.jar environmentallayers="Species/models/1439988028/m_33731353/Back_swd.csv" samplesfile="Species/models/1439988028/m_33731353/Sp_swd.csv" projectionlayers="Species/models/1439988028/m_33731353/Predictions/Pred_swd.csv" outputdirectory="Species/models/1439988028/Species_AllData_Full_MAXENT_outputs" outputformat=logistic redoifexists visible=FALSE linear=TRUE quadratic=TRUE product=TRUE threshold=TRUE hinge=TRUE lq2lqptthreshold=80 l2lqthreshold=10 hingethreshold=15 beta_threshold=-1 beta_categorical=-1 beta_lqp=-1 beta_hinge=-1 defaultprevalence=0.5 autorun nowarnings notooltips noaddsamplestobackground' had status 1
3: In file(file, "rt") :
cannot open file 'Species/models/1439988028/Species_AllData_Full_MAXENT_outputs/Species_AllData_Full_Pred_swd.csv': No such file or directory
This looks like a file is supposed to be written but isn't, and it looks to be during the predictions step. has anyone seen this before @timcdlucas ?
I'm not really the right person to ask as I'm not sure I've ever actually run a maxent model...
Found this from google that is the same error. But there's quite a large number of potential fixes. https://groups.google.com/forum/#!topic/maxent/_MBiGp5eDGw
Definitely worth making sure biomod is working first, then dealing with biomod in zoon problems.
I'm not getting anywhere with this. I followed @timcdlucas suggestion and can't even get it to work in biomod using the package example. I would be interesetd to know if this code works for anyone else? (remember you have to download the maxent.jar file first)
# species occurrences
DataSpecies <- read.csv(system.file("external/species/mammals_table.csv",
package="biomod2"))
head(DataSpecies)
# the name of studied species
myRespName <- 'GuloGulo'
# the presence/absences data for our species
myResp <- as.numeric(DataSpecies[,myRespName])
# the XY coordinates of species data
myRespXY <- DataSpecies[,c("X_WGS84","Y_WGS84")]
# Environmental variables extracted from BIOCLIM (bio_3, bio_4, bio_7, bio_11 & bio_12)
myExpl = stack( system.file( "external/bioclim/current/bio3.grd",
package="biomod2"),
system.file( "external/bioclim/current/bio4.grd",
package="biomod2"),
system.file( "external/bioclim/current/bio7.grd",
package="biomod2"),
system.file( "external/bioclim/current/bio11.grd",
package="biomod2"),
system.file( "external/bioclim/current/bio12.grd",
package="biomod2"))
# 1. Formatting Data
myBiomodData <- BIOMOD_FormatingData(resp.var = myResp,
expl.var = myExpl,
resp.xy = myRespXY,
resp.name = myRespName)
# 2. Defining Models Options using default options.
myBiomodOption <- BIOMOD_ModelingOptions()
# 3. Doing Modelisation
myBiomodModelOut <- BIOMOD_Modeling( myBiomodData,
models = c('MAXENT','RF'),
models.options = myBiomodOption,
NbRunEval=2,
DataSplit=80,
VarImport=0,
models.eval.meth = c('TSS','ROC'),
do.full.models=FALSE,
modeling.id="test")
Bombed out on my mac as I don't have JRE installed (nope, you can't make me). So ran it on an ubuntu machine and it ran just fine.
What error are you getting?
It did not work for me until I used myBiomodOption <- BIOMOD_ModelingOptions( MAXENT = list( path_to_maxent.jar = getwd()) )
instead. With the jar file in the working directory. Also on Ubuntu.
Thanks guys, I'll pick this up tomorrow
Think I got to the bottom of this error. It is because of a space in the file path to the .jar file. This then breaks when it is used in a shell command call to java.
I moved the .jar file to a path without a space and it ran just fine using the code:
myBiomodOption <- BIOMOD_ModelingOptions(MAXENT = list(path_to_maxent.jar = 'C:/Users/tomaug/Documents/maxent.jar'))
I could then also get zoon to run without error by setting this as my working directory:
setwd('C:/Users/tomaug/Documents')
sdm <- workflow(SpOcc(species = 'Eresus sandaliatus', extent = c(-10, 45, 10, 65), databases = 'gbif'),
Bioclim(extent = c(-10, 45, 10, 65)),
OneHundredBackground,
BiomodModel(modelType = c('MAXENT')),
SurfaceMap)
This is really a bug with biomod2, I'll raise it with their maintainer
This is not an issue with...
# _____________ ____________ ____________ ___________________
# \ ______ \__ _\ ______ \ _\ ______ \ _\ ___ \______
# \ / \ \ \ \ \ \__ _\ \ \ \ \ _\ \ \/ \ \_____
# \ / \ \ \ \ \ \ \ \ \ \ \ \__ _\ \ \ \ \ \____
# \ /______ \ \ \ \_____\ \ \ \ \ \_____\ \ \ \ \ \ \ \ \___
# \___________\__\_\___________\__\_\_\___________\__\_\_\_\___________\__
# \____________\___\_\____________\___\_\_\____________\__
# \____________\_____\_\____________\___
# SPECIES DISTRIBUTION MODELLING \____________\____
...it is an issue with Biomod, so I am closing it. The bug is known the the biomod dev team. Worth remembering though as it is an issue people are likely to come across.
Tim has an old issue here: https://github.com/zoonproject/modules/issues/9
may not still be a problem, but worth checking out.
For future I think we should continue using
zoon
issues for trackingmodules
issues, since they interact