GXTIN class

class GXTIN(handle=0)[source]

GXTIN class.

The GXTIN class calculates the Delaunay triangulation of the positions in a database. This is the “best” set of triangles that can be formed from irregularly distributed points. The serialized GXTIN files can be used for gridding using the Tin-based Nearest Neighbour Algorithm, or for plotting the Delaunay triangles or Voronoi cells to a map.

__init__(handle=0)[source]

Initialize self. See help(type(self)) for accurate signature.

copy(source)[source]

Copy GXTIN

Parameters

source (GXTIN) – Source GXTIN

New in version 5.0.

License: Geosoft End-User License

classmethod create(vv_x, vv_y, vv_z)[source]

This method creates a GXTIN object.

Parameters
  • vv_x (GXVV) – X positions

  • vv_y (GXVV) – Y positions

  • vv_z (GXVV) – Z values (optional)

Returns

GXTIN Object

Return type

GXTIN

New in version 5.0.

License: Geosoft End-User License

Note: CreateTIN does the GXTIN calculation. The Z values are not required, and a 0-length GXVV can be used to indicate the values are not to be used.

classmethod create_s(bf)[source]

Create GXTIN from a serialized source

Parameters

bf (GXBF) – GXBF from which to read GXTIN

Returns

GXTIN Object

Return type

GXTIN

New in version 5.0.

License: Geosoft End-User License

classmethod export_xml(tin, crc, file)[source]

Export a GXTIN object as XML

Parameters
  • tin (str) – GXTIN file

  • crc (int_ref) – CRC returned (Currently this is not implemented)

  • file (str) – Output XML file

New in version 6.0.1.

License: Geosoft End-User License

get_convex_hull(ply)[source]

Get the convex hull of the GXTIN.

Parameters

ply (GXPLY) – GXPLY object

New in version 5.0.

License: Geosoft End-User License

Note: The convex hull is the outside boundary of the triangulated region.

get_ipj(ipj)[source]

Get the projection.

Parameters

ipj (GXIPJ) – GXIPJ in which to place the GXTIN projection

New in version 5.0.3.

License: Geosoft End-User License

get_joins(vv_joins, vv_index, vv_num)[source]

Get joins from a GXTIN mesh.

Parameters

New in version 5.0.

License: Geosoft End-User License

Note: The join information is returned in three VVs.

  • The joins GXVV is a list off the adjacent nodes for each node, arranged for 1st node, 2nd node etc.

  • The index GXVV gives the starting index in the joins GXVV for the adjacent nodes to each node.

  • The number GXVV gives the number of adjacent nodes for each node.

All VVs must be type GS_LONG.

get_mesh(vv)[source]

Get lines from a GXTIN mesh.

Parameters

vv (GXVV) – GXVV of type GS_D2LINE (returned)

New in version 5.0.

License: Geosoft End-User License

get_nodes(vvx, vvy, vvz)[source]

Get the X,Y locations and Z values of the GXTIN nodes.

Parameters

New in version 5.0.

License: Geosoft End-User License

Note: If this is not a Z-valued GXTIN, the Z values will be dummies.

get_triangle(index, x0, y0, x1, y1, x2, y2)[source]

Get the locations of the vertices of a specific triangle

Parameters

New in version 5.0.

License: Geosoft End-User License

get_triangles(tri_vv_pt1, tri_vv_pt2, tri_vv_pt3)[source]

Get the triangle nodes.

Parameters

New in version 8.4.

License: Geosoft End-User License

get_voronoi_edges(vv)[source]

Get line segments defining Voronoi cells.

Parameters

vv (GXVV) – GXVV of GS_D2LINE type (create with type -32)

New in version 5.0.

License: Geosoft End-User License

interp_vv(vvx, vvy, vvz)[source]

Interp TINned values using the natural neighbour method.

Parameters

New in version 5.0.

License: Geosoft End-User License

Note: The GXTIN have been created using max length = rDUMMY to ensure that the GXTIN has a convex hull (otherwise the routine that locates the triangle for a given location may fail). The GXTIN must also have been created using the Z values. Values located outside the convex hull are set to rDUMMY. The method is based on the following paper:

Sambridge, M., Braun, J., and McQueen, H., 1995, Geophysical parameterization and interpolation of irregular data using natural neighbours: Geophysical Journal International, 122 p. 837-857.

is_null()[source]

Check if this is a null (undefined) instance

Returns

True if this is a null (undefined) instance, False otherwise.

Return type

bool

is_z_valued()[source]

Does the GXTIN contain Z values with each X,Y?

Returns

Returns 1 if Z values are defined in the GXTIN

Return type

int

New in version 5.0.

License: Geosoft End-User License

linear_interp_vv(vvx, vvy, vvz)[source]

Interp TINned values using the linear interpolation

Parameters

New in version 5.1.4.

License: Geosoft End-User License

Note: The GXTIN have been created using max length = rDUMMY to ensure that the GXTIN has a convex hull (otherwise the routine that locates the triangle for a given location may fail). The GXTIN must also have been created using the Z values. Values located outside the convex hull are set to rDUMMY.

The values are set assuming that each GXTIN triangle defines a plane.

locate_triangle(t, x, y)[source]

Get the index of the triangle containing X, Y.

Parameters
  • t (int) – Seed triangle (can be iDummy or <0)

  • x (float) – Target X location

  • y (float) – Target Y location

Returns

The index of the triangle containing X, Y.

Return type

int

New in version 5.0.

License: Geosoft End-User License

Note: Index returned begins at 0, but could be negative.

-1: If X,Y is not contained in a triangle (or triangle not found)

-2: If the location is on an edge

This is for “fall-back” purposes only.

Frequently edge positions are located as being part of a triangle, so do not rely on this result to determine if a node position is on an edge.

-3: If the location is a vertex.

This is for “fall-back” purposes only in the code. Normal operation is to include a node position inside a triangle, so do not rely on this result to determine if a node position is input.

nearest_vv(vvx, vvy, vvz)[source]

Interp TINned values using the nearest neighbour.

Parameters

New in version 6.0.

License: Geosoft End-User License

Note: The GXTIN have been created using max length = rDUMMY to ensure that the GXTIN has a convex hull (otherwise the routine that locates the triangle for a given location may fail). The GXTIN must also have been created using the Z values. Values located outside the convex hull are set to rDUMMY.

Within each voronoi triangle, the Z value of node closest to the input X,Y location is returned.

nodes()[source]

Returns the number of nodes in the GXTIN

Returns

The number of nodes in the GXTIN

Return type

int

New in version 5.0.

License: Geosoft End-User License

classmethod null()[source]

A null (undefined) instance of GXTIN

Returns

A null GXTIN

Return type

GXTIN

range_xy(x_min, y_min, x_max, y_max)[source]

Find the range in X and Y of the TINned region.

Parameters

New in version 5.0.

License: Geosoft End-User License

Note: The TINned range is the range of X and Y covered by the GXTIN triangles. It can thus be less than the full X and Y range of the nodes themselves, if a full convex hull is not calculated.

serial(bf)[source]

Serialize GXTIN

Parameters

bf (GXBF) – GXBF in which to write GXTIN

New in version 5.0.

License: Geosoft End-User License

set_ipj(ipj)[source]

Set the projection.

Parameters

ipj (GXIPJ) – GXIPJ to place in the GXTIN

New in version 5.0.3.

License: Geosoft End-User License

triangles()[source]

Returns the number of triangles in the GXTIN.

Returns

The number of triangles in the GXTIN

Return type

int

New in version 5.0.

License: Geosoft End-User License