Bias has zero or negative vales, ignoring bias grid.

915 views
Skip to first unread message

Steve Research

unread,
Jun 15, 2016, 7:58:43 PM6/15/16
to Maxent

Hi,

I have created a bias file showing distance to roads but keep getting the error "Bias has zero or negative vales, ignoring bias grid."

The file looks good though.

Anyone know what causes this?

Cheers,
Steve

Steve Research

unread,
Jun 15, 2016, 8:01:06 PM6/15/16
to Maxent
'vales" = values - it's 1AM and I'm getting tired!

Lawrence, Kevin

unread,
Jun 15, 2016, 8:27:38 PM6/15/16
to max...@googlegroups.com

Steve,

Not sure if this will work but you could use the raster package from R to reclassify all the negative or zero values to NA.

 

library(raster)

set your working directory

setwd("D:\\maxent\\bias")

 

you should have your bias layer as an ascii

 

biaslayer<-raster("biaslayer.asc")

 

use reclassify function

biaslayer1 <- reclassify(biaslayer , c(-Inf,0, NA))

 

this converts any bias figure from –infinite to zero to NA

 

convert biaslayer1 bask to an ascii

 

writeRaster(biaslayer1, " biaslayer1.asc", format="ascii",overwrite=TRUE)

 

load biaslayer1.asc as your bias layer into Maxent

tell me if it works, a quick fix if it does.

 

Kevin

--
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+un...@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.

Michael Treglia

unread,
Jun 15, 2016, 9:37:36 PM6/15/16
to max...@googlegroups.com
I recently encountered a similar issue - the values in my bias file were too small for MaxEnt, being extremely close to 0, as it was from a KDE surface, so most of the pixels had extremely low probabilities.  (maybe it has to do with MaxEnt reading things in as Float16 or something instead of a format that can hold more decimal places?)

My resolution at the time was just to multiply the surface by a large number (maybe ~10^20?), and that did the trick. It was more exploratory than anything, so I didn't look further into it.

Hope that helps,
mike

Hossein Vahidi

unread,
Jun 15, 2016, 9:59:14 PM6/15/16
to Maxent
Hello,

I got the following simple strategy for the similar problem, but I am not sure if my approach is correct:

1- Generating the "distance to road layer" (0 on the roads and 1000 (maximum value) on the the edge for instance).
2- Creating a new layer by dividing the "distance to road layer"  to 1000 to normalize the distance to road layer (now our values are something between 0 to 1). Lets call this new layer as NormalizedLayer.
3- To produce the bias layer, I used this formula:    BiasLayer= 1/ (NormalizedLayer+Constant Value). The "constant value" in this formula  is just for avoiding to get the infinity in the case that denominator of the fraction has the value of zero (the areas that are located on the road). The constant value has to be selected according to the case.

Best,

Hossein


Steve Research

unread,
Jun 16, 2016, 4:46:27 AM6/16/16
to Maxent
Hi Kevin, you're a steely-eyed Raster wrangler!

The script works but using the 'NA' option creates no-data 'holes' in the raster, that Maxent then complains about.

I modified your script slightly. I took out the  'setwd' as I can simply run it in the directory.

I also changed the 'NA' for '0.0000000000000000001e-09' which I suspect is the smallest value that I can use?- Any thoughts on any negative impact on Maxent that might have?

So I used:

library(raster)
biaslayer<-raster("biaslayer.asc")

biaslayer1 <- reclassify(biaslayer , c(-Inf,0, NA))
writeRaster(biaslayer1, " biaslayer1.asc", format="ascii",overwrite=TRUE)

Maxent runs with this file.
Any reason that anyone can see that it might cause issues doing that?

Cheers,
Steve

Lawrence, Kevin

unread,
Jun 16, 2016, 4:46:51 PM6/16/16
to max...@googlegroups.com

Don’t think there would be any issues, you could try adding the constant that was also suggested and compare the results.

Reply all
Reply to author
Forward
0 new messages