GXPG class

class GXPG(handle=0)

GXPG class.

Pager methods for large 2-D arrays This class handles very-large 2-D arrays in which efficient access is required along both rows and columns.

Note:

Typically a grid is accessed using the GXIMG class, and a GXPG is obtained from the GXIMG using the GXIMG.get_pg function. Following operations on the GXPG, it can be written back to the GXIMG using GXIMG.set_pg.

copy(pgs)

Copy the data from one pager to another.

Parameters:pgs (GXPG) – Source GXPG object

New in version 5.0.

License: Geosoft Open License

copy_subset(pgs, y_row_d, x_col_d, y_row_s, x_col_s, ny, nx)

Copy a subset of data from one pager to another.

Parameters:
  • pgs (GXPG) – Source GXPG object
  • y_row_d (int) – Y (row) Origin on destination
  • x_col_d (int) – X (col) Origin on destination
  • y_row_s (int) – Y (row) Origin on source
  • x_col_s (int) – X (col) Origin on source
  • ny (int) – Number of Y (rows) to copy
  • nx (int) – Number of X (columns) to copy

New in version 5.0.

License: Geosoft Open License

Note: 2D Only

copy_subset_3d(pgs, sliced, n, vv, slices, rows, cols, n_slice, n_row, n_col)

Copy a subset of data from one pager to another.

Parameters:
  • pgs (GXPG) – Source GXPG object
  • sliced (int) – Z (slice) Origin on destination
  • n (int) – Y (row) Origin on destination
  • vv (int) – X (col) Origin on destination
  • slices (int) – Z (slice) Origin on source
  • rows (int) – Y (row) Origin on source
  • cols (int) – X (col) Origin on source
  • n_slice (int) – Number of Z (slice) to copy
  • n_row (int) – Number of Y (rows) to copy
  • n_col (int) – Number of X (columns) to copy

New in version 8.0.

License: Geosoft End-User License

Note: 2D Only

classmethod create(row, col, type)

Creates a Pager object

Parameters:
  • row (int) – # elements in y (# of row)
  • col (int) – # elements in x (# of column)
  • type (int) – GS_TYPES constants
Returns:

GXPG Object

Return type:

GXPG

New in version 5.0.

License: Geosoft Open License

classmethod create_3d(slice, row, col, type)

Creates a Pager object

Parameters:
  • slice (int) – # elements in z (# of slices)
  • row (int) – # elements in y (# of row)
  • col (int) – # elements in x (# of column)
  • type (int) – GS_TYPES constants
Returns:

GXPG Object

Return type:

GXPG

New in version 6.2.

License: Geosoft End-User License

classmethod create_s(bf)

Create a 2D GXPG from serialized source.

Returns:GXPG Object
Return type:GXPG

New in version 5.0.

License: Geosoft Open License

Note: For 3D pagers, use CreateBF_PG.

dummy()

Sets the Entire pager to dummy.

New in version 5.0.

License: Geosoft Open License

e_type()

Gets the type of pager.

Returns:GS_TYPES constants
Return type:int

New in version 5.0.

License: Geosoft Open License

get(col, row)

Read a single value from a 2D GXPG

Parameters:
  • col (int) – iBx - element # in x (column #)
  • row (int) – iBy - element # in y (row #)
Return type:

float

New in version 8.3.

License: Geosoft Open License

Note: This is a low-performance method.

is_null()

Check if this is a null (undefined) instance

Returns:True if this is a null (undefined) instance, False otherwise.
Return type:bool
n_cols()

Gets the # of columns in pager.

Returns:# of columns.
Return type:int

New in version 5.0.

License: Geosoft Open License

n_rows()

Gets the # of rows in pager.

Returns:# of rows.
Return type:int

New in version 5.0.

License: Geosoft Open License

n_slices()

Gets the # of slices (z) in pager.

Returns:# of rows.
Return type:int

New in version 6.2.

License: Geosoft Open License

classmethod null()

A null (undefined) instance of GXPG

Returns:A null GXPG
Return type:GXPG
range(min, max)

