Closed plthompson closed 1 year ago
After working with the stars package a bit more, I don't think this is a priority. You can convert a stars object to an sf dataframe using st_as_sf(x, points = TRUE, long = TRUE). I guess if you wanted to, you could code this into the predict function for sdmTMB objects but it probably isn't necessary.
@seananderson, adding this issue that we discussed. Looking to be able to make predictions using sdmTMB models based on spatiotemporal environmental data formatted using the stars package. This works for non-spatial models (e.g. lm, glm - https://r-spatial.github.io/stars/articles/stars7.html) but it doesn't know how to deal with the spatial coordinates specified in the mesh within sdmTMB. When I try predicting with a sdmTMB model it gives the following error:
The following code should allow you to reproduce this (I'll send you the data separately):
If you do decide to make this possible, one issue will be how to save the output. You could put all of the prediction vectors into a stars object but this seems a bit clunky. It probably makes more sense to convert the stars data to a dataframe and output that with new columns for the model predictions.