pygplates.NetworkTriangulation
- class pygplates.NetworkTriangulation
Bases:
instance
The Delaunay triangulation of a
resolved topological network
.This is the triangulation of the convex hull of the vertices obtained from the network’s resolved boundary (polygon), and any interior rigid blocks (polygons) and any interior geometries (points or lines).
See also
Network triangulation in the Primer documentation.
Added in version 0.50.
- __init__()
Raises an exception This class cannot be instantiated from Python
Methods
Raises an exception This class cannot be instantiated from Python
Returns a read-only sequence of the triangles in this triangulation.
Returns a read-only sequence of the vertices in this triangulation.
- class Triangle
Bases:
instance
A triangle in a
network triangulation
.Triangles are equality (
==
,!=
) comparable and hashable (can be used as a key in adict
).See also
Network triangulation in the Primer documentation.
Added in version 0.50.
- get_adjacent_triangle(index)
Returns the triangle adjacent to this triangle that is opposite the vertex at the specified index.
- Parameters:
index (int) – the index of this triangle’s vertex (in the range [0, 2])
- Returns:
the adjacent network triangle, or
None
if the triangle edge that is opposite the vertex at index is a boundary edge of the network triangulation (ie, a convex hull edge)- Return type:
NetworkTriangulation.Triangle
orNone
- Raises:
ValueError if index is not in the range [0, 2]
To access the three adjacent triangles of a triangle in a network triangulation:
for index in range(3): triangle_opposite_vertex_at_index = triangle.get_adjacent_triangle(index) if triangle_opposite_vertex_at_index: # if not at a triangulation boundary ...
- get_vertex(index)
Returns one of this triangle’s three vertices.
- Parameters:
index (int) – the index of this triangle’s vertex (in the range [0, 2])
- Return type:
- Raises:
ValueError if index is not in the range [0, 2]
To access the three vertices of a triangle in a network triangulation:
for index in range(3): triangle_vertex = triangle.get_vertex(index)
- property is_in_deforming_region
Whether this triangle is in the deforming region of the network.
- Type:
bool
Note
A triangle is in the deforming region if its centroid is in the deforming region (where the deforming region is defined to be inside the network’s boundary polygon but outside any interior rigid block polygons).
- class Vertex
Bases:
instance
A vertex in a
network triangulation
.Vertices are equality (
==
,!=
) comparable and hashable (can be used as a key in adict
).See also
Network triangulation in the Primer documentation.
Added in version 0.50.
- get_incident_triangles()
Returns the triangles incident to this vertex.
- Return type:
list of
NetworkTriangulation.Triangle
- get_incident_vertices()
Returns the vertices incident to this vertex.
- Return type:
list of
NetworkTriangulation.Vertex
- get_velocity([velocity_delta_time=1.0][, velocity_delta_time_type=pygplates.VelocityDeltaTimeType.t_plus_delta_t_to_t][, velocity_units=pygplates.VelocityUnits.kms_per_my][, earth_radius_in_kms=pygplates.Earth.mean_radius_in_kms])
Returns the velocity of this vertex.
- Parameters:
velocity_delta_time (float) – The time delta used to calculate velocity (defaults to 1 Myr).
velocity_delta_time_type (VelocityDeltaTimeType.t_plus_delta_t_to_t, VelocityDeltaTimeType.t_to_t_minus_delta_t or VelocityDeltaTimeType.t_plus_minus_half_delta_t) – How the two velocity times are calculated relative to the reconstruction time. This includes [t+dt, t], [t, t-dt] and [t+dt/2, t-dt/2]. Defaults to [t+dt, t].
velocity_units (VelocityUnits.kms_per_my or VelocityUnits.cms_per_yr) – whether to return velocity as kilometres per million years or centimetres per year (defaults to kilometres per million years)
earth_radius_in_kms (float) – the radius of the Earth in kilometres (defaults to
pygplates.Earth.mean_radius_in_kms
)
- Return type:
- Raises:
ValueError if velocity_delta_time is negative or zero.
- property position
Return the position of this vertex.
- Type:
- get_triangles()
Returns a read-only sequence of the triangles in this triangulation.
- Return type:
a read-only sequence of
NetworkTriangulation.Triangle
The following operations for accessing the triangles in the returned read-only sequence are supported:
Operation
Result
len(seq)
number of triangles in the triangulation
for t in seq
iterates over the triangles t in the triangulation
seq[i]
the triangle in the triangulation at index i
The following example demonstrates some uses of the above operations:
network_triangulation = resolved_topological_network.get_network_triangulation() triangles = network_triangulation.get_triangles() for triangle in triangles: ... num_triangles = len(triangles) for triangle_index in range(num_triangles): triangle = triangles[triangle_index]
Note
The returned sequence is read-only and cannot be modified.
- get_vertices()
Returns a read-only sequence of the vertices in this triangulation.
- Return type:
a read-only sequence of
NetworkTriangulation.Vertex
The following operations for accessing the vertices in the returned read-only sequence are supported:
Operation
Result
len(seq)
number of vertices in the triangulation
for v in seq
iterates over the vertices v in the triangulation
seq[i]
the vertex in the triangulation at index i
The following example demonstrates some uses of the above operations:
network_triangulation = resolved_topological_network.get_network_triangulation() vertices = network_triangulation.get_vertices() for vertex in vertices: ... num_vertices = len(vertices) for vertex_index in range(num_vertices): vertex = vertices[vertex_index]
Note
The returned sequence is read-only and cannot be modified.