gplately.PlateModelο
- class gplately.PlateModel(model_name: str, model_cfg=None, data_dir: str = '.', readonly=False, timeout=(None, None))[source]ο
Bases:
objectDownload and manage files required for a plate reconstruction model.
ππ LOOK HERE!!! ππ
Normally you should always use
PlateModelManager.get_model()to get aPlateModelobject. Create aPlateModelobject directly only when you donβt have Internet connection and would like to use the local model files inreadonlymode. Do not create aPlateModelobject directly if you have no idea whatβs going on.- __init__(model_name: str, model_cfg=None, data_dir: str = '.', readonly=False, timeout=(None, None))[source]ο
Constructor. Create a
PlateModelinstance.- Parameters:
model_name (str) β The model name of interest.
model_cfg β The model configuration in JSON format. The configuration is either downloaded from the server or loaded from a local file
.metadata.json. If you are confused by this parameter, usePlateModelManager.get_model()to get aPlateModelobject instead.data_dir (str, default=".") β The folder path to save the model data.
readonly (bool, default=False) β If this flag is set to
True, ThePlateModelobject will use the files in the local folder and will not attempt to download/update the files from the server.timeout β Network connection timeout parameter.
Methods
__init__(model_name[,Β model_cfg,Β data_dir,Β ...])Constructor.
Create a folder with a file
.metadata.jsonin it to keep the model files.Download everything in this plate model.
Download all layers.
download_time_dependent_rasters(raster_name)Download time-dependent rasters for a given raster name.
get_COBs([return_none_if_not_exist])Return a list of
Continent-Ocean Boundariesfiles.Get all available layers in this plate model.
Return all time-dependent raster names in this plate model.
The max (big number in Ma) reconstruction time in the model.
get_cfg()Return the model configuration.
get_coastlines([return_none_if_not_exist])Return a list of
coastlinesfiles.get_continental_polygons([...])Return a list of
continental polygonsfiles.Return the path to a folder (parent folder of the
model dir) containing a set of downloaded models.get_layer(layer_name[,Β return_none_if_not_exist])Get a list of layer files by a layer name.
Return the path to a folder containing the model files.
get_raster(raster_name,Β time)Return a local path for the raster file.
get_rasters(raster_name,Β times)Return local paths for the raster files.
Return a list of rotation files.
The min (small number in Ma) reconstruction time in the model.
get_static_polygons([return_none_if_not_exist])Return a list of
static polygonsfiles.get_topologies([return_none_if_not_exist])Return a list of
topologiesfiles.is_model_dir(folder_path)Return
Trueif the folder contains files of a plate model, otherwiseFalse.purge()Remove the model folder and everything inside the folder.
purge_layer(layer_name)Remove the layer folder of the given layer name.
purge_time_dependent_rasters(raster_name)Remove the raster folder of the given raster name.
set_data_dir(new_dir)Change the folder (parent folder of the
model dir) in which you would like to save your model.Attributes
The model metadata.
- create_model_dir()[source]ο
Create a folder with a file
.metadata.jsonin it to keep the model files.
- download_all_layers()[source]ο
Download all layers. This function calls
download_layer_files()on every available layer.
- download_time_dependent_rasters(raster_name, times=None)[source]ο
Download time-dependent rasters for a given raster name.
Call
get_avail_time_dependent_raster_names()to see all the available raster names in this model.- Parameters:
raster_name β the raster name of interest
times β if not given, download from begin to end with 1My interval
- get_COBs(return_none_if_not_exist: bool = False) List[str] | None[source]ο
Return a list of
Continent-Ocean Boundariesfiles.
- get_avail_time_dependent_raster_names()[source]ο
Return all time-dependent raster names in this plate model.
- get_coastlines(return_none_if_not_exist: bool = False) List[str] | None[source]ο
Return a list of
coastlinesfiles.
- get_continental_polygons(return_none_if_not_exist: bool = False) List[str] | None[source]ο
Return a list of
continental polygonsfiles.
- get_data_dir()[source]ο
Return the path to a folder (parent folder of the
model dir) containing a set of downloaded models.
- get_layer(layer_name: str, return_none_if_not_exist: bool = False) List[str] | None[source]ο
Get a list of layer files by a layer name. Call
get_avail_layers()to get all the available layer names.Raise
LayerNotFoundInModelexception to get userβs attention by default. Setreturn_none_if_not_existtoTrueif you donβt want to see theLayerNotFoundInModelexception.- Parameters:
layer_name β The layer name of interest.
return_none_if_not_exist β If set to
True, returnNonewhen the layer does not exist in the model.
- Returns:
A list of file names or
Noneifreturn_none_if_not_existis set toTrue.
:raises
LayerNotFoundInModel: Raise this exception if the layer name does not exist in this model.
- get_raster(raster_name: str, time: int | float) str[source]ο
Return a local path for the raster file.
- get_rasters(raster_name: str, times: List[int | float]) List[str][source]ο
Return local paths for the raster files.
- Parameters:
times β A list of times
- Returns:
A list of local paths
- get_static_polygons(return_none_if_not_exist: bool = False) List[str] | None[source]ο
Return a list of
static polygonsfiles.
- get_topologies(return_none_if_not_exist: bool = False) List[str] | None[source]ο
Return a list of
topologiesfiles.
- static is_model_dir(folder_path: str)[source]ο
Return
Trueif the folder contains files of a plate model, otherwiseFalse.