This notebook demonstrate how to use the PlateModelManager to access plate model files.¶

In [1]:
import os, warnings
from pathlib import Path
import cartopy.crs as ccrs
import matplotlib.pyplot as plt
from plate_model_manager import PlateModelManager, PresentDayRasterManager
from gplately import PlateReconstruction, PlotTopologies
from gplately.commands.list_models import get_model_names

warnings.filterwarnings("ignore", category=UserWarning, module="gplately")

pm_manager = PlateModelManager()

Get the names of all available models in the PlateModelManager¶

In [2]:
gplately_model_names = get_model_names()
for name in pm_manager.get_available_model_names():
    # the pm_manager.get_available_model_names() returns a superset of GPlately models.
    # we need to check the the model name agaist a list of GPlately officially supported models.
    # https://gplates.github.io/gplately/latest/sphinx/html/plate_models.html
    if name in gplately_model_names:
        print(name)
shirmard2025
alfonso2024
cao2024
muller2022
zahirovic2022
merdith2021
clennett2020
clennett2020_m2019
clennett2020_s2013
muller2019
young2018
torsvikcocks2017
matthews2016
matthews2016_pmag_ref
muller2016
scotese2016
zahirovic2016
gibbons2015
zahirovic2014
shephard2013
gurnis2012
seton2012
muller2008

Download model "Muller2019" and put the files in folder "plate-model-repo"¶

In [3]:
model = pm_manager.get_model("Muller2019")
assert model
model.set_data_dir("plate-model-repo")
for layer in model.get_avail_layers():
    model.get_layer(layer)

# now let's see what are inside the "plate-model-repo/muller2019" folder
print(os.listdir("plate-model-repo/muller2019"))
['Johansson2018LIPs', 'ContinentalPolygons', 'SeafloorFabric', '.metadata.json', 'Whittaker2015LIPs', 'COBs', 'StaticPolygons', 'Coastlines', 'readme.txt', 'Hotspots', 'Topologies']

List all vailable layers in model Muller2019¶

In [4]:
for layer in model.get_avail_layers():
    print(layer)
Coastlines
StaticPolygons
ContinentalPolygons
Topologies
COBs
Hotspots
SeafloorFabric
Whittaker2015LIPs
Johansson2018LIPs

Download rotation files¶

In [5]:
rotation_files = model.get_rotation_model()
print(rotation_files)
['plate-model-repo/muller2019/Rotations/Muller_etal_2019_CombinedRotations.rot']

Download static polygons¶

In [6]:
static_polygon_files = model.get_layer("StaticPolygons")
print(static_polygon_files)
['plate-model-repo/muller2019/StaticPolygons/Muller_etal_2019_Global_StaticPlatePolygons.gpmlz']

Download Coastlines¶

In [7]:
coasts_files = model.get_layer("Coastlines")
print(coasts_files)
['plate-model-repo/muller2019/Coastlines/Muller_etal_2019_Global_Coastlines.gpmlz']

Download all layers¶

In [8]:
for layer in model.get_avail_layers():
    print(model.get_layer(layer))
['plate-model-repo/muller2019/Coastlines/Muller_etal_2019_Global_Coastlines.gpmlz']
['plate-model-repo/muller2019/StaticPolygons/Muller_etal_2019_Global_StaticPlatePolygons.gpmlz']
['plate-model-repo/muller2019/ContinentalPolygons/Global_PresentDay_ContPolygons_2019_v1.shp']
['plate-model-repo/muller2019/Topologies/Muller_etal_2019_PlateBoundaries_DeformingNetworks.gpmlz']
['plate-model-repo/muller2019/COBs/Global_COBLineSegments_2019_v1.gpmlz']
['plate-model-repo/muller2019/Hotspots/Hotspots_Compilation_Whittaker_etal.gpmlz']
['plate-model-repo/muller2019/SeafloorFabric/FZ_cookiecut.gpmlz', 'plate-model-repo/muller2019/SeafloorFabric/FZLC_cookiecut.gpmlz', 'plate-model-repo/muller2019/SeafloorFabric/UNCV_cookiecut.gpmlz', 'plate-model-repo/muller2019/SeafloorFabric/DZ_cookiecut.gpmlz', 'plate-model-repo/muller2019/SeafloorFabric/VANOM_cookiecut.gpmlz', 'plate-model-repo/muller2019/SeafloorFabric/ExtinctRidges_cookiecut.gpmlz']
['plate-model-repo/muller2019/Whittaker2015LIPs/Whittaker_etal_2015_LIPs.gpmlz']
['plate-model-repo/muller2019/Johansson2018LIPs/Johansson_etal_2018_VolcanicProvinces_v2.gpmlz']

