Re: Error message: goodAlpha

353 views
Skip to first unread message

John Baumgartner

unread,
Jul 26, 2012, 4:38:41 AM7/26/12
to max...@googlegroups.com
Hi Edeline,

I think we may need some additional details.

1. Are you receiving this error when running from R (i.e. with Dismo), or from Maxent GUI? 

2. Is goodAlpha one of your variables?

3. What does the rest of the error message say?

4. What do you mean by transform (coordinate system, or grid values)?

John


On 26/07/2012, at 1:11 PM, Edeline Gagnon <edeline...@gmail.com> wrote:

Hello,
I'm wondering if anyone can help me with error message in Maxent.
I'm planning to run Maxent in R, but as I'm still learning the different commands, I wanted to do a quick run with my occurence data an cropped raster file (19 bioclim variables, using the function getData from the library(raster)). I exported the occurence data as a .csv file that has the species, dd long, dd lat columns. For the raster file, I exported in the grd format using the writeRaster function (library (Raster).

The error message I get when I set these two files as my sample and environmental layer comes right after the extraction of the sample and random background data

Error: goodAlpha: returning NaN for pi[f]= ......etc.

I suspect that I need to transform my raster file before I can export it...

Any help or hint would be great!
Edeline

--
You received this message because you are subscribed to the Google Groups "Maxent" group.
To view this discussion on the web visit https://groups.google.com/d/msg/maxent/-/AyknVnhgYx8J.
To post to this group, send email to max...@googlegroups.com.
To unsubscribe from this group, send email to maxent+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/maxent?hl=en.

Edeline Gagnon

unread,
Jul 27, 2012, 11:17:50 AM7/27/12
to max...@googlegroups.com
Hi John, 

1. Are you receiving this error when running from R (i.e. with Dismo), or from Maxent GUI? 

I'm receiving this message from the Maxent GUI. I've actually been able to run Maxent with my raster file in R, including adding flags to the 'args' options).

2. Is goodAlpha one of your variables?

No, my variables are the 19 bioclim variables.
 
3. What does the rest of the error message say?

The rest of the error message looks like an equation, but that has a bunch of squares and other weird characters, as though the required font wasn't available in the system.

4. What do you mean by transform (coordinate system, or grid values)?

This is how I got the 19 BIOCLIM variables through R:

library(raster)
library(rgdal)
bio19.2.5<-getData('worldclim', var='bio', res=2.5)

# Next command crops the raster to the extent of the distribution of the genera I'm interested in. 
leu.extent<-extent(-120,-60,-5,35)
bio19.crop<-crop(bio19.2.5, leu.extent)
plot(bio19.crop,1)

> bio19.crop
class       : RasterBrick 
dimensions  : 960, 1440, 1382400, 19  (nrow, ncol, ncell, nlayers)
resolution  : 0.04166667, 0.04166667  (x, y)
extent      : -120, -60, -5, 35  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0 
values      : in memory
layer names : bio1, bio2, bio3, bio4, bio5, bio6, bio7, bio8, bio9, bio10, bio11, bio12, bio13, bio14, bio15, ... 
min values  : -15, 18, 23, 95, 37, -121, 56, -19, -20, -13, -41, 19, 8, 0, 7, ... 
max values  : 294, 213, 95, 9032, 428, 242, 419, 332, 299, 340, 285, 10577, 1197, 697, 209, ... 

# And here is the command I've been using to export this raster file; I first wanted to create a .asc from my raster file, but couldn't find the 
# appropriate function in R. From I'm been able to gather though, Maxent should also be able to handle .grd files as layers; 
toto<-writeRaster(bio19.crop, filename="bio19crop.grd")

