Skip to main content

Object-orientated Python interface to pyGPlates for plate tectonic reconstruction

Project description

GPlately logo.

GitHub Workflow Status (with branch) PyPI Conda (channel only)

GPlately was created to accelerate spatio-temporal data analysis leveraging pyGPlates and PlateTectonicTools within a simplified Python interface. This object-oriented package enables the reconstruction of data through deep geologic time (points, lines, polygons, and rasters), the interrogation of plate kinematic information (plate velocities, rates of subduction and seafloor spreading), the rapid comparison between multiple plate motion models, and the plotting of reconstructed output data on maps. All tools are designed to be parallel-safe to accelerate spatio-temporal analysis over multiple CPU processors.

SeedPointGIF

GPlately requires a working installation of pyGPlates, which is freely available at https://www.gplates.org/download. All major system architectures (e.g. Linux, MacOS, Windows) are supported and installation instructions are well documented. Sample data is also available from EarthByte servers, which includes rasters, seafloor age grids, rotation files, and more to get started with plate reconstructions.

Citation

Mather, B.R., Müller, R.D., Zahirovic, S., Cannon, J., Chin, M., Ilano, L., Wright, N.M., Alfonso, C., Williams, S., Tetley, M., Merdith, A. (2023) Deep time spatio-temporal data analysis using pyGPlates with PlateTectonicTools and GPlately. Geoscience Data Journal, 1–8. Available from: https://doi.org/10.1002/gdj3.185