Get a list of time dependent rasters¶

In [9]:
for raster in model.get_avail_time_dependent_raster_names():
    print(raster)
AgeGrids
SedimentThickness

Download AgeGrids rasters¶

In [10]:
import warnings

warnings.filterwarnings("ignore")
print(model.get_rasters("AgeGrids", times=[10, 20, 30]))
print(model.get_raster("AgeGrids", time=100))
['plate-model-repo/muller2019/Rasters/AgeGrids/Muller_etal_2019_Tectonics_v2.0_AgeGrid-10.nc', 'plate-model-repo/muller2019/Rasters/AgeGrids/Muller_etal_2019_Tectonics_v2.0_AgeGrid-20.nc', 'plate-model-repo/muller2019/Rasters/AgeGrids/Muller_etal_2019_Tectonics_v2.0_AgeGrid-30.nc']
plate-model-repo/muller2019/Rasters/AgeGrids/Muller_etal_2019_Tectonics_v2.0_AgeGrid-100.nc

Download AgeGrids rasters for all available times¶

This function will take a while to finish and download a large volume data. Uncomment the code in the code cell below to try it.

In [11]:
# model.download_time_dependent_rasters("AgeGrids")

List the names of all present-day rasters¶

In [12]:
print(PresentDayRasterManager().list_present_day_rasters())
['etopo1_grd', 'etopo1_tif', 'topography', 'agegrid', 'vgg']

Get "topography" present-day raster¶

In [13]:
print(PresentDayRasterManager().get_raster("topography"))
present-day-rasters/topography/topo15-3601x1801.nc
In [14]:
# use `PlateModelManager` to create `PlateReconstruction` and `PlotTopologies` objects
model = PlateModelManager().get_model("Zahirovic2022")
model.set_data_dir("plate-model-repo")  # type: ignore

age = 55
test_model = PlateReconstruction(
    model.get_rotation_model(),  # type: ignore
    topology_features=model.get_layer("Topologies"),  # type: ignore
    static_polygons=model.get_layer("StaticPolygons"),  # type: ignore
)
gplot = PlotTopologies(
    test_model,
    coastlines=model.get_layer("Coastlines"),  # type: ignore
    COBs=model.get_layer("COBs"),  # type: ignore
    time=age,
)

fig = plt.figure(figsize=(12, 6), dpi=72)
ax = fig.add_subplot(111, projection=ccrs.Robinson(central_longitude=180))
ax.set_global()  # type: ignore

# now use PlotTopologies object to plot some model data
gplot.plot_continent_ocean_boundaries(ax, color="cornflowerblue")
gplot.plot_coastlines(ax, color="black")
gplot.plot_all_topological_sections(
    ax,
    plot_subduction_teeth=True,
    other_kwargs={
        "color": "grey",
        "linewidth": 0.5,
    },
    ridge_kwargs={
        "color": "black",
        "linewidth": 0.7,
    },
    transform_kwargs={
        "color": "green",
        "linewidth": 0.7,
    },
    trench_kwargs={
        "color": "blue",
        "linewidth": 0.7,
    },
)

plt.title(f"{age} Ma")

# save the map as a .png file
data_dir = Path("./gplately-example-data")
data_dir.mkdir(parents=True, exist_ok=True)
output_file = data_dir / "02-PlateModelManager.png"
fig.savefig(output_file, dpi=120, bbox_inches="tight")  # transparent=True)
print(f"Done! The output file {output_file} has been saved.")

plt.show()
plt.close(fig)
Done! The output file gplately-example-data/02-PlateModelManager.png has been saved.
No description has been provided for this image