Skip to main content

error message: The used raster is not a UD (sum unequal to 1)

No replies
Joined: 01/25/2017

I'm trying to run a bursted dBBMM for an indidivual. This works, but when I then try to calculate the sum of individual segments to aggregate them, i get the following error message returned:

Error in validityMethod(object) : 
  The used raster is not a UD (sum unequal to 1), sum is: 1.000000017713939
One possible cause is loss of accuracy due to writing raster to disk with dataType FLT4S this can be solved preventing disk usage or changing data type
I tried to change the datatype to FLT8S inside the brownian.bridge.dyn() function, but after close inspection of the resulting object, it still maintains it's original dataype. I do not know how to test the alternative solution which is to prevent disk usage. A workaround would be greatly appreciated that doesn't involve changing parameter settings.
Below is the code that i am trying to run ([j] refers to a single individual in a list):
bursted <- burst(rNew.sp[[i]], c('normal','long')[1+(timeLag(rNew.sp[[i]], units = 'hours')>6)])
bursted_dbbmm <- brownian.bridge.dyn(bursted, burstType='normal', raster = xAEQD.sp, location.error = "LocationError", time.step = 2, ext = 3)
dbbmmlist[[i]] <- new(".UD",calc(bursted_dbbmm,sum))
Thank you
Joined: 06/07/2012

Hi, sorry for the late answer. Probably you have found another way. But here is a maybe a workaround that could work:


## sum up the stack of dbbmms
dbbmmSum <- calc(bursted_dbbmm,sum)
# if it does not sum up to 1, normalize the raster
dbbmmSumN <- dbbmmSum/cellStats(dbbmmSum,sum)
# now it should sum up to 1
# convert it to class ".UD" to be able to use the function getVolumeUD()
dbbmmSum <- as(dbbmmSum,".UD")