chronosphere-info / r_client

R client for the chronosphere
https://chronosphere.info/r_client/
GNU General Public License v3.0
6 stars 5 forks source link

Cannot reconstruct coastlines locally #5

Open massaGitHub opened 3 years ago

massaGitHub commented 3 years ago

Hi, I always enjoy using chronosphere.

I installed chronosphere 0.4.0 from CRAN to R v. 3.6.3 on Windows10 I tried to reconstruct coastlines locally like this.

mo <- fetch("paleomap", "model", datadir="~") coast <- reconstruct("coastlines", age=1, model = mo)

And got an error like this.

Error in as.character.default(new("platemodel", name = "PALEOMAP plate tectonic reconstruction files (C. Scotese)", : no method for coercing this S4 class to a vector

traceback() is like this,

7: as.character.default(new("platemodel", name = "PALEOMAP plate tectonic reconstruction files (C. Scotese)", 
       rotation = "C:/Users/______/AppData/Local/Temp/RtmpIFCHOt/paleomap_model_v3-GPlates/PALEOMAP_PlateModel.rot", 
       polygons = "C:/Users/______/AppData/Local/Temp/RtmpIFCHOt/paleomap_model_v3-GPlates/PALEOMAP_PlatePolygons.gpml", 
       version = "v3 (GPlates resource)"))
6: as.character(new("platemodel", name = "PALEOMAP plate tectonic reconstruction files (C. Scotese)", 
       rotation = "C:/Users/______/AppData/Local/Temp/RtmpIFCHOt/paleomap_model_v3-GPlates/PALEOMAP_PlateModel.rot", 
       polygons = "C:/Users/______/AppData/Local/Temp/RtmpIFCHOt/paleomap_model_v3-GPlates/PALEOMAP_PlatePolygons.gpml", 
       version = "v3 (GPlates resource)"))

5: sprintf("?time=%d&model=%s", age, model) 4: gplates_reconstruct_coastlines(age = age, model = model, verbose = verbose) 3: .local(x, ...) 2: reconstruct("coastlines", age = 1, model = mo) 1: reconstruct("coastlines", age = 1, model = mo)

The same happened when I installed chronosphere from Github (0.4.0-77).

It works when I use Web service. coast <- reconstruct("coastlines", age=1)

Local reconstruction works when I choose "plates", or coordinates. coast <- reconstruct("plates", age=1, model = mo)

So, it might be an issue related to coastline reconstruction.

I would appreciate it if you could help me understand and solve the problem.

Best wishes, Masa

adamkocsis commented 3 years ago

Hi Masa,

Thanks for the feedback and for finding this issue. This is something we accidentally overlooked. This feature is not yet implemented and we forgot to defend reconstruct() against this input.

The problem of the local reconstruction of the present-day coastlines is that they are not directly incorporated in the models but are separate shapefiles that have to be downloaded additionally. I have the present-day coastline shape from C. Scotese, but have not yet tested them with the other reconstruction methods.

I will add these present-day coastlines as downloadable data entries and link them to the reconstruct("coastlines") function so this correctly expected argumentation should work. It might take some time though because I am very busy, but I will try to do it fast and will let you know when it is finished.

Best,

Adam

massaGitHub commented 3 years ago

Hi Adam,

Thanks. I understand the situation. Now I know you are so busy, but if you just add the downloadable present-day coastlines, I can link them to the reconstruction function.

Best, Masa

adamkocsis commented 3 years ago

Hi Masa,

Actually, the current reconstruct() version should work with any coastline object, as long as its class is SpatialLinesDataFrame. I am not sure about how GPlates handles the lines that do not fall on any of the partitioning polygons and whether it can accurately cut lines when only parts of them fall on the plates.

Anyway, I added a present-day coastlines object that I got from C. Scotese, so this method can be used with the PaleoMAP model:

library(chronosphere)

# Paleomap model
mod <- fetch("paleomap", "model")

# present-day coastlines and administrative boundaries
present <- fetch("paleomap", "adminlines")
recCoast <- reconstruct(present, model=mod, age=165)

# the plates
plates <- reconstruct("plates", model=mod, age=165)

# quick plots
plot(plates, col="gray", border=NA)
plot(recCoast, add=T)

I also discovered a couple of small bugs with the other models. I will fix these ASAP.

Thanks for the patience.

Cheers,

Adam