Source code for plato.slabs

-import logging
+# Standard libraries
+import logging
 from typing import Dict, List, Optional, Union
 
+# Third party libraries
 import geopandas as _geopandas
 import gplately as _gplately
 import numpy as _numpy
@@ -263,6 +265,7 @@ 

Source code for plato.slabs

 import xarray as _xarray
 from tqdm import tqdm as _tqdm
 
+# Local libraries
 from . import utils_data, utils_calc, utils_init
 from .settings import Settings
 
@@ -310,20 +313,21 @@ 

Source code for plato.slabs

     """
     def __init__(
             self,
-            settings = None,
-            reconstruction = None,
-            rotation_file = None,
-            topology_file = None,
-            polygon_file = None,
-            reconstruction_name = None,
-            ages = None,
-            cases_file = None,
-            cases_sheet = "Sheet1",
-            files_dir = None,
-            resolved_geometries = None,
-            PARALLEL_MODE = False,
-            DEBUG_MODE = False,
-            CALCULATE_VELOCITIES = True,
+            settings: Optional[Settings] = None,
+            reconstruction: Optional[_gplately.PlateReconstruction] = None,
+            rotation_file: Optional[str] = None,
+            topology_file: Optional[str] = None,
+            polygon_file: Optional[str] = None,
+            reconstruction_name: Optional[str] = None,
+            ages: Optional[Union[int, float, List[Union[int, float]], _numpy.ndarray]] = None,
+            cases_file: Optional[str] = None,
+            cases_sheet: str = "Sheet1",
+            files_dir: Optional[str] = None,
+            resolved_geometries: Dict[float, Dict[str, _geopandas.GeoDataFrame]] = None,
+            PARALLEL_MODE: bool = False,
+            DEBUG_MODE: bool = False,
+            CALCULATE_VELOCITIES: bool = True,
+            PROGRESS_BAR: bool = True,
         ):
         """
         Constructor for the `Slabs` class.
@@ -358,7 +362,11 @@ 

Source code for plato.slabs

         self.data = {age: {} for age in self.settings.ages}
 
         # Loop through times
-        for _age in _tqdm(self.settings.ages, desc="Loading slab data", disable=self.settings.logger.level == logging.INFO):
+        for _age in _tqdm(
+                self.settings.ages, 
+                desc="Loading slab data", 
+                disable=(self.settings.logger.level in [logging.INFO, logging.DEBUG] or not PROGRESS_BAR)
+            ):
             # Load available data
             for key, entries in self.settings.slab_cases.items():
                 # Make list to store available cases
@@ -380,7 +388,7 @@ 

Source code for plato.slabs

                 # Check if any DataFrames were loaded
                 if len(available_cases) > 0:
                     # Copy all DataFrames from the available case        
-                    for entries in entry:
+                    for entry in entries:
                         if entry not in available_cases:
                             self.data[_age][entry] = self.data[_age][available_cases[0]].copy()
                 else:
@@ -405,7 +413,7 @@ 

Source code for plato.slabs

 
         # Calculate velocities along slabs
         if CALCULATE_VELOCITIES:
-            self.calculate_velocities()
+            self.calculate_velocities(PROGRESS_BAR = PROGRESS_BAR)
 
         # Calculate total slab length as a function of age and case
         self.total_slab_length = _numpy.zeros((len(self.settings.ages), len(self.settings.slab_pull_cases)))
@@ -427,9 +435,11 @@ 

Source code for plato.slabs

 [docs]
     def calculate_velocities(
             self,
-            ages = None,
-            cases = None,
-            stage_rotation = None,
+            ages: Optional[Union[int, float, List[Union[int, float]], _numpy.ndarray]] = None,
+            cases: Optional[Union[str, List[str]]] = None,
+            plateIDs: Optional[Union[int, float, List[Union[int, float]], _numpy.ndarray]] = None,
+            stage_rotation: Dict[float, Dict[str, _pandas.DataFrame]] = None,
+            PROGRESS_BAR: bool = True,
         ):
         """
         Function to compute velocities at slabs.
@@ -440,6 +450,8 @@ 

Source code for plato.slabs

         :type cases:            str, list
         :param stage_rotation:  stage rotation model (default: None)
         :type stage_rotation:   dict
+
+        TODO: Implement selection of entries by plateID
         """
         # Define ages if not provided
         _ages = utils_data.select_ages(ages, self.settings.ages)
@@ -448,10 +460,14 @@ 

Source code for plato.slabs

         _cases = utils_data.select_cases(cases, self.settings.cases)
 
         # Loop through ages and cases
-        for _age in _ages:
-            for plate in ["upper_plate", "lower_plate", "trench"]:
-                plateID_col = f"{plate}ID" if plate != "trench" else "trench_plateID"
-                for _case in _cases:
+        for _age in _tqdm(
+            _ages,
+            desc="Calculating velocities at slabs",
+            disable=(self.settings.logger.level in [logging.INFO, logging.DEBUG] or not PROGRESS_BAR)
+        ):
+            for _case in _cases:
+                for plate in ["upper_plate", "lower_plate", "trench"]:
+                    plateID_col = f"{plate}ID" if plate != "trench" else "trench_plateID"
                     for plateID in self.data[_age][_case][plateID_col].unique():
                         if (
                             isinstance(stage_rotation, Dict)
@@ -494,17 +510,23 @@ 

Source code for plato.slabs

                         self.data[_age][_case].loc[mask, f"{plate}_velocity_lat"] = velocities[0]
                         self.data[_age][_case].loc[mask, f"{plate}_velocity_lon"] = velocities[1]
                         self.data[_age][_case].loc[mask, f"{plate}_velocity_mag"] = velocities[2]
-                        self.data[_age][_case].loc[mask, f"{plate}_spin_rate_mag"] = velocities[4]
+ self.data[_age][_case].loc[mask, f"{plate}_spin_rate_mag"] = velocities[4] + + # Get convergence rates + self.data[_age][_case].loc[:, f"convergence_velocity_lat"] = self.data[_age][_case]["lower_plate_velocity_lat"] - self.data[_age][_case]["trench_velocity_lat"] + self.data[_age][_case].loc[:, f"convergence_velocity_lon"] = self.data[_age][_case]["lower_plate_velocity_lon"] - self.data[_age][_case]["trench_velocity_lon"] + self.data[_age][_case].loc[:, f"convergence_velocity_mag"] = _numpy.sqrt(self.data[_age][_case]["convergence_velocity_lat"]**2 + self.data[_age][_case]["convergence_velocity_lon"]**2)
[docs] def sample_slab_seafloor_ages( self, - ages = None, - cases = None, - plateIDs = None, + ages: Optional[Union[int, float, List[Union[int, float]], _numpy.ndarray]] = None, + cases: Optional[Union[str, List[str]]] = None, + plateIDs: Optional[Union[int, float, List[Union[int, float]], _numpy.ndarray]] = None, grids = None, + PROGRESS_BAR: bool = True, ): """ Samples seafloor age at slabs. @@ -529,6 +551,8 @@

Source code for plato.slabs

             plate = "lower",
             vars = ["seafloor_age"],
             cols = ["slab_seafloor_age"],
+            ITERATIONS = True,
+            PROGRESS_BAR = PROGRESS_BAR,
         )
 
         # Set sampling flag to true
@@ -543,6 +567,7 @@ 

Source code for plato.slabs

             cases = None,
             plateIDs = None,
             grids = None,
+            PROGRESS_BAR = True,
         ):
         """
         Samples seafloor age at arcs.
@@ -567,6 +592,7 @@ 

Source code for plato.slabs

             plate = "upper",
             vars = ["seafloor_age"],
             cols = ["arc_seafloor_age"],
+            PROGRESS_BAR = PROGRESS_BAR,
         )
 
         # Set sampling flag to true