@article{Mather2023,
author = {Mather, Ben R. and Müller, R. Dietmar and Zahirovic, Sabin and Cannon, John and Chin, Michael and Ilano, Lauren and Wright, Nicky M. and Alfonso, Christopher and Williams, Simon and Tetley, Michael and Merdith, Andrew},
title = {Deep time spatio-temporal data analysis using pyGPlates with PlateTectonicTools and GPlately},
year = {2023},
journal = {Geoscience Data Journal},
pages = {1-8},
keywords = {geospatial, plate reconstructions, pyGPlates, python, tectonics},
doi = {https://doi.org/10.1002/gdj3.185},
url = {https://rmets.onlinelibrary.wiley.com/doi/abs/10.1002/gdj3.185},
eprint = {https://rmets.onlinelibrary.wiley.com/doi/pdf/10.1002/gdj3.185},
}

Dependencies

Installation

1. Using conda (recommended)

You can install the latest stable public release of GPlately and all of its dependencies using conda. This is the preferred method to install GPlately which downloads binaries from the conda-forge channel.

conda install -c conda-forge gplately

Creating a new conda environment

We recommend creating a new conda environment inside which to install GPlately. This avoids any potential conflicts in your base Python environment. In the example below we create a new environment called "my-env":

conda create -n my-env
conda activate my-env
conda install -c conda-forge gplately

my-env needs to be activated whenever you use GPlately: i.e. conda activate my-env.

2. Using pip

Alternatively, you can install the latest stable public release of GPlately using the pip package manager.

pip install gplately

or from this GitHub repository:

pip install git+https://github.com/GPlates/gplately.git 

Pull from repository

First-time installation: To install the latest version of GPlately from a specific repository branch (e.g. master), copy the following commands into your terminal:

cd /path/to/desired/directory #Change your command directory to where you'd like to clone GPlately
git clone https://github.com/GPlates/gplately.git
cd gplately # navigate within the gplately folder
git checkout master # or the name of whichever branch you need
git pull # fetch all recent changes from this branch
pip install .

Update installation from cloned repo: To update your installation of GPlately by fetching the latest pushes from a specific repository branch (e.g. master), copy the following commands into your terminal:

cd /path/to/gplately/directory #Should be where gplately is cloned - must end in /.../gplately
git checkout master # or the name of whichever branch you need
git pull # fetch all recent changes from this branch
pip install .

Usage

GPlately uses objects to accomplish a variety of common tasks. The common objects include:

  • DataServer - download rotation files and topology features from plate models on EarthByte's webDAV server
  • PlateReconstruction - reconstruct features, tesselate mid ocean ridges, subduction zones
  • Points - partition points onto plates, rotate back through time
  • Raster - read in NetCDF grids, interpolation, resampling
  • PlotTopologies - one stop shop for plotting ridges, trenches, subduction teeth

The DataServer object

GPlately's DataServer object can be used to download:

  • rotation models
  • topology features
  • static polygons
  • coastlines
  • continents
  • continent-ocean boundaries
  • age grids and rasters
  • geological feature data

from assorted plate reconstruction models. These files are needed to construct most of GPlately's objects. For example, we can download a rotation model, a set of topology features and some static polygons from the Müller et al. 2019 global Mesozoic–Cenozoic deforming plate motion model.

gDownload = gplately.DataServer("Muller2019")
rotation_model, topology_features, static_polygons = gDownload.get_plate_reconstruction_files()

The PlateModelManager object

... was designed as a substitute of DataServer object. The PlateModelManager downloads and manages the plate reconstruction model files.

  pm_manager = PlateModelManager()
  model = pm_manager.get_model("Muller2019")
  model.set_data_dir("plate-model-repo")

  recon_model = PlateReconstruction(
      model.get_rotation_model(),
      topology_features=model.get_layer("Topologies"),
      static_polygons=model.get_layer("StaticPolygons"),
  )
  gplot = PlotTopologies(
      recon_model,
      coastlines=model.get_layer("Coastlines"),
      COBs=model.get_layer("COBs"),
      time=55,
  )

The PlateReconstruction object

... contains methods to reconstruct the positions of present-day feature data back through geological time. You can also use it to calculate plate model data like topological plate velocities, or total trench and ridge lengths per Ma! You can create the object by passing a rotation model, a set of topology features and some static polygons:

model = gplately.PlateReconstruction(rotation_model, topology_features, static_polygons)

Launch the Plate Reconstruction notebook to see more.

The Points object

... can be used to reconstruct the positions of geological point features and calculate their underlying plate velocities through geological time.

pt_lon = np.array([-107.662152, -58.082792, 17.483189, 133.674590, 80.412876])
pt_lat = np.array([48.797807, -12.654857, 11.884395, -26.415630, 31.368509])

# Call the Points object: pass the PlateReconstruction object, and the latitudes and longitudes of the seed points!
gpts = gplately.Points(model, pt_lon, pt_lat)

PointData

The Raster object

...can be used to read, resample and resize assorted raster data like netCDF4 seafloor age grids, continental grids and ETOPO relief rasters. You can also reconstruct raster data back through geological time!

etopo = gdownload.get_raster("ETOPO1_tif")

raster = gplately.Raster(
    model,
    data=etopo,
    time=0,
    origin="upper",
)
white_rgb = (255, 255, 255)  # RGB code for white, to fill gaps in output

reconstructed = raster.reconstruct(
    time=50,
    fill_value=white_rgb,
    threads=4,
)

Below is a plot of the ETOPO1 global relief raster at present day, and reconstructed to 50Ma:

RasterImg

The PlotTopologies object

... can be used to visualise reconstructed feature geometries through time. To call the object, pass a set of continents, coastlines and COBs (either as file paths or as <pyGPlates.FeatureCollection> objects), as well as a PlateReconstruction object, and a reconstruction time.

coastlines, continents, COBs = gDownload.get_topology_geometries()
time = 50 #Ma
gPlot = gplately.plot.PlotTopologies(model, time, coastlines, continents, COBs)

Below are some continents, coastlines, COBs, ridges and transforms, trenches, subduction teeth and seafloor age grids plotted using PlotTopologies!

ReconstructionImage

Sample workflows

To see GPlately in action, launch a Jupyter Notebook environment and check out the sample notebooks:

  • 01 - Getting Started: A brief overview of how to initialise GPlately's main objects
  • 02 - Plate Reconstructions: Setting up a PlateReconstruction object, reconstructing geological data through time
  • 03 - Working with Points: Setting up a Points object, reconstructing seed point locations through time with. This notebook uses point data from the Paleobiology Database (PBDB).
  • 04 - Velocity Basics: Calculating plate velocities, plotting velocity vector fields
  • 05 - Working with Feature Geometries: Processing and plotting assorted polyline, polygon and point data from GPlates 2.3's sample data sets
  • 06 - Rasters: Reading, resizing, resampling raster data, and linearly interpolating point data onto raster data
  • 07 - Plate Tectonic Stats: Using PlateTectonicTools to calculate and plot subduction zone and ridge data (convergence/spreading velocities, subduction angles, subduction zone and ridge lengths, crustal surface areas produced and subducted etc.)
  • 08 - Predicting Slab Flux: Predicting the average slab dip angle of subducting oceanic lithosphere.
  • 09 - Motion Paths and Flowlines: Using pyGPlates to create motion paths and flowines of points on a tectonic plate to illustrate the plate's trajectory through geological time.
  • 10 - SeafloorGrid: Defines the parameters needed to set up a SeafloorGrid object, and demonstrates how to produce age and spreading rate grids from a set of plate reconstruction model files.

API Documentation

Documentation of GPlately's objects and methods can be found here!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gplately-1.2.7.tar.gz (28.8 MB view hashes)

Uploaded Source

Built Distribution

gplately-1.2.7-py3-none-any.whl (28.8 MB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page