densitymodelling / dsmextra

Extrapolation assessments in density surface models
GNU Lesser General Public License v3.0
4 stars 3 forks source link

Function `safe_raster()` in `compute_extrapolation` not found #15

Closed patch105 closed 1 year ago

patch105 commented 1 year ago

Hi there, I'm doing some trouble-shooting with my data (checking some unexpected results) so I've been using the source code for the compute_extrapolation and ExDet functions. However the function safe_raster from the compute_extraplation function is not available anywhere that I've looked. It looks to be a function just to generate rasters from the output list for univariate, analogue, and combinatorial layers but I wanted to highlight this just in case others want to use the source code.

pjbouchet commented 1 year ago

The safe_raster function is an internal package function that is saved in the utils.R file (see GitHub repo). It applies the safely construct to the rasterfromXYZ function, as shown below:

safe_raster <- purrr::safely(function(x) suppressWarnings(raster::rasterFromXYZ(xyz = x)), otherwise = NULL)

Hope this helps! Phil

patch105 commented 1 year ago

Ah, I missed that in the utils file! That's great, thank you.