Plate Model Manager
Project description
plate-model-manager
Originally the plate-model-manager was designed for GPlately. Later, it was found also useful in other scenarios and contexts. The plate-model-manager downloads and manages the plate reconstruction model files. It is a dataset manager for plate tectonic reconstruction models, similar to NPM or Conda for software packages.
Have you ever wondered where to get the plate tectonic reconstruction models for your research? Are you tired of downloading files from Internet manually and specify file paths when calling PyGPlates functions? If the answer is yes, you probably want to check out this plate-model-manager Python module.
How to install
pip install plate-model-manager
How to use
Use PMM with pyGPlates 🌰
pm_manager = PlateModelManager()
model = pm_manager.get_model("Muller2019")
# create a point feature at (0,0)
point_feature = pygplates.Feature()
point_feature.set_geometry(pygplates.PointOnSphere(0, 0))
# assign plate ID
point_feature_with_PID = pygplates.partition_into_plates(
model.get_static_polygons(), # 👈👀 LOOK HERE
model.get_rotation_model(), # 👈👀 LOOK HERE
[point_feature])
# Reconstruct the point features.
reconstructed_feature_geometries = []
time=140
pygplates.reconstruct(
point_feature_with_PID,
model.get_rotation_model(), # 👈👀 LOOK HERE
reconstructed_feature_geometries,
time)
print(reconstructed_feature_geometries[0].get_reconstructed_geometry().to_lat_lon())
See the full example at https://github.com/GPlates/pygplates-tutorials/blob/master/notebooks/working-with-plate-model-manager.ipynb
Use PMM with GPlately 🌰
pm_manager = PlateModelManager()
model = pm_manager.get_model("Muller2019")
model.set_data_dir("plate-model-repo")
age = 55
test_model = PlateReconstruction(
model.get_rotation_model(), # 👈👀 LOOK HERE
topology_features=model.get_layer("Topologies"), # 👈👀 LOOK HERE
static_polygons=model.get_layer("StaticPolygons"), # 👈👀 LOOK HERE
)
gplot = PlotTopologies(
test_model,
coastlines=model.get_layer("Coastlines"), # 👈👀 LOOK HERE
COBs=model.get_layer("COBs"), # 👈👀 LOOK HERE
time=age,
)
See the full example at https://github.com/GPlates/gplately/blob/master/Notebooks/Examples/working-with-plate-model-manager.py
Use the command line
-
pmm ls
This command will list all available plate tectonic reconstruction models.
-
pmm ls Muller2019
This command will show the details of model 'Muller2019'.
-
pmm download Muller2019 plate-models-data-dir
This command will download model "Muller2019" into a folder 'plate-models-data-dir'.
-
pmm download all
This command will download all available models into the current working directory.
Use in Python script
👉 The Python code below prints all available model names.
# print all available model names
from plate_model_manager import PlateModelManager
pm_manager = PlateModelManager()
for name in pm_manager.get_available_model_names():
print(name)
👉 The Python code below downloads the "Muller2019" model into folder "plate-models-data-dir". The model.get_rotation_model() function returns the rotation file location.
from plate_model_manager import PlateModelManager
pm_manager = PlateModelManager()
model = pm_manager.get_model("Muller2019",data_dir="plate-models-data-dir")
print(model.get_rotation_model())
Examples
This Python module is mostly used in GPlately, GPlates Web Service, PyGPlates Tutorials and GPlates Python Proxy.
A good example of using PlateModelManager with PyGPlates can be found at https://github.com/GPlates/pygplates-tutorials/blob/master/notebooks/working-with-plate-model-manager.ipynb.
The examples of using PlateModelManager with GPlately:
- https://github.com/GPlates/gplately/blob/master/Notebooks/Examples/introducing-plate-model-manager.py
- https://github.com/GPlates/gplately/blob/master/Notebooks/Examples/working-with-plate-model-manager.py
The PlateModelManager can also be used with the GPlates desktop. Use the command line to download the plate model files and open the files with GPlates desktop. This will save the trouble of downloading files from Internet manually.
Dependencies
- aiohttp
- requests
- nest_asyncio
Event loop RuntimeError
For Jupyter Notebook, Web Server or GUI application users, you need the following two lines to workaround the event loop RuntimeError. If you do not add these two lines, the PlateModelManager still works. But you will see a warning message. You can ignore the warning message safely. If the warning message bothers you, add the two lines before calling PlateModelManager.
https://anaconda.org/conda-forge/nest-asyncio/
import nest_asyncio
nest_asyncio.apply()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file plate-model-manager-1.2.0.tar.gz
.
File metadata
- Download URL: plate-model-manager-1.2.0.tar.gz
- Upload date:
- Size: 32.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ba9ace814319ceacca10427c0c9ef3124b80eb6fb103a631ab0246d4adb5407 |
|
MD5 | 9e8238f6a9a8ef11991568fa7f81c04f |
|
BLAKE2b-256 | a8984aa22bdb771151e14e8de566b4ee5e793474a231aaa2b9ad385508c25ab9 |
File details
Details for the file plate_model_manager-1.2.0-py3-none-any.whl
.
File metadata
- Download URL: plate_model_manager-1.2.0-py3-none-any.whl
- Upload date:
- Size: 35.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7b4da8bbc94c1b43f886e554b6b55f71419f032aa7c965dde0383b7589921a3 |
|
MD5 | 191a557c9c87f03be2044bbe9f963bc9 |
|
BLAKE2b-256 | 04e5341162ea0b080dfde598a5b2eccc148b644573b785707b35795206facdc4 |