Skip to content

Latest commit

 

History

History
30 lines (22 loc) · 1.18 KB

use-in-python.mdx

File metadata and controls

30 lines (22 loc) · 1.18 KB
title metaTitle metaDescription
Use GWS In Python
Use GWS In Python
Demonstrate how to use GWS in Python programming language.

If you are using Python, check out our GPlates Web Service Python proxy at https://github.com/michaelchin/gplates-python-proxy#readme.

The following code reconstructs three locations back to 100Ma using "Muller2019" model. You need to pip install gplates-ws-proxy before running the code.

  # pip install gplates-ws-proxy
  import shapely
  from gplates_ws_proxy import PlateModel, reconstruct_shapely_points

  lats = [50, 10, 50]
  lons = [-100, 160, 100]
  points = [shapely.Point(x, y) for x, y in zip(lons, lats)]

  model = PlateModel("Muller2019")
  paleo_points = reconstruct_shapely_points(model, points, 100)
  print(paleo_points)

Here is another example. The subduction zones and coastlines in the image below was plotted by plot_subduction_zones.py.

plot_subduction_zones.png

Check out more Python examples at https://github.com/michaelchin/gplates-python-proxy/tree/main/examples#readme.