-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
finish the unfinished code yesterday
- Loading branch information
1 parent
2d27fcf
commit 0bbcd21
Showing
6 changed files
with
62 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
from typing import Union | ||
|
||
from plate_model_manager import PlateModel, PlateModelManager | ||
|
||
from .mapping.plot_engine import PlotEngine | ||
from .plot import PlotTopologies | ||
from .reconstruction import PlateReconstruction | ||
|
||
|
||
def get_gplot( | ||
model_name: str, | ||
model_repo_dir: str, | ||
age: Union[int, float], | ||
plot_engine: PlotEngine = PlotEngine.CARTOPY, | ||
) -> PlotTopologies: | ||
"""auxiliary function to get gplot object""" | ||
try: | ||
model = PlateModelManager().get_model(model_name, data_dir=model_repo_dir) | ||
except: | ||
model = PlateModel(model_name, data_dir=model_repo_dir, readonly=True) | ||
|
||
if model is None: | ||
raise Exception(f"Unable to get model ({model_name})") | ||
|
||
topology_features = None | ||
static_polygons = None | ||
coastlines = None | ||
COBs = None | ||
continents = None | ||
|
||
all_layers = model.get_avail_layers() | ||
|
||
if "Topologies" in all_layers: | ||
topology_features = model.get_layer("Topologies") | ||
if "StaticPolygons" in all_layers: | ||
static_polygons = model.get_layer("StaticPolygons") | ||
if "Coastlines" in all_layers: | ||
coastlines = model.get_layer("Coastlines") | ||
if "COBs" in all_layers: | ||
COBs = model.get_layer("COBs") | ||
if "ContinentalPolygons" in all_layers: | ||
continents = model.get_layer("ContinentalPolygons") | ||
|
||
m = PlateReconstruction( | ||
model.get_rotation_model(), | ||
topology_features=topology_features, | ||
static_polygons=static_polygons, | ||
) | ||
return PlotTopologies( | ||
m, | ||
coastlines=coastlines, | ||
COBs=COBs, | ||
continents=continents, | ||
time=age, | ||
plot_engine=plot_engine, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters