SPATIAL-Lab / assignR

R package for geographic assignment
17 stars 4 forks source link

calRaster output not working with pdRaster #42

Open salinedi0n opened 3 hours ago

salinedi0n commented 3 hours ago

Hello,

I'm a grad student using your package and am very grateful for it! Thank you!

I was wondering if you have experienced issues like this before -- the output of the calRaster function is not working with the pdRaster function.

I have an isoscape (with both the d2h values and standard error) together in the RasterBrick object "c200_both". The file with my known origin samples is "ultra_known_origins".

I can run the following fine:

calibrated <- calRaster(known = ultra_known_origins, isoscape = c200_both, interpMethod = 1, genplot = FALSE, verboseLM = TRUE)

It returns the object "calibrated" as type rescale and list of 3.

When I run:

unknowns_prob = pdRaster(calibrated, as.data.frame(Feather_d2h_for_R))

All I get back is "NULL".

Sometimes when I run the calRaster function, I get a warning that the function will make the object no longer an s4 object.

Do you know what I'm doing wrong?

Thank you for your time!

bumbanian commented 2 hours ago

Hard to say for sure w/o a reproducible example that I can run, but my hunch is that it could be related to using a RasterBrick as input to calRaster. assignR transitioned away from the depreciated raster package a few versions back and although we're trying to continue to provide backwards compatibility you should use terra spatial objects for best performance and stability.

You could try:

c200_terra = rast(c200_both)

and then use the result as your isoscape input to calRaster. If that doesn't work please provide example data that I can use to reproduce the problem.

-Gabe