GXTB class¶
-
class
geosoft.gx.
GXTB
¶ The TB class is a high-performance table class used to perform table-based processing, such as leveling data in an OASIS database. The LTB class is recommended for use with small tables produced from short lists such as the different geographic projections and their defining parameters.
-
static
create
((GXContext)ctx, (str)arg1) → GXTB:¶ Loads a table into memory and return a table handle.
Parameters: - ctx (
geosoft.gx.GXContext
) – The GX execution context - arg1 (str) – Name of the table file to load
Returns: TB Object
Return type: New in version 5.0.0.
Note:
If the table contains fewer data columns than are defined by the the table header, the TB object will read in the table and dummy the elements of the missing data columns.
- ctx (
-
static
create_db
((GXContext)ctx, (GXDB)arg1) → GXTB:¶ Create a table from a database.
Parameters: - ctx (
geosoft.gx.GXContext
) – The GX execution context - arg1 (
geosoft.gx.GXDB
) – Database
Returns: TB Object
Return type: New in version 5.0.0.
Note:
The table will contain fields for all channels in the database. The database is not loaded with data. Use the
geosoft.gx.GXTB.load_db()
function to load data into the table.- ctx (
-
static
create_ltb
((GXContext)ctx, (GXLTB)arg1) → GXTB:¶ Create a table from an LTB database.
Parameters: - ctx (
geosoft.gx.GXContext
) – The GX execution context - arg1 (
geosoft.gx.GXLTB
) – LTB object
Returns: TB Object
Return type: New in version 5.0.0.
- ctx (
-
data_type
((int)arg1) → int:¶ Returns the data type for the specified column.
Parameters: arg1 (int) – Column of element to Get Returns: DB_CATEGORY_CHAN constants Return type: int New in version 5.0.1.
-
field
((str)arg1) → int:¶ Get a field handle.
Parameters: arg1 (str) – Field name Returns: The handle to the field (must be present) Return type: int New in version 5.0.0.
-
find_col_by_index
((int)arg1, (str_ref)arg2) → None:¶ Finds a column's name by its index.
Parameters: - arg1 (int) – Index of column to find
- arg2 (
geosoft.gx.str_ref
) – Buffer for column name
Returns: Nothing
Return type: None
New in version 5.1.6.
-
find_col_by_name
((str)arg1) → int:¶ Finds a column's index by its name.
Parameters: arg1 (str) – Name of column to find Returns: Index of column. -1 if not found. Return type: int New in version 5.0.0.
-
format
((int)arg1) → int:¶ Returns the channel format for the specified column.
Parameters: arg1 (int) – Column of element to Get Returns: DB_CHAN_FORMAT constants Return type: int New in version 5.0.1.
-
get_double
((int)arg1, (int)arg2) → float:¶ Gets an real value from a table element.
Parameters: - arg1 (int) – Row of element to Get
- arg2 (int) – Column of element to Get
Returns: Value
Return type: float
New in version 5.0.0.
-
get_int
((int)arg1, (int)arg2) → int:¶ Gets an integer value from a table element.
Parameters: - arg1 (int) – Row of element to Get
- arg2 (int) – Column of element to Get
Returns: Value
Return type: int
New in version 5.0.0.
-
get_string
((int)arg1, (int)arg2, (str_ref)arg3) → None:¶ Gets a string value from a table element.
Parameters: - arg1 (int) – Row of element to Get
- arg2 (int) – Column of element to Get
- arg3 (
geosoft.gx.str_ref
) – returned string
Returns: Nothing
Return type: None
New in version 5.0.0.
-
is_null
() → bool¶ Check if the instance of
geosoft.gx.GXTB is null (undefined)
Returns: True if this is a null instance of geosoft.gx.GXTB
, False otherwise.Return type: bool`
-
load_db
((GXDB)arg1, (int)arg2) → None:¶ Load a database into a TB
Parameters: - arg1 (
geosoft.gx.GXDB
) – database - arg2 (int) – line
Returns: Nothing
Return type: None
New in version 5.0.0.
Note:
The line is appended to the data already in the table.
- arg1 (
-
static
null
() → GXTB¶ A null (undefined) instance of
geosoft.gx.GXTB
Returns: A null geosoft.gx.GXTB
Return type: geosoft.gx.GXTB
-
num_columns
() → int:¶ Gets the number of data fields (columns) in a table.
Returns: Number of columns Return type: int New in version 5.0.0.
-
num_rows
() → int:¶ Gets the number of data rows in a table.
Returns: Number of rows Return type: int New in version 5.0.0.
-
save
((str)arg1) → None:¶ Saves the data in a table to a file. The table header will be in ASCII and the data will be in BINARY format.
Parameters: arg1 (str) – Name of File to save table into Returns: Nothing Return type: None New in version 5.0.0.
-
save_db
((GXDB)arg1, (int)arg2) → None:¶ Save a TB in a database line
Parameters: - arg1 (
geosoft.gx.GXDB
) – database - arg2 (int) – line
Returns: Nothing
Return type: None
New in version 5.0.0.
Note:
Missing channels are created. Data in existing channels on the line will be replaced.
- arg1 (
-
save_to_ascii
((str)arg1) → None:¶ Saves the data in a table to a file. The table header will be in ASCII and the data will be in ASCII format.
Parameters: arg1 (str) – Name of File to save table into Returns: Nothing Return type: None New in version 5.0.0.
-
set_double
((int)arg1, (int)arg2, (float)arg3) → None:¶ Sets an real value into a table element.
Parameters: - arg1 (int) – Row of element to set
- arg2 (int) – Column of element to set
- arg3 (float) – Value to set
Returns: Nothing
Return type: None
New in version 5.0.0.
Note:
The table field containing the element to be set MUST be of type GS_FLOAT or GS_DOUBLE. If the field is GS_FLOAT the new data value will cause an overflow if the value is out of range of the data type. The new element value will then be invalid. If the row of the new element exceeds the number of rows in the table, then the table will AUTOMATICALLY be EXPANDED to exactly as many rows needed to hold the new element. The new element is placed in the proper field of the last row, and all other field elements have invalid data. All fields of the new rows up to the new element's row will also contain invalid data.
-
set_int
((int)arg1, (int)arg2, (int)arg3) → None:¶ Sets an integer value into a table element.
Parameters: - arg1 (int) – Row of element to set
- arg2 (int) – Column of element to set
- arg3 (int) – Value to set
Returns: Nothing
Return type: None
New in version 5.0.0.
Note:
The table field containing the element to be set MUST be of type GS_BYTE, GS_USHORT, GS_SHORT, or GS_LONG. If the field is GS_BYTE, GS_USHORT, or GS_LONG, the new data value will cause an overflow if the value is out of range of the data type. The new element value will then be invalid. If the row of the new element exceeds the number of rows in the table, then the table will AUTOMATICALLY be EXPANDED to exactly as many rows needed to hold the new element. The new element is placed in the proper field of the last row, and all other field elements have invalid data. All fields of the new rows up to the new element's row will also contain invalid data.
-
set_search_mode
((int)arg1) → None:¶ Set the search mode of a table.
Parameters: arg1 (int) – TB_SEARCH constants Returns: Nothing Return type: None New in version 5.0.0.
Note:
If performance is an issue, you may want to test which search mode provides the best performance with typical data.
-
set_string
((int)arg1, (int)arg2, (str)arg3) → None:¶ Sets a string value into a table element.
Parameters: - arg1 (int) – Row of element to set
- arg2 (int) – Column of element to set
- arg3 (str) – Value to set
Returns: Nothing
Return type: None
New in version 5.0.0.
Note:
The table field containing the element to be set MUST be of 'string'. If the row of the new element exceeds the number of rows in the table, then the table will AUTOMATICALLY be EXPANDED to exactly as many rows needed to hold the new element. The new element is placed in the proper field of the last row, and all other field elements have invalid data. All fields of the new rows up to the new element's row will also contain invalid data.
-
sort
((int)arg1) → None:¶ Sorts a table by a specified column.
Parameters: arg1 (int) – Index of data Column to sort table by Returns: Nothing Return type: None New in version 5.0.0.
Note:
If the column to sort by contains duplicated values, the sorted table is NOT guaranteed to retain the ordering of the duplicated values/ E.g. Given 2 rows of values: xx yy 1 bb aa 1 If the table is sorted on column 3, the second row may or may not come after the first row in the sorted table.
-
static