densitymodelling / dsmextra

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

Prediction grid cells are not regularly spaced #7

Closed pjbouchet closed 4 years ago

pjbouchet commented 4 years ago

Some users have reported the below error when using compute_extrapolation (which also affects compute_nearby and extrapolation_analysis):

Error in compute_extrapolation(segments = Input, covariate.names = cov_vec2, : Prediction grid cells are not regularly spaced. A target raster resolution must be specified.

pjbouchet commented 4 years ago

This error arises because a key feature of dsmextra is to provide tools for visualising extrapolation wherever it occurs. As such, compute_extrapolation returns results in both numerical and raster formats (see vignette for details). The raster package expects cells in the supplied prediction.grid object to be evenly spaced. If they are not, then dsmextra will automatically generate a suitable raster as long as the resolution argument is specified. Otherwise, it will throw the above error.

The solution to this is therefore to add, say, resolution = 15000, to the function call (assuming 15000 is an appropriate cell spacing for your data). Note that this is expressed in the units of the coordinate system used.

Phil