Skip to contents

R code requirements

This section describes what the hard and soft dependencies of rgplates are and what they are used for.

Depends

  • sf (Simple features): rgplates depends on the sf package to handle vector spatial data, such as plates, present-day coastlines, and spatial data that have explict Coordinate Reference System information.

Imports

Functions reused from other packages (necessary in all cases):

Suggests

Functions from some packages that are used by some functions only (optional):

  • knitr and rmarkdown: used for vignette creation.
  • geojsonsf: used by the online method of reconstruct() to read in the spatial output of the GWS.
  • httr2: used by the online method of reconstruct() to perform requests with HTTP POST
  • terra: optional input and output classes for raster spatial data.
  • sp: optional output formats for vector spatial data.
  • chronosphere: informal suggestion in help files for downloading platemodel instances.

Function call graph

flowchart LR

  classDef extern fill:#CCC
  classDef ui fill:#f96

  reconstruct-matrix-method-->gwsReconstructPoints
  reconstruct-matrix-method-->reconstructGPlates
  reconstruct-matrix-method-->CheckGWS
  reconstruct-sf-method-->reconstructGPlates
  reconstruct-character-method-->gplates_reconstruct_this
  reconstruct-character-method-->reconstructGPlates
  reconstruct-character-method-->CheckGWS
  reconstruct-Spatial-method-->reconstructGPlates
  reconstruct-sf-method-->reconstructGPlates
  velocities-character-method-->gwsVelocitiesThis
  velocities-character-method-->SpatRastFromDF
  velocities-character-method-->veloDefend
  velocities-character-method-->ext
  velocities-character-method-->crop
  reconstruct-SpatRaster-method-->values
  reconstruct-SpatRaster-method-->CheckGWS
  reconstruct-SpatRaster-method-->ncell
  reconstruct-SpatRaster-method-->xyFromCell
  reconstruct-SpatRaster-method-->extract

  subgraph front_end.R

  reconstruct:::ui-->reconstruct-matrix-method
  click reconstruct "../reference/reconstruct.html"
  reconstruct-->reconstruct-data.frame-method
  reconstruct-->reconstruct-numeric-method
  reconstruct-->reconstruct-character-method
  reconstruct-->reconstruct-Spatial-method
  reconstruct-->reconstruct-sf-method
  reconstruct-data.frame-method-->reconstruct-matrix-method
  reconstruct-numeric-method-->reconstruct-matrix-method
  velocities:::ui-->velocities-character-method
  velocities:::ui-->velocities-missing-method
  click velocities "../reference/velocities.html"
  velocities-missing-method-->velocities-character-method
  reconstruct-->reconstruct-SpatRaster-method
  reconstruct-SpatRaster-method-->reconstruct-matrix-method

  end


  reconstructGPlates-->getOS
  reconstructGPlates-->st_as_sf
  reconstructGPlates-->st_transform
  reconstructGPlates-->st_crs
  reconstructGPlates-->randomString
  reconstructGPlates-->st_write
  reconstructGPlates-->st_read
  reconstructGPlates-->st_as_Spatial
  reconstructGPlates-->st_coordinates
  reconstructGPlates-->fileFromPath

  subgraph offline.R

  reconstructGPlates-->testGPlates
  reconstructGPlates-->winDefaultGPlates
  reconstructGPlates-->macDefaultGPlates
  
  end

  gplates_reconstruct_this-->geojson_sf
  gwsReconstructPoints-->checkSuggested
  gwsReconstructPoints-->request
  gwsReconstructPoints-->req_body_from
  gwsReconstructPoints-->req_perform
  gwsReconstructPoints-->resp_body_string
  gwsReconstructPoints-->geojson_sf
  gwsReconstructPoints-->st_coordinates
    gwsVelocitiesThis-->ParseVeloJSON
    gwsVelocitiesThis-->CheckGWS

  subgraph online.R

  gplates_reconstruct_this
  gwsReconstructPoints
  CheckGWS
    getgws:::ui
  click getgws "../reference/gwstools.html"
    setgws:::ui
  click setgws "../reference/gwstools.html"
    setgws-->getgws
    setgws-->checkgws
    checkgws:::ui
  click checkgws "../reference/gwstools.html"
    gwsVelocitiesThis
    
  
  end
  
  mapedge:::ui-->SpatialPolygons
  click mapedge "../reference/mapedge.html"
  mapedge-->Polygons
  mapedge-->CRS
  mapedge-->st_geometry
  mapedge-->st_polygon

  subgraph utility.R

  mapedge
  getOS
  fileFromPath
  randomString
  mapedge-->detailedBounds
  checkSuggested
  ParseVeloJSON-->ParseNumpyArrayString
  SpatRastFromDF
    veloDefend
  
  end

  platemodel-show-->fileFromPath

  subgraph platemodel.R
  platemodel-classdef
  platemodel-initialize:::ui
  click platemodel-initialize "../reference/platemodel.html"
  platemodel-show
  end

  subgraph EXT[EXTERNALS]
    subgraph sf

    st_as_sf:::extern
    st_transform:::extern
    st_crs:::extern
    st_write:::extern
    st_read:::extern
    st_as_Spatial:::extern
    st_coordinates:::extern
    st_geometry:::extern
    st_polygon:::extern

    end

    subgraph terra
    ncell:::extern
    xyFromCell:::extern         
    extract:::extern            
    values:::extern             
    ext:::extern            
    crop:::extern           
    end

    subgraph sp
    CRS:::extern
    Polygons:::extern
    SpatialPolygons:::extern
    end

    subgraph geojsonsf
    geojson_sf:::extern
    end

    subgraph httr2 
    request:::extern
    req_body_from:::extern
    req_perform:::extern
    resp_body_string:::extern
    end
  end
  
  style EXT fill:#eee,border:#bbb