Closed LPDagallier closed 3 years ago
Hi,
Thanks for getting in touch and for the report.
Yes, the reason why you get the errors is because for the online reconstruction method the SpatialLinesDataFrame-specific routines are not implemented yet. At the moment these are only added for the offline reconstructions that use the GPlates Desktop Application. If you install GPlates (https://www.gplates.org/), the following script should work:
# download the paleomap model (same version as the online method)
mod <- chronosphere::fetch("paleomap", "model", ver="v3-GPlates")
# present day admin lines
adminlines = chronosphere::fetch(dat = "paleomap", var = "adminlines")
# subset
chile <- adminlines[which(adminlines$ADMIN == "Chile"),] #subset to have a small object
plot(chile) # just check that Chile has been well selected
# 50ma reconstruction background
world50 <- reconstruct("plates", age=50, model=mod)
plot(world50, col="gray", border=NA)
chile50 <- reconstruct(chile, age = 50, model=mod)
plot(chile50, add=T)
I will try to incorporate the missing method (using @lines) in the next update. I can try to prioritize this if you need it fast. Please let me know if the solution above does not work for you for some reason!
As a side note, please be aware that the paleocoordinate reconstruction-related functions will be separated from the main chronosphere package in the next update for easier maintenance (the downloads will remain where they are). The coordinate reconstructions (i.e. reconstruct()) have already been copied to the rgplates package (https://cran.r-project.org/package=rgplates) and will be maintained there in the foreseeable future.
Best,
Adam
Hi, Thank you a lot for your reply. It works very well with GPlates locally installed. I will use this method instead of the online reconstruction method. Thanks a lot for this incredible tool, very useful ! Best, Léo-Paul
Hi, Thanks a lot for this wonderful package !
I have an issue while reconstructing a SpatialLinesDataFrame:
As a reproducible example:
I got the following message: "Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘coordinates’ for signature ‘"NULL"’ "
I also tried with a very simple SpatialLinesDataFrame object created from scratch (code from
sp
vignette):And got the same error.
I check through the
reconstruction.R
script, and it seems that the problem comes from the fact that for "SpatialLinesDataFrame" objects, the reconstruction is passed togplates_reconstruct_polygon
internal function (line 320). And when this function (line 848) tries to retrieve the attributes from the sp input object, it tries to retrieve the 'polygons' attributes and not the 'lines' attributes (polys = attr(sp,'polygons')
line 853), which causes coordinate extractions to be "NULL".