ENMeval erro

406 views
Skip to first unread message

Obunga johnny

unread,
Jun 15, 2017, 1:36:01 AM6/15/17
to Maxent

Hello,

I’m a beginner in R. I’m trying to get run ENMeval in order to objectively select a regularization multiplier. However, I get an error with the piece of code below.

Please I need your help.

Thank you in advance.

Johnny.


R version 3.3.3 (2017-03-06) -- "Another Canoe"

Copyright (C) 2017 The R Foundation for Statistical Computing

Platform: i386-w64-mingw32/i386 (32-bit)

 

## set working directory

> setwd("C:/Users/...")

#load libraries ##

> library(ENMeval)

Loading required package: dismo
Loading required package: rJava
Loading required package: parallel
Warning message:
package ‘ENMeval’ was built under R version 3.4.0 

> library(raster)

Loading required package: sp

 

## import presence points

 

> pres <- read.csv("C:/...presence.csv")

 

## import rasters

 

> bio_2 <- raster("C:/.../bio_2.asc")

> bio_11 <- raster("C:/.../bio_11.asc")

> bio_15 <- raster("C:/.../bio_15.asc")

> bio_16 <- raster("C:/.../bio_16.asc")

> bio_17 <- raster("C:/.../bio_17.asc")

> bio_18 <- raster("C:.../bio_18.asc")

> bio_19 <- raster("C:/.../bio_19.asc")

 

## create raster stack

 

> my_stack <- stack(bio_2, bio_11, bio_15, bio_16, bio_17, bio_18, bio_19)

 

# create maxent arguments

 

> Reg_values <- c(seq(1.0, 4.0, 0.5))

> feature_classes <- c("LQH", "LQHP", "LQHT", "LQHPT")

 

##run ENMvaluate

 

> enmval_run <- ENMevaluate(pres, my_stack, RMvalues = Reg_values, fc = feature_classes, method = "randomkfold", kfolds = 5, n.bg = 10000, overlap = FALSE, bin.output = TRUE, clamp = TRUE)

 

Doing random k-fold evaluation groups...

Error: Failure during raster IO

In addition: Warning message:

In couldBeLonLat(mask2) : CRS is NA. Assuming it is longitude/latitude

 

Jamie M. Kass

unread,
Jun 15, 2017, 1:51:25 AM6/15/17
to Maxent
Hm... never seen that error before. Looks like there's a problem with the rasters. Can you plot them? Run operations on them (i.e. resample())? Did you run extract(my_stack, pres) and see if they have values? Just a start for debugging. The CRS warning is not an issue as long as the coordinates of the points and rasters is lat/long and not in meters.

Jamie Kass
PhD Candidate
City College of NY

Obunga johnny

unread,
Jun 15, 2017, 7:27:22 AM6/15/17
to Maxent

Hi,Jamie,

Thank you for your time.

All the operations you mentioned work just fine.

I downloaded these rasters from WorldClim. I only did crop then convert them from .bil to .asc.

Quite frustrating L

Dimitris Poursanidis

unread,
Jun 15, 2017, 7:30:58 AM6/15/17
to max...@googlegroups.com
The rasters from WORLDCLIM, even if are at lat,lon WGS84 system, this is not "written" on them.
Thus you need to check and deifne the projection system ina GIS / R application tool.
Check if the asc files have projection system because in the last line of the error is mentioned the CRS (Coordinate Reference System) that is NA.

--
You received this message because you are subscribed to the Google Groups "Maxent" group.
To unsubscribe from this group and stop receiving emails from it, send an email to maxent+unsubscribe@googlegroups.com.
To post to this group, send email to max...@googlegroups.com.
Visit this group at https://groups.google.com/group/maxent.
For more options, visit https://groups.google.com/d/optout.

Jamie M. Kass

unread,
Jun 15, 2017, 8:48:46 AM6/15/17
to Maxent
Yes, but that is simply a warning that the raster package is treating them as though they are lat/long projection. This is only a problem if they are not lat/long.

What format is "pres"? Can you print head(pres) and post it?

Obunga johnny

unread,
Jun 15, 2017, 9:24:17 AM6/15/17
to Maxent
Thank you Jamie,
Please see below,


> my_stack
class       : RasterStack 
dimensions  : 6000, 8400, 50400000, 7  (nrow, ncol, ncell, nlayers)
resolution  : 0.008333333, 0.008333333  (x, y)
extent      : -120, -50, -10, 40  (xmin, xmax, ymin, ymax)
coord. ref. : NA 
names       : bio_2, bio_11, bio_15, bio_16, bio_17, bio_18, bio_19 


> head(pres)

> head(pres)
       x     y
1 -89.25 17.25
2 -95.25 18.25
3 -95.25 18.25
4 -92.25 16.75
5 -92.25 16.75
6 -88.75 16.25

Thanks
To unsubscribe from this group and stop receiving emails from it, send an email to maxent+un...@googlegroups.com.

ndimhypervol

unread,
Jun 15, 2017, 9:36:25 AM6/15/17
to max...@googlegroups.com
Johnny,