Two files are created, the grd. and gri file for bio19_crop. The layer "bio19crop" pops up when it is saved in the layer folder in Maxent. Everytime I try to run it though, it doesn't work. I've attached the produced .grd file (but not the .gri, it won't upload as it is 85MB in size). 

I would really like to understand the best way to export this rasterbrick, because I would also like to use it to verify other things in the data, like colinearity of the 19 variables, with ENMtools.

Any help or hint you could give with this matter would be great!
Thanks,
Edeline
 
 
John


On 26/07/2012, at 1:11 PM, Edeline Gagnon <edeline...@gmail.com> wrote:

Hello,
I'm wondering if anyone can help me with error message in Maxent.
I'm planning to run Maxent in R, but as I'm still learning the different commands, I wanted to do a quick run with my occurence data an cropped raster file (19 bioclim variables, using the function getData from the library(raster)). I exported the occurence data as a .csv file that has the species, dd long, dd lat columns. For the raster file, I exported in the grd format using the writeRaster function (library (Raster).

The error message I get when I set these two files as my sample and environmental layer comes right after the extraction of the sample and random background data

Error: goodAlpha: returning NaN for pi[f]= ......etc.

I suspect that I need to transform my raster file before I can export it...

Any help or hint would be great!
Edeline

--
You received this message because you are subscribed to the Google Groups "Maxent" group.
To view this discussion on the web visit https://groups.google.com/d/msg/maxent/-/AyknVnhgYx8J.
To post to this group, send email to max...@googlegroups.com.
To unsubscribe from this group, send email to maxent+unsubscribe@googlegroups.com.
bio19crop.grd

John Baumgartner

unread,
Jul 27, 2012, 8:15:05 PM7/27/12
to max...@googlegroups.com
Hi again Edeline,

I've not worked with .gri files, but I'm pretty sure you'd need to export each layer of the brick as a separate .gri.

writeRaster should also be able to write .asc files (again, you need to write a single layer of the brick/stack at a time). Try:

for (i in 1:nlayers(bio19.crop)) {
  writeRaster(bio19.crop[[i]], filename=paste('bio', i, '.asc', sep=''))
}

This will write layers to 'bio1.asc', 'bio2.asc', etc., in your current working directory. Replace 'asc' with 'grd' if you actually do want to use grd files.

Try that and post back if it's still not working.

Cheers,
John

John Baumgartner

unread,
Jul 27, 2012, 8:15:58 PM7/27/12
to max...@googlegroups.com
* by the way... .gri should have read .grd in my text "I've not worked with .gri files, but I'm pretty sure you'd need to export each layer of the brick as a separate .gri.".

Edeline Gagnon

unread,
Jul 27, 2012, 8:27:44 PM7/27/12
to max...@googlegroups.com
Hi John,
files worked, it was brilliant!
Thanks for your help,
Edeline

2012/7/27 John Baumgartner <jbb...@gmail.com>
To view this discussion on the web visit https://groups.google.com/d/msg/maxent/-/p6IMC79AL2cJ.

To post to this group, send email to max...@googlegroups.com.
To unsubscribe from this group, send email to maxent+un...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/maxent?hl=en.



--
Candidate au doctorat (Ph. D.),
Laboratoire de Systématique Moléculaire,
Institut de Recherche en Biologie Végétale (IRBV), Université de Montréal
(514) 343-6111 p.83144

Hossein Khandan

unread,
Jul 29, 2012, 10:26:06 PM7/29/12
to max...@googlegroups.com
I would really like to appreciate John for his kindly and unique helps to all questions. I am new in Maxent but learning alot from his posts and replies. Thanks John


Prangya Paramita Gupta Sarkar

unread,
Feb 19, 2016, 7:40:07 AM2/19/16
to Maxent

Hi,

I can see the post is quite old, still hoping to get some reply on my question.

I am receiving the same goodAlpha error in MaxEnt while running my data. I have used bioclim variables and future climate data from Worldclim and processed them in ArcGIS.

I dont know 'R'. So how can I solve it?

Cheers Prangya

mirela b

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

maxent error Good Alpha: returning NaN for pi[f]...

I think you fixed the problem until now but I want to say that for me the bias file was not good, that's why I also received the same error (the value must not be 0 or negative). 

All the best,
Mirela
Reply all
Reply to author
Forward
0 new messages