sinkovit / Spatial-ecology

Space use software deployed in the Spatial Ecology Gateway
MIT License
2 stars 0 forks source link

_workflow1.R runtime error #20

Closed monaw closed 1 year ago

monaw commented 1 year ago

if i modify _workflow1.R to use pandabob.txt instead of the CondorFull.csv, then i get a runtime error:

[...]
    Processing move step 145 of 146
    Processing move step 146 of 146
    Maximum voxel density = 0
    Sum of voxel densities = 0
2D MKDE Computation: DONE
[1] "First raster"
Error in image.default(mkde.obj$x, mkde.obj$y, dens.dat, breaks = cont.vals$threshold,  : 
  increasing 'x' and 'y' values expected

After some debugging, it appears that xmin <- min(data$xdata) throws a runtime error however ymin <- min(data$ydata) is fine! From my debugging using pandabob.txt, data$xdata is numeric, while data$ydata is integer...not sure if that explains the problem and a check of min() function suggests that it should be able to handle both types...what's also weird is that if i test using CondorFull.csv, both data$xdata and data$ydata are numeric but "xmin <- min(data$xdata)" still throws an error!

sinkovit commented 1 year ago

This was a pretty easy fix. The cell size that I use for the condor data is way too large for the pandabob.txt data. So replace "cell.sz <- 3000" with "cell.sz <- 30" in line 12 when working with the panda data.

Btw, xmin <- min(data$xdata) does NOT throw an error for me with the condor data