Computes the range of the entire pager.

Parameters:
  • min (float_ref) – Minimum Data (Dummy if no range)
  • max (float_ref) – Maximum Data (Dummy if no range)

New in version 5.0.

License: Geosoft Open License

re_allocate(n_row, n_col)

Changes the size of Pager

Parameters:
  • n_row (int) – Number of Y (rows) to reallocate
  • n_col (int) – Number of X (columns) to reallocate

New in version 5.0.

License: Geosoft Open License

re_allocate_3d(n_slice, n_row, n_col)

Changes the size of 3D Pager

Parameters:
  • n_slice (int) – Number of Z (slices) to reallocate
  • n_row (int) – Number of Y (rows) to reallocate
  • n_col (int) – Number of X (columns) to reallocate

New in version 6.2.

License: Geosoft End-User License

read_bf(bf, dir, conv, rev_x, rev_y, rev_z)

Read the contents of a 2D or 3D pager to from a GXBF.

Parameters:

New in version 6.2.

License: Geosoft End-User License

read_col(col, o, n, vv)

Read a set of elements in X (column) from pager into vv

Parameters:
  • col (int) – iBx - element # in x (column #)
  • o (int) – iBy - begining element # in y to read (0 is the first)
  • n (int) – iNy - # elements to read (0 for whole vector)
  • vv (GXVV) – hVV - GXVV handle

New in version 5.0.

License: Geosoft Open License

read_col_3d(slice, col, o, n, vv)

Read a set of elements in X (column) from pager into vv

Parameters:
  • slice (int) – iBz - element # in z (slice #)
  • col (int) – iBx - element # in x (column #)
  • o (int) – iBy - begining element # in y to read (0 is the first)
  • n (int) – iNy - # elements to read (0 for whole vector)
  • vv (GXVV) – hVV - GXVV handle

New in version 6.2.

License: Geosoft End-User License

read_ra(ra, dir, rev_x, rev_y, rev_z, dummy)

Read the contents of a 2D or 3D pager to from an GXRA.

Parameters:
  • ra (GXRA) – GXRA to read from
  • dir (int) – PG_3D_DIR constants
  • rev_x (int) – Reverse X
  • rev_y (int) – Reverse Y
  • rev_z (int) – Reverse Z
  • dummy (str) – Dummy

New in version 6.2.

License: Geosoft End-User License

Note: Each line must hold only 1 value

read_row(row, o, n, vv)

Read a set of elements in Y (row) from pager into vv

Parameters:
  • row (int) – iBy - element # in y (row #)
  • o (int) – iBx - begining element # in x to read (0 is the first)
  • n (int) – iNx - # elements to read (0 for whole vector)
  • vv (GXVV) – hVV - GXVV handle

New in version 5.0.

License: Geosoft Open License

read_row_3d(slice, row, o, n, vv)

Read a set of elements in Y (row) from pager into vv

Parameters:
  • slice (int) – iBz - element # in z (slice #)
  • row (int) – iBy - element # in y (row #)
  • o (int) – iBx - begining element # in x to read (0 is the first)
  • n (int) – iNx - # elements to read (0 for whole vector)
  • vv (GXVV) – hVV - GXVV handle

New in version 6.2.

License: Geosoft End-User License

read_trace_3d(col, row, o, n, vv)

Read a set of elements in Z (trace) from pager into vv

Parameters:
  • col (int) – iBx - element # in x (column #)
  • row (int) – iBy - element # in y (row #)
  • o (int) – iBy - begining element # in z to read (0 is the first)
  • n (int) – iNy - # elements to read (0 for whole vector)
  • vv (GXVV) – hVV - GXVV handle

New in version 6.3.

License: Geosoft End-User License

serial(bf)

Serialize a 2D GXPG to a GXBF.

New in version 5.0.

License: Geosoft Open License

Note: For 3D pagers, use write_bf.

statistics(st)

Compute the statistics of a pager object.

Parameters:st (GXST) – hST - statistics object

New in version 6.3.1.

License: Geosoft End-User License

write_bf(bf, dir, conv, rev_x, rev_y, rev_z)

Write the contents of a 2D or 3D pager to a GXBF.

Parameters:

New in version 6.2.

License: Geosoft End-User License

write_bf_ex(bf, dir, conv, rev_x, rev_y, rev_z, p_dummy)

Write the contents of a 2D or 3D pager to a GXBF.

Parameters:

New in version 9.3.

License: Geosoft End-User License

write_col(col, o, n, vv)

Write a set of elements in X (column) from vv into pager

Parameters:
  • col (int) – iBx - element # in x (column #)
  • o (int) – iBy - begining element # in y to write (0 is the first)
  • n (int) – iNy - # elements to write (0 for whole vector)
  • vv (GXVV) – hVV - GXVV handle

New in version 5.0.

License: Geosoft Open License

write_col_3d(slice, col, o, n, vv)

Write a set of elements in X (column) from vv into pager

Parameters:
  • slice (int) – iBz - element # in z (slice #)
  • col (int) – iBx - element # in x (column #)
  • o (int) – iBy - begining element # in y to write (0 is the first)
  • n (int) – iNy - # elements to write (0 for whole vector)
  • vv (GXVV) – hVV - GXVV handle

New in version 6.2.

License: Geosoft End-User License

write_row(row, o, n, vv)

Write a set of elements in Y (row) from vv into pager

Parameters:
  • row (int) – iBy - element # in y (row #)
  • o (int) – iBx - begining element # in x to write (0 is the first)
  • n (int) – iNx - # elements to write (0 for whole vector)
  • vv (GXVV) – hVV - GXVV handle

New in version 5.0.

License: Geosoft Open License

write_row_3d(slice, row, o, n, vv)

Write a set of elements in Y (row) from vv into pager

Parameters:
  • slice (int) – iBz - element # in z (slice #)
  • row (int) – iBy - element # in y (row #)
  • o (int) – iBx - begining element # in x to write (0 is the first)
  • n (int) – iNx - # elements to write (0 for whole vector)
  • vv (GXVV) – hVV - GXVV handle

New in version 6.2.

License: Geosoft End-User License

write_trace_3d(col, row, o, n, vv)

Write a set of elements in Z (trace) from pager into vv

Parameters:
  • col (int) – iBx - element # in x (column #)
  • row (int) – iBy - element # in y (row #)
  • o (int) – iBy - begining element # in z to read (0 is the first)
  • n (int) – iNy - # elements to read (0 for whole vector)
  • vv (GXVV) – hVV - GXVV handle

New in version 6.3.

License: Geosoft End-User License

write_wa(wa, dir, rev_x, rev_y, rev_z, dummy)

Write the contents of a 2D or 3D pager to a GXWA

Parameters:
  • wa (GXWA) – GXWA to write to
  • dir (int) – PG_3D_DIR constants
  • rev_x (int) – Reverse X
  • rev_y (int) – Reverse Y
  • rev_z (int) – Reverse Z
  • dummy (str) – Dummy

New in version 6.2.

License: Geosoft Open License

Note: Each line will hold only 1 value

PG_3D_DIR constants

3D Pager direction

PG_3D_DIR_XYZ

Xyz

gxapi.PG_3D_DIR_XYZ = 0
PG_3D_DIR_YXZ

Yxz

gxapi.PG_3D_DIR_YXZ = 1
PG_3D_DIR_XZY

Xzy

gxapi.PG_3D_DIR_XZY = 2
PG_3D_DIR_YZX

Yzx

gxapi.PG_3D_DIR_YZX = 3
PG_3D_DIR_ZXY

Zxy

gxapi.PG_3D_DIR_ZXY = 4
PG_3D_DIR_ZYX

Zyx

gxapi.PG_3D_DIR_ZYX = 5

PG_BF_CONV constants

Pager binary conversions

PG_BF_CONV_NONE

The Data is in Raw form

gxapi.PG_BF_CONV_NONE = 0
PG_BF_CONV_SWAP

The data needs to be byte swapped

gxapi.PG_BF_CONV_SWAP = 1