Yeah, everything looks like it should work -- you're inputting everything correctly, as it would seem. Perhaps the error has to do with the inability to use extract() on the stack due to lack of computing power? Please see this thread.


Please try running extract() on this stack with pres and see if it completes.

Jamie Kass
PhD Candidate, CCNY
City College of NY
You received this message because you are subscribed to a topic in the Google Groups "Maxent" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/maxent/FHtd5l2IlPQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to maxent+un...@googlegroups.com.

Obunga johnny

unread,
Jun 15, 2017, 4:05:09 PM6/15/17
to Maxent
Hi Jamie,
extract() did not complete as you suspected. Here is what I get:
Error: Failure during raster IO
I guess I need more computing power. 
Many thanks for your time. 
Regards.
Message has been deleted

Jamie M. Kass

unread,
Jun 23, 2017, 11:38:27 PM6/23/17
to Maxent
A possible workaround could be subsetting the point dataset to very small numbers of points and performing multiple small extractions. This might work for your computer.

Obunga johnny

unread,
Jul 16, 2017, 12:26:25 PM7/16/17
to Maxent

Hello Jamie,
Please, I'm still on ENMeval. Here is the error I encountered.
I don't really know what that  means but I have cross-checked my presence records and everything seems to be in order.
Your help is greatly appreciated.

enmval_run <- ENMevaluate(pres, my_stack, RMvalues = Reg_values, fc = feature_classes, method = "randomkfold", kfolds = 5, n.bg = 10000, overlap = FALSE, bin.output = TRUE, clamp = TRUE)

Doing random k-fold evaluation groups...

Warning: some predictors variables are NA at some occurrence points

  |==                                                       |   4%

Error in data.frame(..., check.names = FALSE) :

  arguments imply differing number of rows: 1, 2, 0

In addition: Warning message:

In couldBeLonLat(mask) : CRS is NA. Assuming it is longitude/latitude


Many thanks.
Johnny.

Jamie M. Kass

unread,
Jul 19, 2017, 1:01:38 PM7/19/17
to Maxent
Johnny,

Sorry to see you're having more issues. Can you please print out the main inputs to the function and post them here? Please just use head() for big tables, and show all the input vectors. This will help me diagnose the issue.

Jamie

Obunga johnny

unread,
Jul 20, 2017, 9:47:44 AM7/20/17
to Maxent

Dear Jamie,

Goodness! you are right about the inputs! I just ran ENMevaluate smoothly. Silly me got things mixed up in the feature class vector.  

I am very thankful for your time.

Best regards

Johnny.

Jamie M. Kass

unread,
Jul 29, 2017, 10:42:16 PM7/29/17
to Maxent
Great you got this resolved.

Marjolaine Caillat

unread,
Sep 12, 2017, 12:01:29 AM9/12/17
to Maxent
Dear Jamie and Johnny,

Ihad a similar error message than Johnny but I can't see what did you do excatly to have your pb solved:
Below is my code: with the error message:

#Load Raster layer, could be .asc files
Trat_depth<-raster('E:\\My_Documents\\Work\\Bycatch_Project\\Maxent\\TRAT\\Env_Layers\\trat_depth.asc')
Trat_DistRiv<-raster('E:\\My_Documents\\Work\\Bycatch_Project\\Maxent\\TRAT\\Env_Layers\\trat_distriv.asc')
Trat_DistLand<-raster('E:\\My_Documents\\Work\\Bycatch_Project\\Maxent\\TRAT\\Env_Layers\\trat_distland.asc')

#Stack raster into one variable
Trat_envSlope<-stack(Trat_depth,Trat_DistLand,Trat_DistRiv,Trat_Slope)
Trat_env<-stack(Trat_depth,Trat_DistLand,Trat_DistRiv)

#Call ENMevaluate function
TRAT_LRDNODupl<-ENMevaluate(Trat_occNoDupli, Trat_env, RMvalues = seq(0.5, 4, 0.5),method='randomkfold', overlap=TRUE, aggregation.factor=c(5,5), bin.output=TRUE, parallel = TRUE,kfolds=10)



Warning: some predictors variables are NA at some occurrence points
Of 2 total cores using 2
Running in parallel...
Error in { : 
  task 1 failed - "arguments imply differing number of rows: 1, 2, 0"


I'm wondering if it is because of some predictor variables NA at some occurence points...
Thanks so much for yourhelp.

Best,

Marjolaine :-)

Jamie M. Kass

unread,
Sep 14, 2017, 2:59:28 PM9/14/17
to max...@googlegroups.com
Marjolaine,

Not sure what the issue is. I would start by checking to see if you have some occurrences with non-NA values. If all are NA, it's likely a projection issue. I would also print to the console all your inputs and make sure they are what you thought they should be.

Jamie

To unsubscribe from this group and all its topics, send an email to maxent+unsubscribe@googlegroups.com.

To post to this group, send email to max...@googlegroups.com.
Visit this group at https://groups.google.com/group/maxent.
For more options, visit https://groups.google.com/d/optout.



--
-----------------------------------------------------------
Jamie Kass
PhD Student, Department of Biology
City College of New York, CUNY Graduate Center
Reply all
Reply to author
Forward
0 new messages