@@ -577,10 +603,11 @@ 

Source code for plato.slabs

 [docs]
     def sample_slab_sediment_thickness(
             self,
-            ages = None,
-            cases = None,
-            plateIDs = None,
+            ages: Optional[Union[int, float, List[Union[int, float]], _numpy.ndarray]] = None,
+            cases: Optional[Union[str, List[str]]] = None,
+            plateIDs: Optional[Union[int, float, List[Union[int, float]], _numpy.ndarray]] = None,
             grids = None,
+            PROGRESS_BAR: bool = True,
         ):
         """
         Samples sediment thickness at slabs.
@@ -612,6 +639,7 @@ 

Source code for plato.slabs

             plate = "lower",
             vars = None,
             cols = ["sediment_thickness"],
+            PROGRESS_BAR = PROGRESS_BAR,
         )
 
         # Get continental arcs
@@ -619,6 +647,7 @@ 

Source code for plato.slabs

             ages,
             cases,
             plateIDs,
+            PROGRESS_BAR,
         )
 
         # Set active margin sediment thickness
@@ -627,6 +656,7 @@ 

Source code for plato.slabs

             cases,
             plateIDs,
             cols = "sediment_thickness",
+            PROGRESS_BAR = PROGRESS_BAR,
         )
 
         # Set sampling flag to true
@@ -637,9 +667,10 @@ 

Source code for plato.slabs

 [docs]
     def set_continental_arc(
             self,
-            ages = None,
-            cases = None,
-            plateIDs = None,
+            ages: Optional[Union[int, float, List[Union[int, float]], _numpy.ndarray]] = None,
+            cases: Optional[Union[str, List[str]]] = None,
+            plateIDs: Optional[Union[int, float, List[Union[int, float]], _numpy.ndarray]] = None,
+            PROGRESS_BAR: bool = True,
         ):
         """
         Function to set whether a trench has a continental arc.
@@ -655,7 +686,7 @@ 

Source code for plato.slabs

         """
         # Check whether arc seafloor ages have been sampled
         if not self.sampled_seafloor_at_arcs:
-            self.sample_arc_seafloor_ages(ages, cases, plateIDs)
+            self.sample_arc_seafloor_ages(ages, cases, plateIDs, PROGRESS_BAR)
 
         # Define ages if not provided
         _ages = utils_data.select_ages(ages, self.settings.ages)
@@ -695,13 +726,15 @@ 

Source code for plato.slabs

 [docs]
     def sample_grid(
             self,
-            ages: Optional[Union[_numpy.ndarray, List, float, int]] = None,
-            cases: Optional[Union[List[str], str]] = None,
-            plateIDs: Optional[Union[List[int], List[float], _numpy.ndarray]] = None,
+            ages: Optional[Union[int, float, List[Union[int, float]], _numpy.ndarray]] = None,
+            cases: Optional[Union[str, List[str]]] = None,
+            plateIDs: Optional[Union[int, float, List[Union[int, float]], _numpy.ndarray]] = None,
             grids: Optional[Dict] = None,
             plate: Optional[str] = "lower",
             vars: Optional[Union[str, List[str]]] = ["seafloor_age"],
             cols = ["slab_seafloor_age"],
+            ITERATIONS: bool = False,
+            PROGRESS_BAR: bool = True,
         ):
         """
         Samples any grid at slabs.
@@ -717,7 +750,11 @@ 

Source code for plato.slabs

 
         # Loop through valid cases
         # Order of loops is flipped to skip cases where no grid needs to be sampled
-        for key, entries in _tqdm(_iterable.items(), desc="Sampling slabs", disable=self.settings.logger.level == logging.INFO):
+        for key, entries in _tqdm(
+                _iterable.items(), 
+                desc="Sampling slabs", 
+                disable=(self.settings.logger.level in [logging.INFO, logging.DEBUG] or not PROGRESS_BAR)
+            ):            
             # Skip if sediment grid is not sampled
             if cols == ["sediment_thickness"] and not self.settings.options[key]["Sample sediment grid"]:
                 logging.info(f"Skipping sampling of sediment thickness for case {key}.")
@@ -736,7 +773,7 @@ 

Source code for plato.slabs

                 # Select points
                 _data = self.data[_age][key]
                 if plateIDs is not None:
-                    _data = _data[_data.plateID.isin(_plateIDs)]
+                    _data = _data[_data[f"{plate}_plateID"].isin(_plateIDs)]
 
                 # Determine the appropriate grid
                 _grid = None
@@ -800,6 +837,50 @@ 

Source code for plato.slabs

                         )
                         accumulated_data += sampled_data
 
