pygmi.vector.minc#

Minimum Curvature Gridding Routine.

Based on the work by:

Briggs, I. C., 1974, Machine contouring using minimum curvature, Geophysics vol. 39, No. 1, pp. 39-48

Functions#

minc(x, y, z, dxy, *[, showlog, extent, bdist, maxiters])

Minimum Curvature Gridding.

u_normal(u, i, j)

Minimum curvature smoothing for normal cases.

u_edge(u, i)

Minimum curvature smoothing for edges.

u_one_row_from_edge(u, i)

Minimum curvature smoothing for one row from edge.

u_corner(u)

Minimum curvature smoothing for corner point.

u_next_to_corner(u)

Minimum curvature smoothing for next to corner.

u_edge_next_to_corner(u)

Minimum curvature smoothing for edge next to corner.

off_grid(u, i, j, wn, b)

Node value calculation when data value is too far from node.

get_b(e5, n5)

Get b values for input data.

mcurv(u, ufixed)

Minimum curvature smoothing.

morg(x2, y2, z2, extent, dxy, rows, cols)

Organise coordinates and calculate b values.

Module Contents#

pygmi.vector.minc.minc(x, y, z, dxy, *, showlog=print, extent=None, bdist=None, maxiters=100)#

Minimum Curvature Gridding.

Parameters:
  • x (numpy array) – 1D array with x coordinates.

  • y (numpy array) – 1D array with y coordinates.

  • z (numpy array) – 1D array with z coordinates.

  • dxy (float) – Cell x and y dimension.

  • showlog (function, optional) – Routine to show text messages. The default is print.

  • extent (list, optional) – Extent defined as (left, right, bottom, top). The default is None.

  • bdist (float, optional) – Blanking distance in units of cell. The default is None.

  • maxiters (int, optional) – Maximum number of iterations. The default is 100.

Returns:

u – 2D numpy array with gridding z values.

Return type:

numpy array

pygmi.vector.minc.u_normal(u, i, j)#

Minimum curvature smoothing for normal cases.

It is defined as:

u[i+2, j] + u[i, j+2] + u[i-2, j] + u[i, j-2] + 2*(u[i+1, j+1] + u[i-1, j+1] + u[i+1, j-1] + u[i-1, j-1]) - 8*(u[i+1, j]+u[i-1, j]+u[i, j+1]+u[i, j-1]) + 20*u[i, j] = 0

Parameters:
  • u (numpy array) – 2D grid of z values.

  • i (int) – Current row.

  • j (int) – Current Column.

Returns:

uij – Smoothed value to replace in master grid.

Return type:

float

pygmi.vector.minc.u_edge(u, i)#

Minimum curvature smoothing for edges.

It is defined as:

u[i-2, j] + u[i+2, j] + u[i, j+2] + u[i-1, j+1] + u[i+1, j+1] - 4*(u[i-1, j] + u[i, j+1] + u[i+1, j]) + 7*u[i, j] = 0

Parameters:
  • u (numpy array) – 2D grid of z values.

  • i (int) – Current row.

Returns:

uij – Smoothed value to replace in master grid.

Return type:

float

pygmi.vector.minc.u_one_row_from_edge(u, i)#

Minimum curvature smoothing for one row from edge.

It is defined as:

u[i-2, j] + u[i+2, j] + u[i, j+2] + 2*(u[i-1, j+1] + u[i+1, j+1]) + u[i-1, j-1]+u[i+1, j-1] - 8*([i-1, j]+u[i, j+1]+u[i+1, j]) - 4*u[i, j-1] + 19*u[i, j] = 0

Parameters:
  • u (numpy array) – 2D grid of z values.

  • i (int) – Current row.

Returns:

uij – Smoothed value to replace in master grid.

Return type:

float

pygmi.vector.minc.u_corner(u)#

Minimum curvature smoothing for corner point.

It is defined as:

2*u[i, j]+u[i, j+2] + u[i+2, j] - 2*(u[i, j+1] + u[i+1, j] = 0

Parameters:

u (numpy array) – 2D grid of z values.

Returns:

uij – Smoothed value to replace in master grid.

Return type:

float

pygmi.vector.minc.u_next_to_corner(u)#

Minimum curvature smoothing for next to corner.

It is defined as:

u[i, j+2] + u[i+2, j] + u[i-1, j+1] + u[i+1, j-1] + 2*u[i+1, j+1] - 8*(u[i, j+1] + u[i+1, j]) - 4*([i, j-1]+u[i-1, j]) + 18*u[i, j] = 0

Parameters:

u (numpy array) – 2D grid of z values.

Returns:

uij – Smoothed value to replace in master grid.

Return type:

float

pygmi.vector.minc.u_edge_next_to_corner(u)#

Minimum curvature smoothing for edge next to corner.

It is defined as:

u[i, j+2] + u[i+1, j+1] + u[i-1, j+1] + u[i+2, j] - 2*u[i-1, j] - 4*(u[i+1, j] + u[i, j+1]) + 6*u[i, j] = 0

Parameters:

u (numpy array) – 2D grid of z values.

Returns:

uij – Smoothed value to replace in master grid.

Return type:

float

pygmi.vector.minc.off_grid(u, i, j, wn, b)#

Node value calculation when data value is too far from node.

Parameters:
  • u (numpy array) – 2D grid of z values.

  • i (int) – Current row.

  • j (int) – Current Column.

  • wn (float) – Data value.

  • b (list) – List of b values for calculation.

Returns:

uij – Output value.

Return type:

float

pygmi.vector.minc.get_b(e5, n5)#

Get b values for input data.

Calculates the b values based on the distance between the data point and the nearest node. Distances are expressed in units of cell.

Parameters:
  • e5 (float) – x distance error.

  • n5 (float) – y distance error.

Returns:

  • b1 (float) – b1 value.

  • b2 (float) – b2 value.

  • b3 (float) – b3 value.

  • b4 (float) – b4 value.

  • b5 (float) – b5 value.

pygmi.vector.minc.mcurv(u, ufixed)#

Minimum curvature smoothing.

This routine smooths the data between fixed data nodes.

Parameters:
  • u (numpy array) – 2D grid of z values.

  • ufixed (numpy array) – 2D grid of fixed node values.

Returns:

u – 2D grid of z values.

Return type:

numpy array

pygmi.vector.minc.morg(x2, y2, z2, extent, dxy, rows, cols)#

Organise coordinates and calculate b values.

Parameters:
  • x2 (numpy array) – 1D array with x coordinates.

  • y2 (numpy array) – 1D array with y coordinates.

  • z2 (numpy array) – 1D array with z coordinates.

  • extent (list) – Extent defined as (left, right, bottom, top).

  • dxy (float) – Cell x and y dimension.

  • rows (int) – Number of rows.

  • cols (int) – Number of columns.

Returns:

  • coords (list) – List containing iint, jint, r and zval.

  • b (list) – List of b values.