gdtchron
GDTchron - Geodynamic Thermochronology
- gdtchron.add_comp_field(mesh, fields=None)[source]
Assign compositional field as a single scalar from multiple scalars.
Compositional fields in VTK files are often defined using multiple scalars, where data is assigned a value from 0 to 1 for each compositional field. Thus, to plot data by compositional field requires using these scalars to create a new scalar using a different integer to represent each compositional field. This function creates a new scalar (‘comp_field’) consisting of an integer corresponding to the scalar where the data point has a value greater than 0.5. If no scalar meets this criteria, the data point is assigned the null value of 0.
For example, the default behavior is to use three scalars for upper crust, lower crust, and mantle lithosphere. Each data point in the mesh will have a value of 0 to 1 for each of these scalars, and if any of those values are greater than 0.5, the compositional field will be assigned to the corresponding integer (1: upper crust; 2: lower crust; 3: mantle lithosphere). If none are greater than 0.5, the compositional field will be the null value (0), representing the asthenosphere.
- Parameters:
mesh (Pyvista mesh object) – A pyvista mesh object that contains geometrical representations of surface or volume data. The mesh may also have attributes, such as data values assigned to points, cells, or fields assigning various information to the mesh.
fields (str or list of str) – Names of compositional fields that are scalars in the mesh. If None, defaults to [‘crust_upper’,’crust_lower’,’mantle_lithosphere’] (default: None).
- Returns:
mesh – Original input mesh with ‘comp_field’ added as a scalar.
- Return type:
Pyvista mesh object
- gdtchron.plot_vtk_2d(mesh, field, bounds=None, ax=None, colorbar=False, **kwargs)[source]
Plot 2D mesh using Pyvista on a Matplotlib axes.
- Parameters:
mesh (Pyvista mesh object) – A pyvista mesh object that contains geometrical representations of surface or volume data. The mesh may also have attributes, such as data values assigned to points, cells, or fields assigning various information to the mesh.
field (str) – The name of the field contained within the Pyvista mesh object to plot.
bounds (list of floats or integers) – A list of four values that define the bounds by which to clip the plot. Successively, the list of values define the minimum x, maximum x, minimum y, and maximum y bounds (default: None).
ax (Matplotlib axes object) – Matplotlib axis on which to plot the mesh (default: None).
colorbar (bool) – Boolean (True or False) for whether to include colorbar (default: False).
**kwargs (dict) – Additional keyword arguments to pass to the Pyvista plotter.
- Returns:
ax – Modified matplotlib axes object with the plotted mesh
- Return type:
Matplotlib axes object
Modules
Module for forward modeling of the apatite fission track system. |