+                    # This is to iteratively check if the sampling distance is to be adjusted
+                    # This is especially a problem with on the western active margin of South America in the Earthbyte reconstructions, where the continental mask does not account of motion of the trench
+                    if ITERATIONS:
+                        if plate == "lower":
+                            current_sampling_distance = -30
+                            iter_num = 20
+                        if plate == "upper":
+                            current_sampling_distance = +100
+                            iter_num = 4
+
+                        for i in range(iter_num):
+                            # Mask data
+                            mask = _numpy.isnan(accumulated_data)
+
+                            # Set masked data to zero to avoid errors
+                            accumulated_data[mask] = 0
+
+                            # Calculate new sampling points
+                            sampling_lat, sampling_lon = utils_calc.project_points(
+                                _data.loc[_data.index[mask], f"{type}_sampling_lat"],
+                                _data.loc[_data.index[mask], f"{type}_sampling_lat"],
+                                _data.loc[_data.index[mask], "trench_normal_azimuth"],
+                                current_sampling_distance,
+                            )
+
+                            # Sample grid at points for each variable
+                            for _var in _vars:
+                                sampled_data[mask] = utils_calc.sample_grid(
+                                    sampling_lat,
+                                    sampling_lon,
+                                    _grid[_var],
+                                )
+                                accumulated_data[mask] += sampled_data[mask]
+
+                            # Define new sampling distance
+                            if plate == "lower":
+                                if i <= 1:
+                                    current_sampling_distance -= 30
+                                elif i % 2 == 0:
+                                    current_sampling_distance -= 30 * (2 ** (i // 2))
+
+                            if plate == "upper":
+                                current_sampling_distance += 100
+
                     # Enter sampled data back into the DataFrame
                     self.data[_age][key].loc[_data.index, _col] = accumulated_data
 
@@ -817,12 +898,13 @@ 

Source code for plato.slabs

 [docs]
     def set_values(
             self,
-            ages: Optional[Union[_numpy.ndarray, List, float, int]] = None,
-            cases: Optional[Union[List[str], str]] = None,
-            plateIDs: Optional[Union[List[int], List[float], _numpy.ndarray]] = None,
+            ages: Optional[Union[int, float, List[Union[int, float]], _numpy.ndarray]] = None,
+            cases: Optional[Union[str, List[str]]] = None,
+            plateIDs: Optional[Union[int, float, List[Union[int, float]], _numpy.ndarray]] = None,
             plate: Optional[str] = "lower",
             cols: Optional[Union[List[str], str]] = None,
             vals: Optional[Union[List[float], float]] = None,
+            PROGRESS_BAR: bool = True,
         ):
         """
         Function to add values to the 'Slabs' object.
@@ -837,7 +919,11 @@ 

Source code for plato.slabs

         type = "arc" if plate == "upper" else "slab"
 
         # Loop through valid cases
-        for key, entries in _tqdm(_iterable.items(), desc="Adding values", disable=(self.settings.logger.level==logging.INFO)):
+        for key, entries in _tqdm(
+                _iterable.items(), 
+                desc="Adding values", 
+                disable=(self.settings.logger.level in [logging.INFO, logging.DEBUG] or not PROGRESS_BAR)
+            ):            
             # Special case for active margin sediments
             if cols == "sediment_thickness" and vals == None:
                 if not self.settings.options[key]["Active margin sediments"]:
@@ -894,9 +980,10 @@ 

Source code for plato.slabs

 [docs]
     def calculate_slab_pull_force(
             self,
-            ages: Optional[Union[_numpy.ndarray, List, float, int]] = None,
-            cases: Optional[Union[List[str], str]] = None,
-            plateIDs: Optional[Union[List[int], List[float], _numpy.ndarray]] = None,
+            ages: Optional[Union[int, float, List[Union[int, float]], _numpy.ndarray]] = None,
+            cases: Optional[Union[str, List[str]]] = None,
+            plateIDs: Optional[Union[int, float, List[Union[int, float]], _numpy.ndarray]] = None,
+            PROGRESS_BAR: bool = True,
         ):
         """
         Function to compute slab pull force along trenches.
@@ -909,7 +996,11 @@ 

Source code for plato.slabs

 
         # Loop through valid cases
         # Order of loops is flipped to skip cases where no slab pull torque needs to be sampled
-        for key, entries in _tqdm(_iterable.items(), desc="Computing slab pull forces", disable=(self.settings.logger.level==logging.INFO)):
+        for key, entries in _tqdm(
+                _iterable.items(), 
+                desc="Calculating slab pull forces", 
+                disable=(self.settings.logger.level in [logging.INFO, logging.DEBUG] or not PROGRESS_BAR)
+            ):
             # Skip if slab pull torque is not sampled
             if self.settings.options[key]["Slab pull torque"]:                
                 # Loop through ages
@@ -923,6 +1014,10 @@ 

Source code for plato.slabs

                     # Select points
                     if plateIDs is not None:
                         _data = _data[_data.lower_plateID.isin(_plateIDs)]
+
+                    if _data.empty:
+                        logging.warning(f"No valid points found for case {key} Ma.")
+                        continue
                         
                     # Calculate slab pull force
                     computed_data1 = utils_calc.compute_slab_pull_force(
@@ -967,9 +1062,10 @@ 

Source code for plato.slabs

 [docs]
     def calculate_slab_bend_force(
             self,
-            ages: Optional[Union[_numpy.ndarray, List, float, int]] = None,
-            cases: Optional[Union[List[str], str]] = None,
-            plateIDs: Optional[Union[List[int], List[float], _numpy.ndarray]] = None,
+            ages: Optional[Union[int, float, List[Union[int, float]], _numpy.ndarray]] = None,
+            cases: Optional[Union[str, List[str]]] = None,
+            plateIDs: Optional[Union[int, float, List[Union[int, float]], _numpy.ndarray]] = None,
+            PROGRESS_BAR: bool = True,
         ):
         """
         Function to compute slab bend force along trenches.
@@ -982,7 +1078,11 @@ 

Source code for plato.slabs

 
         # Loop through valid cases
         # Order of loops is flipped to skip cases where no slab bend torque needs to be sampled
-        for key, entries in _tqdm(_iterable.items(), desc="Computing slab bend forces", disable=(self.settings.logger.level==logging.INFO)):
+        for key, entries in _tqdm(
+                _iterable.items(),
+                desc="Calculating slab bend forces",
+                disable=(self.settings.logger.level in [logging.INFO, logging.DEBUG] or not PROGRESS_BAR)
+            ):
             # Skip if slab pull torque is not sampled
             if self.settings.options[key]["Slab bend torque"]:
                 # Loop through ages
@@ -996,6 +1096,10 @@ 

Source code for plato.slabs

                     # Select points
                     if plateIDs is not None:
                         _data = _data[_data.lower_plateID.isin(_plateIDs)]
+                    
+                    if _data.empty:
+                        logging.warning(f"No valid points found for case {key} Ma.")
+                        continue
                         
                     # Calculate slab pull force
                     _data = utils_calc.compute_slab_bend_force(
@@ -1031,10 +1135,11 @@ 

Source code for plato.slabs

 [docs]
     def calculate_residual_force(
             self,
-            ages: Optional[Union[_numpy.ndarray, List, float, int]] = None,
-            cases: Optional[Union[List[str], str]] = None,
-            plateIDs: Optional[Union[List[int], List[float], _numpy.ndarray]] = None,
+            ages: Optional[Union[int, float, List[Union[int, float]], _numpy.ndarray]] = None,
+            cases: Optional[Union[str, List[str]]] = None,
+            plateIDs: Optional[Union[int, float, List[Union[int, float]], _numpy.ndarray]] = None,
             residual_torque: Optional[Dict] = None,
+            PROGRESS_BAR: bool = True,
         ):
         """
         Function to calculate residual torque along trenches.
@@ -1046,46 +1151,55 @@ 

Source code for plato.slabs

         _cases = utils_data.select_iterable(cases, self.settings.slab_pull_cases)
 
         # Loop through ages and cases
-        for _age in _ages:
-            for _case in _cases:
-                # Select plateIDs
-                _plateIDs = utils_data.select_plateIDs(plateIDs, self.data[_age][_case]["lower_plateID"].unique())
-
-                for _plateID in _plateIDs:
-                    if (
-                        isinstance(residual_torque, Dict)
-                        and _age in residual_torque.keys()
-                        and _case in residual_torque[_age].keys()
-                        and isinstance(residual_torque[_age][_case], _pandas.DataFrame)
-                    ):
-                        # Get stage rotation from the provided DataFrame in the dictionary
-                        _residual_torque = residual_torque[_age][_case][residual_torque[_age][_case].plateID == _plateID]
-                    
-                    # Make mask for plate
-                    mask = self.data[_age][_case]["lower_plateID"] == _plateID
-                                            
-                    # Compute velocities
-                    forces = utils_calc.compute_residual_force(
-                        self.data[_age][_case].loc[mask],
-                        _residual_torque,
-                        plateID_col = "lower_plateID",
-                        weight_col = "trench_normal_azimuth",
-                    )
+        for _case in _tqdm(
+                _cases,
+                desc="Calculating residual forces at slabs",
+                disable=(self.settings.logger.level in [logging.INFO, logging.DEBUG] or not PROGRESS_BAR)
+            ):
+            if self.settings.options[_case]["Reconstructed motions"]:
+                for _age in _ages:
+                    # Select plateIDs
+                    _plateIDs = utils_data.select_plateIDs(plateIDs, self.data[_age][_case]["lower_plateID"].unique())
+
+                    for _plateID in _plateIDs:
+                        if (
+                            isinstance(residual_torque, Dict)
+                            and _age in residual_torque.keys()
+                            and _case in residual_torque[_age].keys()
+                            and isinstance(residual_torque[_age][_case], _pandas.DataFrame)
+                        ):
+                            # Get stage rotation from the provided DataFrame in the dictionary
+                            _residual_torque = residual_torque[_age][_case][residual_torque[_age][_case].plateID == _plateID]
+                        
+                        # Make mask for plate
+                        mask = self.data[_age][_case]["lower_plateID"] == _plateID
 
-                    # Store velocities
-                    self.data[_age][_case].loc[mask, "residual_force_lat"] = forces[0]
-                    self.data[_age][_case].loc[mask, "residual_force_lon"] = forces[1]
-                    self.data[_age][_case].loc[mask, "residual_force_mag"] = forces[2]
-                    self.data[_age][_case].loc[mask, "residual_force_azi"] = forces[3]
+ if mask.sum() == 0: + logging.info(f"No valid points found for age {_age}, case {_case}, and plateID {_plateID}.") + continue + + # Compute velocities + forces = utils_calc.compute_residual_force( + self.data[_age][_case].loc[mask], + _residual_torque, + plateID_col = "lower_plateID", + weight_col = "trench_normal_azimuth", + ) + + # Store velocities + self.data[_age][_case].loc[mask, "residual_force_lat"] = forces[0] + self.data[_age][_case].loc[mask, "residual_force_lon"] = forces[1] + self.data[_age][_case].loc[mask, "residual_force_mag"] = forces[2] + self.data[_age][_case].loc[mask, "residual_force_azi"] = forces[3]
[docs] def extract_data_through_time( self, - ages: Optional[Union[_numpy.ndarray, List, float, int]] = None, - cases: Optional[Union[List[str], str]] = None, - plateIDs: Optional[Union[List[int], List[float], _numpy.ndarray]] = None, + ages: Optional[Union[int, float, List[Union[int, float]], _numpy.ndarray]] = None, + cases: Optional[Union[str, List[str]]] = None, + plateIDs: Optional[Union[int, float, List[Union[int, float]], _numpy.ndarray]] = None, var: Optional[Union[List[str], str]] = "None", ): """ @@ -1159,14 +1273,17 @@

Source code for plato.slabs

 [docs]
     def save(
             self,
-            ages: Union[None, List[int], List[float], _numpy.ndarray] = None,
-            cases: Union[None, str, List[str]] = None,
-            plateIDs: Union[None, List[int], List[float], _numpy.ndarray] = None,
+            ages: Optional[Union[int, float, List[Union[int, float]], _numpy.ndarray]] = None,
+            cases: Optional[Union[str, List[str]]] = None,
+            plateIDs: Optional[Union[int, float, List[Union[int, float]], _numpy.ndarray]] = None,
             file_dir: Optional[str] = None,
+            PROGRESS_BAR: bool = True,
         ):
         """
         Function to save the 'Slabs' object.
         Data of the 'Slabs' object is saved to .parquet files.
+
+
         """
         # Define ages if not provided
         _ages = utils_data.select_ages(ages, self.settings.ages)
@@ -1178,11 +1295,24 @@ 

Source code for plato.slabs

         _file_dir = self.settings.dir_path if file_dir is None else file_dir
 
         # Loop through ages
-        for _age in _tqdm(_ages, desc="Saving Slabs", disable=self.settings.logger.level==logging.INFO):
+        for _age in _tqdm(
+                _ages, 
+                desc="Saving Slabs", 
+                disable=(self.settings.logger.level in [logging.INFO, logging.DEBUG] or not PROGRESS_BAR)
+            ):            
             # Loop through cases
             for _case in _cases:
+                # Select data
+                _data = self.data[_age][_case]
+
+                # Subselect data, if plateIDs are provided
+                if plateIDs is not None:
+                    _plateIDs = utils_data.select_plateIDs(plateIDs, _data.lower_plateID.unique())
+                    _data = _data[_data.lower_plateID.isin(_plateIDs)]
+
+                # Save data
                 utils_data.DataFrame_to_parquet(
-                    self.data[_age][_case],
+                    _data,
                     "Slabs",
                     self.settings.name,
                     _age,
@@ -1197,14 +1327,17 @@ 

Source code for plato.slabs

 [docs]
     def export(
             self,
-            ages: Union[None, List[int], List[float], _numpy.ndarray] = None,
-            cases: Union[None, str, List[str]] = None,
-            plateIDs: Union[None, List[int], List[float], _numpy.ndarray] = None,
+            ages: Optional[Union[int, float, List[Union[int, float]], _numpy.ndarray]] = None,
+            cases: Optional[Union[str, List[str]]] = None,
+            plateIDs: Optional[Union[int, float, List[Union[int, float]], _numpy.ndarray]] = None,
             file_dir: Optional[str] = None,
+            PROGRESS_BAR: bool = True,
         ):
         """
         Function to export the 'Slabs' object.
         Data of the 'Slabs' object is exported to .csv files.
+
+
         """
         # Define ages if not provided
         _ages = utils_data.select_ages(ages, self.settings.ages)
@@ -1216,11 +1349,24 @@ 

Source code for plato.slabs

         _file_dir = self.settings.dir_path if file_dir is None else file_dir
 
         # Loop through ages
-        for _age in _tqdm(_ages, desc="Exporting Slabs", disable=self.settings.logger.level==logging.INFO):
+        for _age in _tqdm(
+                _ages, 
+                desc="Exporting Slabs", 
+            disable=(self.settings.logger.level in [logging.INFO, logging.DEBUG] or not PROGRESS_BAR)
+            ):            
             # Loop through cases
             for _case in _cases:
+                # Select data
+                _data = self.data[_age][_case]
+
+                # Subselect data, if plateIDs are provided
+                if plateIDs is not None:
+                    _plateIDs = utils_data.select_plateIDs(plateIDs, _data.lower_plateID.unique())
+                    _data = _data[_data.lower_plateID.isin(_plateIDs)]
+
+                # Export data
                 utils_data.DataFrame_to_csv(
-                    self.data[_age][_case],
+                    _data,
                     "Slabs",
                     self.settings.name,
                     _age,
@@ -1263,7 +1409,7 @@ 

Source code for plato.slabs

       
     
   
-
+
diff --git a/docs/build/html/_static/documentation_options.js b/docs/build/html/_static/documentation_options.js index 05cfa37..bbe353f 100644 --- a/docs/build/html/_static/documentation_options.js +++ b/docs/build/html/_static/documentation_options.js @@ -1,5 +1,5 @@ const DOCUMENTATION_OPTIONS = { - VERSION: 'v0.0.1-41-gdd09714-dirty', + VERSION: 'v0.0.1-45-g3592493-dirty', LANGUAGE: 'en', COLLAPSE_INDEX: false, BUILDER: 'html', diff --git a/docs/build/html/api/generated/plato.globe.html b/docs/build/html/api/generated/plato.globe.html index 41ee7bc..efd67bd 100644 --- a/docs/build/html/api/generated/plato.globe.html +++ b/docs/build/html/api/generated/plato.globe.html @@ -304,7 +304,7 @@
-
+
diff --git a/docs/build/html/api/generated/plato.grids.html b/docs/build/html/api/generated/plato.grids.html index 1638820..f1f948f 100644 --- a/docs/build/html/api/generated/plato.grids.html +++ b/docs/build/html/api/generated/plato.grids.html @@ -304,7 +304,7 @@
-
+
diff --git a/docs/build/html/api/generated/plato.plates.html b/docs/build/html/api/generated/plato.plates.html index 50ec68b..e5a9e21 100644 --- a/docs/build/html/api/generated/plato.plates.html +++ b/docs/build/html/api/generated/plato.plates.html @@ -304,7 +304,7 @@
-
+
diff --git a/docs/build/html/api/generated/plato.plot.html b/docs/build/html/api/generated/plato.plot.html index 049c066..ac53885 100644 --- a/docs/build/html/api/generated/plato.plot.html +++ b/docs/build/html/api/generated/plato.plot.html @@ -304,7 +304,7 @@
-
+
diff --git a/docs/build/html/api/generated/plato.points.html b/docs/build/html/api/generated/plato.points.html index 0b70307..4c64269 100644 --- a/docs/build/html/api/generated/plato.points.html +++ b/docs/build/html/api/generated/plato.points.html @@ -304,7 +304,7 @@
-
+
diff --git a/docs/build/html/api/generated/plato.slabs.html b/docs/build/html/api/generated/plato.slabs.html index 06d9dd0..ef916aa 100644 --- a/docs/build/html/api/generated/plato.slabs.html +++ b/docs/build/html/api/generated/plato.slabs.html @@ -304,7 +304,7 @@
-
+
diff --git a/docs/build/html/api/globe/index.html b/docs/build/html/api/globe/index.html index a38506f..06813ad 100644 --- a/docs/build/html/api/globe/index.html +++ b/docs/build/html/api/globe/index.html @@ -268,6 +268,34 @@

Globe class plato.globe.Globe(settings=None, reconstruction=None, rotation_file=None, topology_file=None, polygon_file=None, reconstruction_name=None, ages=None, cases_file=None, cases_sheet='Sheet1', files_dir=None, plates=None, points=None, slabs=None, PARALLEL_MODE=False, DEBUG_MODE=False, CALCULATE_VELOCITIES=True)[source]

Bases: object

Class to store information on global plate tectonic properties of the Earth.

+

A Globe object can be initialised in multiple ways:

+
    +
  1. The user can initialise a Globe object from scratch by providing the reconstruction and the ages of interest. +The reconstruction can be provided as a file with rotation poles, a file with topologies, and a file with polygons, or as one of the model name string identifiers for the models available on the GPlately DataServer (https://gplates.github.io/gplately/v1.3.0/#dataserver).

    +

    Additionally, the user may specify the excel file with a number of different cases (combinations of options) to be considered.

    +
  2. +
  3. Alternatively, the user can initialise a Globe object by providing a Settings object and a Reconstruction object from a Globe, Grids, Plates, Points or Slabs object. +Providing the settings from a Globe object will allow the user to initialise a new Globe object with the same settings as the original object.

  4. +
+
+
Parameters:
+
    +
  • settings (plato.settings.Settings) – Settings object (default: None)

  • +
  • reconstruction (gplately.PlateReconstruction) – Reconstruction object (default: None)

  • +
  • rotation_file (str) – filepath to .rot file with rotation poles (default: None)

  • +
  • topology_file (str) – filepath to .gpml file with topologies (default: None)

  • +
  • polygon_file (str) – filepath to .gpml file with polygons (default: None)

  • +
  • reconstruction_name (str) – model name string identifiers for the GPlately DataServer (default: None)

  • +
  • ages (float, int, list, numpy.ndarray) – ages of interest (default: None)

  • +
  • cases_file (str) – filepath to excel file with cases (default: None)

  • +
  • cases_sheet (str) – name of the sheet in the excel file with cases (default: “Sheet1”)

  • +
  • files_dir (str) – directory to store files (default: None)

  • +
  • PARALLEL_MODE (bool) – flag to enable parallel mode (default: False)

  • +
  • DEBUG_MODE (bool) – flag to enable debug mode (default: False)

  • +
  • CALCULATE_VELOCITIES (bool) – flag to calculate velocities (default: True)

  • +
+
+
calculate_number_of_plates(plates=None, ages=None, cases=None)[source]
@@ -282,8 +310,20 @@

Globe
-calculate_net_rotation(plates=None, points=None, ages=None, cases=None, plateIDs=None)[source]
+calculate_net_rotation(plates=None, points=None, ages=None, cases=None, plateIDs=None, PROGRESS_BAR=True)[source]

Calculate the net rotation of the Earth’s lithosphere.

+
+
Parameters:
+
    +
  • plates (plato.plates.Plates) – Plates object (default: None)

  • +
  • points (plato.points.Points) – Points object (default: None)

  • +
  • ages (float, int, list, numpy.ndarray) – ages of interest (default: None)

  • +
  • cases (str, list) – cases of interest (default: None)

  • +
  • plateIDs (int, float, list, numpy.ndarray) – plateIDs of interest (default: None)

  • +
  • PROGRESS_BAR (bool) – flag to enable progress bar (default: True)

  • +
+
+
@@ -294,14 +334,14 @@

Globe
-save(cases=None, file_dir=None)[source]
+save(cases=None, file_dir=None, PROGRESS_BAR=True)[source]

Function to save ‘Globe’ object. Data of the ‘Globe’ object is saved to .parquet files.

-export(cases=None, file_dir=None)[source]
+export(cases=None, file_dir=None, PROGRESS_BAR=True)[source]

Function to export ‘Globe’ object. Data of the ‘Globe’ object is exported to .csv files.

@@ -386,7 +426,7 @@

Globe

-
+
diff --git a/docs/build/html/api/grids/index.html b/docs/build/html/api/grids/index.html index b2c3416..15e2534 100644 --- a/docs/build/html/api/grids/index.html +++ b/docs/build/html/api/grids/index.html @@ -299,54 +299,151 @@

Grids

Function to add another grid of a variable to the seafloor grid. The grids should be organised in a dictionary with each item being an xarray.Dataset with each key being the corresponding reconstruction age, or a single xarray.Dataset, in which case it will be stored without an age. ‘mask_continents’ is a boolean that determines whether or not to cut the grids to the seafloor. It should only be used for grids that only describe the seafloor, e.g. marine sediment distributions, and not e.g. continental erosion rate grids.

+
+
Parameters:
+
    +
  • input_grids (dict, xarray.Dataset) – input grids to add

  • +
  • variable_name (str) – name of the variable to add

  • +
  • grid_type (str) – type of grid to add to

  • +
  • target_variable (str) – variable to add

  • +
  • mask_continents (bool) – flag to mask continents (default: False)

  • +
  • interpolate (bool) – flag to interpolate (default: True)

  • +
  • prefactor (float) – prefactor to apply to the grid (default: 1.)

  • +
+
+
-generate_velocity_grid(ages, cases, point_data, components=None)[source]
+generate_velocity_grid(ages, cases, point_data, components=None, PROGRESS_BAR=True)[source]

Function to generate a velocity grid.

+
+
Parameters:
+
    +
  • ages (int, float) – ages of interest

  • +
  • cases (str) – cases of interest

  • +
  • point_data (dict) – point data to interpolate

  • +
  • components (str, list) – components to interpolate

  • +
  • (default (PROGRESS_BAR:flag to show progress bar) – True)

  • +
+
+
interpolate_data_to_grid(age, lat, lon, data, case=None, grid_type='velocity')[source]

Function to interpolate data to the resolution of the seafloor age grid.

+
+
Parameters:
+
    +
  • age (int, float) – age of the grid

  • +
  • lat (float, list, numpy.ndarray) – latitude of the grid

  • +
  • lon (float, list, numpy.ndarray) – longitude of the grid

  • +
  • data (float, list, numpy.ndarray) – data to interpolate

  • +
  • case (str) – case of the grid (default: None)

  • +
  • grid_type (str) – type of grid to interpolate to (default: “velocity”)

  • +
+
+
-save_all(ages=None, cases=None, file_dir=None)[source]
+save_all(ages=None, cases=None, file_dir=None, PROGRESS_BAR=True)[source]

Function to save all the grids

+
+
Parameters:
+
    +
  • ages (float, int, list, numpy.ndarray) – ages of interest (default: None)

  • +
  • cases (str, list) – cases of interest (default: None)

  • +
  • file_dir (str) – directory to store files (default: None)

  • +
  • (default (PROGRESS_BAR:flag to show progress bar) – True)

  • +
+
+
-save_seafloor_age(ages=None, file_dir=None)[source]
+save_seafloor_age(ages=None, file_dir=None, PROGRESS_BAR=True)[source]

Function to save the the seafloor age grid.

+
+
Parameters:
+
    +
  • ages (float, int, list, numpy.ndarray) – ages of interest (default: None)

  • +
  • file_dir (str) – directory to store files (default: None)

  • +
  • (default (PROGRESS_BAR:flag to show progress bar) – True)

  • +
+
+
-save_sediment(ages=None, cases=None, file_dir=None)[source]
+save_sediment(ages=None, cases=None, file_dir=None, PROGRESS_BAR=True)[source]

Function to save the the sediment grid.

+
+
Parameters:
+
    +
  • ages (float, int, list, numpy.ndarray) – ages of interest (default: None)

  • +
  • cases (str, list) – cases of interest (default: None)

  • +
  • file_dir (str) – directory to store files (default: None)

  • +
  • (default (PROGRESS_BAR:flag to show progress bar) – True)

  • +
+
+
-save_continent(ages=None, cases=None, file_dir=None)[source]
+save_continent(ages=None, cases=None, file_dir=None, PROGRESS_BAR=True)[source]

Function to save the the continental grid.

+
+
Parameters:
+
    +
  • ages (float, int, list, numpy.ndarray) – ages of interest (default: None)

  • +
  • cases (str, list) – cases of interest (default: None)

  • +
  • file_dir (str) – directory to store files (default: None)

  • +
  • (default (PROGRESS_BAR:flag to show progress bar) – True)

  • +
+
+
-save_velocity(ages=None, cases=None, file_dir=None)[source]
+save_velocity(ages=None, cases=None, file_dir=None, PROGRESS_BAR=True)[source]

Function to save the the velocity grid.

+
+
Parameters:
+
    +
  • ages (float, int, list, numpy.ndarray) – ages of interest (default: None)

  • +
  • cases (str, list) – cases of interest (default: None)

  • +
  • file_dir (str) – directory to store files (default: None)

  • +
  • (default (PROGRESS_BAR:flag to show progress bar) – True)

  • +
+
+
-save_grid(data, type, ages=None, cases=None, file_dir=None)[source]
-

Function to save a grid

+save_grid(data, type, ages=None, cases=None, file_dir=None, PROGRESS_BAR=True)[source] +

Function to save a grid.

+
+
Parameters:
+
    +
  • data (dict, xarray.Dataset) – data to save

  • +
  • type (str) – type of grid

  • +
  • ages (float, int, list, numpy.ndarray) – ages of interest (default: None)

  • +
  • cases (str, list) – cases of interest (default: None)

  • +
  • file_dir (str) – directory to store files (default: None)

  • +
  • (default (PROGRESS_BAR:flag to show progress bar) – True)

  • +
+
+
@@ -432,7 +529,7 @@

Grids

-
+
diff --git a/docs/build/html/api/index.html b/docs/build/html/api/index.html index ac9f596..4fffe5a 100644 --- a/docs/build/html/api/index.html +++ b/docs/build/html/api/index.html @@ -351,7 +351,7 @@
-
+
diff --git a/docs/build/html/api/optimise/index.html b/docs/build/html/api/optimise/index.html index 729efcb..ca764fb 100644 --- a/docs/build/html/api/optimise/index.html +++ b/docs/build/html/api/optimise/index.html @@ -298,7 +298,7 @@

Optimisation
-optimise_slab_pull_coefficient(age=None, case=None, plateIDs=None, grid_size=500, viscosity=1.23e+20, plot=False)[source]
+optimise_slab_pull_coefficient(age=None, cases=None, plateIDs=None, grid_size=500, viscosity=1.23e+20, plot=False)[source]

Function to find optimised slab pull coefficient for a given (set of) plates using a grid search.

Parameters:
@@ -321,7 +321,7 @@

Optimisation
-invert_residual_torque(age=None, case=None, plateIDs=None, parameter='Slab pull constant', grid_size=500, viscosity=1.23e+20, plot=False)[source]
+invert_residual_torque(age=None, cases=None, plateIDs=None, parameter='Slab pull constant', vmin=8.5, vmax=13.5, step=0.1, plot=False)[source]

Function to find optimised slab pull coefficient or mantle viscosity by projecting the residual torque onto the subduction zones and grid points.

Parameters:
@@ -455,7 +455,7 @@

Optimisation +

diff --git a/docs/build/html/api/plate_torques/index.html b/docs/build/html/api/plate_torques/index.html index 2c589bc..ad2aa18 100644 --- a/docs/build/html/api/plate_torques/index.html +++ b/docs/build/html/api/plate_torques/index.html @@ -318,7 +318,7 @@

PlateTorques
-calculate_rms_velocity(ages=None, cases=None, plateIDs=None)[source]
+calculate_rms_velocity(ages=None, cases=None, plateIDs=None, PROGRESS_BAR=True)[source]

Function to calculate root mean square velocities for plates.

Parameters:
@@ -333,7 +333,7 @@

PlateTorques
-calculate_net_rotation(ages=None, cases=None, plateIDs=None)[source]
+calculate_net_rotation(ages=None, cases=None, plateIDs=None, PROGRESS_BAR=True)[source]

Function to calculate net rotation of the entire lithosphere. This calls the calculate_net_rotation method in the Globe class.

@@ -349,7 +349,7 @@

PlateTorques
-sample_all(ages=None, cases=None, plateIDs=None)[source]
+sample_all(ages=None, cases=None, plateIDs=None, PROGRESS_BAR=True)[source]

Function to sample all variables relevant to the plate torques calculation. This calls three methods from the slabs class: sample_seafloor_ages, sample_slab_sediment_thicknesses, and sample_slab_sediment_thicknesses.

@@ -365,7 +365,7 @@

PlateTorques
-sample_seafloor_ages(ages=None, cases=None, plateIDs=None)[source]
+sample_seafloor_ages(ages=None, cases=None, plateIDs=None, PROGRESS_BAR=True)[source]

Function to sample the seafloor ages and other variables (if available). This calls the sample_seafloor_ages method for the Points and Slabs class.

@@ -381,7 +381,7 @@

PlateTorques
-sample_point_seafloor_ages(ages=None, cases=None, plateIDs=None)[source]
+sample_point_seafloor_ages(ages=None, cases=None, plateIDs=None, PROGRESS_BAR=True)[source]

Function to sample the seafloor ages and other variables (if available).

Parameters:
@@ -396,7 +396,7 @@

PlateTorques
-sample_slab_seafloor_ages(ages=None, cases=None, plateIDs=None)[source]
+sample_slab_seafloor_ages(ages=None, cases=None, plateIDs=None, PROGRESS_BAR=True)[source]

Function to sample the seafloor ages and other variables (if available).

Parameters:
@@ -411,7 +411,7 @@

PlateTorques
-sample_arc_seafloor_ages(ages=None, cases=None, plateIDs=None)[source]
+sample_arc_seafloor_ages(ages=None, cases=None, plateIDs=None, PROGRESS_BAR=True)[source]

Function to sample the seafloor ages and other variables (if available).

Parameters:
@@ -426,7 +426,7 @@

PlateTorques
-sample_slab_sediment_thicknesses(ages=None, cases=None, plateIDs=None)[source]
+sample_slab_sediment_thicknesses(ages=None, cases=None, plateIDs=None, PROGRESS_BAR=True)[source]

Function to sample the seafloor ages and other variables (if available).

Parameters:
@@ -441,7 +441,7 @@

PlateTorques
-calculate_all_torques(ages=None, cases=None, plateIDs=None)[source]
+calculate_all_torques(ages=None, cases=None, plateIDs=None, PROGRESS_BAR=True)[source]

Function to calculate all torques.

Parameters:
@@ -456,7 +456,7 @@

PlateTorques
-calculate_gpe_torque(ages=None, cases=None, plateIDs=None)[source]
+calculate_gpe_torque(ages=None, cases=None, plateIDs=None, PROGRESS_BAR=True)[source]

Function to calculate the GPE torque.

Parameters:
@@ -471,7 +471,7 @@

PlateTorques
-calculate_slab_pull_torque(ages=None, cases=None, plateIDs=None)[source]
+calculate_slab_pull_torque(ages=None, cases=None, plateIDs=None, PROGRESS_BAR=True)[source]

Function to calculate the slab pull torque.

Parameters:
@@ -486,7 +486,7 @@

PlateTorques
-calculate_mantle_drag_torque(ages=None, cases=None, plateIDs=None)[source]
+calculate_mantle_drag_torque(ages=None, cases=None, plateIDs=None, PROGRESS_BAR=True)[source]

Function to calculate the mantle drag torque.

Parameters:
@@ -501,7 +501,7 @@

PlateTorques
-calculate_slab_bend_torque(ages=None, cases=None, plateIDs=None)[source]
+calculate_slab_bend_torque(ages=None, cases=None, plateIDs=None, PROGRESS_BAR=True)[source]

Function to calculate the slab bend torque.

Parameters:
@@ -516,7 +516,7 @@

PlateTorques
-calculate_driving_torque(ages=None, cases=None, plateIDs=None)[source]
+calculate_driving_torque(ages=None, cases=None, plateIDs=None, PROGRESS_BAR=True)[source]

Function to calculate the driving torque.

Parameters:
@@ -531,7 +531,7 @@

PlateTorques
-calculate_residual_torque(ages=None, cases=None, plateIDs=None)[source]
+calculate_residual_torque(ages=None, cases=None, plateIDs=None, PROGRESS_BAR=True)[source]

Function to calculate the driving torque.

Parameters:
@@ -546,7 +546,7 @@

PlateTorques
-calculate_residual_force(ages=None, cases=None, plateIDs=None, type='slabs')[source]
+calculate_residual_force(ages=None, cases=None, plateIDs=None, type='slabs', PROGRESS_BAR=True)[source]

Function to calculate the residual forces.

Parameters:
@@ -561,7 +561,7 @@

PlateTorques
-calculate_synthetic_velocity(ages=None, cases=None, plateIDs=None)[source]
+calculate_synthetic_velocity(ages=None, cases=None, plateIDs=None, PROGRESS_BAR=True)[source]

Function to compute synthetic velocities.

Parameters:
@@ -576,13 +576,13 @@

PlateTorques
-rotate_torque(reference_rotations, reference_plates, torque='slab_pull_torque', ages=None, cases=None, plateIDs=None)[source]
+rotate_torque(reference_rotations, reference_plates, torque='slab_pull_torque', ages=None, cases=None, plateIDs=None, PROGRESS_BAR=True)[source]

Function to rotate a torque vector stored in another the Plates object to the reference frame of this Plates object.

Parameters:

diff --git a/docs/build/html/api/plates/index.html b/docs/build/html/api/plates/index.html index 434045b..86083db 100644 --- a/docs/build/html/api/plates/index.html +++ b/docs/build/html/api/plates/index.html @@ -438,7 +438,7 @@

Plates
-save(ages=None, cases=None, plateIDs=None, file_dir=None)[source]
+save(ages=None, cases=None, plateIDs=None, file_dir=None, PROGRESS_BAR=True)[source]

Function to export the Plates object. All files are saved as .parquet files to reduce file size and enable rapid reloading. The Plates object can be filtered by age, case, and plateID. @@ -451,6 +451,7 @@

Plates

cases (str, list[str]) – cases of interest (default: None)

  • plateIDs (int, float, list[int, float], numpy.ndarray) – plateIDs of interest (default: None)

  • file_dir (str) – directory to store files (default: None)

  • +
  • PROGRESS_BAR (bool) – flag to enable the tqdm progress bar (default: True)

  • @@ -458,7 +459,7 @@

    Plates
    -export(ages=None, cases=None, plateIDs=None, file_dir=None)[source]
    +export(ages=None, cases=None, plateIDs=None, file_dir=None, PROGRESS_BAR=True)[source]

    Function to export the Plates object. Geometries are exported as shapefiles, data are exported as .csv files. The Plates object can be filtered by age, case, and plateID. @@ -471,6 +472,7 @@

    Plates

    cases (str, list[str]) – cases of interest (default: None)

  • plateIDs (int, float, list[int, float], numpy.ndarray) – plateIDs of interest (default: None)

  • file_dir (str) – directory to store files (default: None)

  • +
  • PROGRESS_BAR (bool) – flag to enable the tqdm progress bar (default: True)

  • @@ -559,7 +561,7 @@

    Plates

    -
    +
    diff --git a/docs/build/html/api/plot/index.html b/docs/build/html/api/plot/index.html index 9487ca2..0b07ac8 100644 --- a/docs/build/html/api/plot/index.html +++ b/docs/build/html/api/plot/index.html @@ -683,7 +683,7 @@

    PlotReconstruction +

    diff --git a/docs/build/html/api/points/index.html b/docs/build/html/api/points/index.html index c654311..e40c131 100644 --- a/docs/build/html/api/points/index.html +++ b/docs/build/html/api/points/index.html @@ -265,7 +265,7 @@

    PointsPlateTorques module, the Points class is used to store the grid points of the model and to calculate the GPE torque and mantle drag torques.

    -class plato.points.Points(settings=None, reconstruction=None, rotation_file=None, topology_file=None, polygon_file=None, reconstruction_name=None, ages=None, cases_file=None, cases_sheet='Sheet1', files_dir=None, resolved_geometries=None, PARALLEL_MODE=False, DEBUG_MODE=False, CALCULATE_VELOCITIES=True)[source]
    +class plato.points.Points(settings=None, reconstruction=None, rotation_file=None, topology_file=None, polygon_file=None, reconstruction_name=None, ages=None, cases_file=None, cases_sheet='Sheet1', files_dir=None, resolved_geometries=None, PARALLEL_MODE=False, DEBUG_MODE=False, CALCULATE_VELOCITIES=True, PROGRESS_BAR=True)[source]

    Bases: object

    Class that contains all information for the points in a reconstruction. A Slabs object can be initialised in multiple ways:

    @@ -298,7 +298,7 @@

    Points
    -calculate_velocities(ages=None, cases=None, stage_rotation=None)[source]
    +calculate_velocities(ages=None, cases=None, stage_rotation=None, PROGRESS_BAR=True)[source]

    Function to compute velocities at points.

    Parameters:
    @@ -313,7 +313,7 @@

    Points
    -sample_seafloor_ages(ages=None, cases=None, plateIDs=None, seafloor_grids=None)[source]
    +sample_seafloor_ages(ages=None, cases=None, plateIDs=None, seafloor_grids=None, vars=['seafloor_age'], PROGRESS_BAR=True)[source]

    Samples seafloor age at points.

    Parameters:
    @@ -329,7 +329,7 @@

    Points
    -sample_grid(ages=None, cases=None, plateIDs=None, grids=None, vars=['seafloor_age'], sampling_coords=['lat', 'lon'], cols=['seafloor_age'])[source]
    +sample_grid(ages=None, cases=None, plateIDs=None, grids=None, vars=['seafloor_age'], sampling_coords=['lat', 'lon'], cols=['seafloor_age'], PROGRESS_BAR=True)[source]

    Samples any grid at points.

    Parameters:
    @@ -348,7 +348,7 @@

    Points
    -calculate_gpe_force(ages=None, cases=None, plateIDs=None, seafloor_grid=None)[source]
    +calculate_gpe_force(ages=None, cases=None, plateIDs=None, seafloor_grid=None, PROGRESS_BAR=True)[source]

    Function to compute gravitational potential energy (GPE) force acting at points.

    Parameters:
    @@ -364,7 +364,7 @@

    Points
    -calculate_mantle_drag_force(ages=None, cases=None, plateIDs=None)[source]
    +calculate_mantle_drag_force(ages=None, cases=None, plateIDs=None, PROGRESS_BAR=True)[source]

    Function to compute mantle drag force acting at points.

    Parameters:
    @@ -379,7 +379,7 @@

    Points
    -calculate_residual_force(ages=None, cases=None, plateIDs=None, residual_torque=None)[source]
    +calculate_residual_force(ages=None, cases=None, plateIDs=None, residual_torque=None, PROGRESS_BAR=True)[source]

    Function to calculate residual torque along trenches.

    Parameters:
    @@ -395,7 +395,7 @@

    Points
    -save(ages=None, cases=None, plateIDs=None, file_dir=None)[source]
    +save(ages=None, cases=None, plateIDs=None, file_dir=None, PROGRESS_BAR=True)[source]

    Function to save the ‘Points’ object. Data of the points object is saved to .parquet files.

    @@ -412,7 +412,7 @@

    Points
    -export(ages=None, cases=None, plateIDs=None, file_dir=None)[source]
    +export(ages=None, cases=None, plateIDs=None, file_dir=None, PROGRESS_BAR=True)[source]

    Function to export the ‘Points’ object. Data of the points object is saved to .csv files.

    @@ -509,7 +509,7 @@

    Points