maptek.vulcan.isisdb

Functions for Vulcan Isis databases.


append()
 
append_buffer (isisdb self, std::string const & table_name, std::string const & buffer) → int
 
close()

Close the database, performing any pending write operations.

Note:  It is not valid to continue to use a database after it has been closed.

Returns int - 0 if successful, 1 otherwise.

Note:  It is always better to use a with statement to open a database since it consolidates the process of working with the database object. Also, when the script exits the with statement, the database will be closed automatically, removing the need to specifically call the close() function.

# Filename: isis_close.py
# Purpose: Closes a database and removes the lock after saving modifications.
# Returns: Null

from maptek import vulcan

# Opening and closing a database in this way is not very efficient.
db = vulcan.isisdb('thor5ft.cmp.isis', 'r')  # open database in read mode

# do something...
index = db.get_field_index('GEOCOD', 'ENTRY')
print(index)
db.close()  # save and close the database.

# A more efficient method is to use a WITH statement. A database is saved and
# closed upon exit of a WITH statement without the need to specifically call
# the open() and close() functions.
with vulcan.isisdb('thor5ft.cmp.isis', 'r') as db:
    index = db.get_field_index('GEOCOD', 'ENTRY')
    print(index)

delete_key(isisdb self, std::string const & key) → int

Delete any records belonging to a key from the database.

Parameter

  • key : str - The key to remove from the database. Wildcard matching supported.

Returns int - 0 if successful, 1 otherwise.

# Filename: isis_delete_key.py
# Purpose: Delete any records belonging to a key from the database.
# Returns: int - 0 if successful, 1 otherwise.

from maptek import vulcan

with vulcan.isisdb('thor5ft.cmp.isis', 'w') as db:  # open db in write mode
    db.goto_table('ENTRY')  # move to a specified table
    status = db.delete_key('2FT')  # delete records for 2FT key
    print(status)  # 0 if successful, 1 otherwise.

delete_record(isisdb self) → int

something.

field_list(table) -> list[str]

Get the list of fields within a table in the database.

Parameter

  • table name as string.

Returns list of field names.

# Filename: isis_field_list.py
# Purpose: Get the list of fields within a table in the database.
# Returns: list of fields in selected table.

from maptek import vulcan

with vulcan.isisdb('thor5ft.cmp.isis', 'r') as db:
    fields = db.field_list('ENTRY')
    print(fields)

field_list_numbers(table) -> list[str]

Get the list of numeric fields within a table in the database.

Parameter

  • table_name : str - The name of the table to list the fields of.

Returns a list of numeric fields.

# Filename: isis_field_list_numbers.py
# Purpose: Get the list of numeric fields within a table in the database.
# Returns: list of fields in selected table.

from maptek import vulcan

with vulcan.isisdb('thor5ft.cmp.isis', 'r') as db:  # open in read mode
    fields = db.field_list_numbers('ENTRY')
    print(fields)

field_list_strings(table) -> list[str]

Get the list of string fields within a table in the database.

Parameter

  • table_name : str - The name of the table to list the fields of.

Returns a list of string fields.

# Filename: isis_field_list_strings.py
# Purpose: Get the list of string fields within a table in the database.
# Returns: list of fields in selected table.

from maptek import vulcan

with vulcan.isisdb('thor5ft.cmp.isis', 'r') as db:  # open in read mode
    fields = db.field_list_strings('ENTRY')
    print(fields)

field_size(field, table) → int

Get the length (number of characters the field will contain) of a field.

Parameters:

  • field : str - The name of the field to get the size of.

  • table_name : str - The name of the table the field belongs to.

Returns the size of the field, or 0 if the field cannot be found.

# Filename: isis_field_size.py
# Purpose: Get the length of a field.
# Returns: int

from maptek import vulcan

with vulcan.isisdb('thor5ft.cmp.isis', 'r') as db:  # open in read mode
    table = 'ENTRY'
    fields = db.field_list_numbers(table)
    for field in fields:
        size = db.field_size(field, table)
        print(f'Field: {field}, Size: {size}')

find_key(key)

Move the current record to the first occurrence of a given key.

Parameter

  • The key to move to. Wildcard matching supported.

Returns int - 0 if successful, 1 otherwise.

# Filename: isis_find_key.py
# Purpose: Move the current record to the first occurrence of a given key.
# Returns: int - 0 if successful, 1 otherwise.

from maptek import vulcan

with vulcan.isisdb('thor5ft.cmp.isis', 'r') as db:
    key = db.find_key('5FT')  # 0 if successful, 1 otherwise.
    print(key)

Get the numeric value of a field in the current table, either by name or by index.

Parameters

  • name: str, optional - The name of the field to get the value of.

  • field_index : int, optional - The index of the field to get the value of.

Returns float - The value of the field.

Raises exception when an error occurs. Check the console for more information.

# Filename: isis_get.py
# Purpose: Get the numeric value of a field in the current table,
#          either by name or by index.
# Returns: float (value of the field)

from maptek import vulcan

with vulcan.isisdb('originaldrilling.dhd.isis', 'r') as db:

    # passing name as argument
    value = db.get('EASTING')
    print(f"Get value using field name: {value}")

    # passing index as argument
    value = db.get(1)
    print(f"Get value using field index: {value}")

get_coordinate(depth)

Get the coordinate of a drillhole at a given depth.

Parameter

  • depth : float - The depth to query the drillhole coordinates at.

Returns list[float] - The (X, Y, Z) position of the drillhole at the given depth.

# Filename: isis_get_coordinate.py
# Purpose: Get the coordinate of a drillhole at a given depth.
# Returns: list - the (X,Y,Z) position of the drillhole at the given depth.

from maptek import vulcan

with vulcan.isisdb('thor5ft.cmp.isis', 'r') as db:
    db.find_key('LK010')  # move to the specific drillhole
    coord = db.get_coordinate(100.0)  # find coordinate at depth of 100.0
    print(f'Coords:{coord}')

get_default(isisdb self, int field_id, int table_id) → double

Get the default value of a numeric field.

Parameters:

  • field_id : int or str - The name or index of the field to get the default value of.

  • table_id : int or str - The name or index of the table the field belongs to.

Returns float - The default value of the field.

# Filename: isis_get_default.py
# Purpose: Get the default value of a numeric field.
# Returns: float

from maptek import vulcan

with vulcan.isisdb('thor5ft.cmp.isis', 'r') as db:
    default = db.get_default('AU', 'ENTRY')
    print(default)

get_default_string(isisdb self, int field_id, int table_id) → std::string

Get the default value of a string field.

Parameters:

  • field_id : int or str - The name or index of the field to get the default value of.

  • table_id : int or str - The name or index of the table the field belongs to.

Returns str - The default value of the field.

# Filename: isis_get_default_string.py
# Purpose: Get the default value of a string field.
# Returns: str - The default value of the field.

from maptek import vulcan

with vulcan.isisdb('thor5ft.cmp.isis', 'r') as db:
    default = db.get_default_string('GEOCOD', 'ENTRY')
    print(default)

get_field_index(field, table)

Return the index of a field within a table.

Parameters:

  • name : str - The name of the field to search for.

  • table : str, optional - The name of the table to search in. Defaults to the table at the current record position.

Returns int - The index of the field.

Raises NameError if table not in database, or field not in table.

# Filename: isis_get_field_index.py
# Purpose: Return the index of a field within a table.
# Returns: int - The index of the field.

from maptek import vulcan

with vulcan.isisdb('thor5ft.cmp.isis', 'r') as db:
    index = db.get_field_index('AU', 'ENTRY')
    print(index)

get_key()

Get the key of the current record.

Returns str - The key of the current record.

# Filename: isis_get_key.py
# Purpose: Get the key of the current record.
# Returns: str - The key of the current record.

from maptek import vulcan

with vulcan.isisdb('thor5ft.cmp.isis', 'r') as db:
    key = db.get_key()
    print(key)
    
get_position(isisdb self) → double

Get the position of the current record.

Returns float - The position of the current record in the database, or -1 on error.

# Filename: isis_get_position.py
# Purpose: Get the position of the current record.
# Returns: float - The position of the current record, or -1 on error.

from maptek import vulcan

with vulcan.isisdb('thor5ft.cmp.isis', 'r') as db:
    db.goto_table('ENTRY')  # open selected table

    while not db.eof():  # iterate through entire table until the end
        position = db.get_position()
        print(position)
        db.next()  # advance to next record

Get the string value of a field in the current table, either by name or by index.

Parameters:

name: str, optional - The name of the field to get the value of.

field_index : int, optional - The index of the field to get the value of.

Returns str - The value of the field.

Raises exception when an error occurs. Check the console for more information.

# Filename: isis_get_string.py
# Purpose: Get the string value of a field in the current table,
#          either by name or by index.
# Returns: str - The value of the field.

from maptek import vulcan

with vulcan.isisdb('originaldrilling.dhd.isis', 'r') as db:
    string = db.get_string('HOLEID')
    print(f'Passing name as argument: {string}')

    string = db.get_string(0)
    print(f'Passing index as argument: {string}')

something.

get_table_index(table)

Get the index of a table in the database.

Parameter

  • name : str - The name of the table to get the index of.

Returns int - The index of the table if it exists, -1 otherwise.

# Filename: isis_get_table_index.py
# Purpose: Get the index of a table in the database.
# Returns: int - The index of the table if it exists, -1 otherwise.

from maptek import vulcan

with vulcan.isisdb('thor5ft.cmp.isis', 'r') as db:
    index = db.get_table_index('ENTRY')
    print(index)

get_table_name()

Get the table name of the current record.

Returns str - The table name of the current record.

# Filename: isis_get_table_name.py
# Purpose: Get the name of a table in the database.
# Returns: The table name of the current record.

from maptek import vulcan

with vulcan.isisdb('thor5ft.cmp.isis', 'r') as db:
    name = db.get_table_name()
    print(name)

goto_table(table)

This is a function that will move to a specified table name by moving to the beginning of the current key and finding the start of the specified table name.

Parameters

  • table : str - Table name to be found

Returns bool - True on success and position of current record is set.

Raises NameError when no table found with the matching name.

# Filename: isis_goto_table.py
# Purpose: This is a function that will move to a specified table name
#          by moving to the beginning of the current key and finding
#          the start of the specified table name.
# Returns: bool - True on success and position of current record is set.

from maptek import vulcan

with vulcan.isisdb('thor5ft.cmp.isis', 'r',) as db:
    status = db.goto_table('ENTRY')
    print(status)

has_dsr()

Check if the database contains DSR information.

Returns int - 1 if the database contains DSR information, 0 otherwise.

# Filename: isis_has_dsr.py
# Purpose: Check if the database contains DSR information.
# Returns: int - 1 if the database contains DSR information, 0 otherwise.

from maptek import vulcan

with vulcan.isisdb('originaldrilling.dhd.isis', 'r') as db:
    dsr = db.has_dsr()
    print(dsr)

insert_after(isisdb self) → int

something.

insert_before(isisdb self) → int

something.

is_field(field, table)

Check whether a field exists in a given table.

Parameters

  • field : str - The name of the field to check for existence.

  • table_name : str, optional - The name of the table to check for the field.

Note:  Defaults to the table at the current record position.

Returns bool - True if the field exists in the table, False otherwise.

# Filename: isis_is_field.py
# Purpose: Check whether a field exists in a given table.
# Returns: bool - True if the field exists in the table, False otherwise.

from maptek import vulcan

with vulcan.isisdb('thor5ft.cmp.isis', 'r') as db:
    field_exists = db.is_field('AU', 'ENTRY')
    print(field_exists)

is_number(field, table)

Check if a field is numeric.

Parameters

  • field : str - The name of the field to check is numeric.

  • table_name : str, optional - The name of the table to check for the numeric field.

Note:  Defaults to the table at the current record position.

Returns bool - True if the field is numeric, False otherwise.

# Returns True if field is numeric.

from maptek import vulcan

db_source = "originaldrilling.dhd.isis"

with vulcan.isisdb(db_source, 'r', '') as db:
    field = "DEPTH"
    table = "SURVEY"
    bool_results = db.is_number(field, table)
    print (f"{bool_results}")
				
>>> True
is_string(field, table)

Checks if field type is defined as is string.

# Returns True if field is a string.

from maptek import vulcan

db_source = "originaldrilling.dhd.isis"

with vulcan.isisdb(db_source, 'r', '') as db:
    field = "DEPTH"
    table = "SURVEY"
    bool_results = db.is_string(field, table)
    print (f"{bool_results}")
				
>>> False
key(key) or key("")

This is a generator to loop through the records in the current or specified key. If no key is provided, it will loop over the current key records. If a key name is provided, it will move until that key is found and return the records of that key. If no key is found, it will raise a NameError.

("" = current key)

# Filename: isis_key.py
# Purpose: This is a generator to loop through the records in the current
#          or specified key. If no key is provided, it will
#          loop over the current key records. If a key name is provided,
#          it will move until that key is found and return the records
#          of that key.
# Returns: Database index for the specified key.

from maptek import vulcan

with vulcan.isisdb('thor5ft.cmp.isis', 'r') as db:
    for record in db.key('5FT'):
        if db.get_table_name() == 'ENTRY':
            print(record['ORE'])

keys()

Generator to move through the records and return all the keys found in a database.

# Filename: isis_keys.py
# Purpose: Generator to move from one key to the next in an isisdb.
# Returns: Database index for each key.

from maptek import vulcan

with vulcan.isisdb('thor5ft.cmp.isis', 'r') as db:
    for key in db.keys:
        print(db.get_key())

key_list()

Create a list of keys found in a database.

# Filename: isis_key_list.py
# Purpose: Get the list of keys from the current database.
# Returns: list[str] - The keys in the database.

from maptek import vulcan

with vulcan.isisdb('thor5ft.cmp.isis', 'r') as db:
    list_of_db_keys = db.key_list()
    print(list_of_db_keys)

next(isisdb self) → int

something.

next_key(isisdb self) → int

something.

next_same_key(isisdb self) → int

something.

put(isisdb self, std::string const & name, double v)

something.

put(isisdb self, std::string const & name, std::string const & v)

something.

put(isisdb self, int field_index, double v)

something.

put_string(isisdb self, std::string const & name, std::string const & v)

something.

put_string(isisdb self, std::string const & name, double v)

something.

put_string(isisdb self, int field_index, std::string const & v)

something.

put_table_name(isisdb self, std::string const & rec_type) → int

something.

rewind(isisdb self) → int

something.

set_position(isisdb self, double pos) → int

something.

synonym(isisdb self, std::string const & db_type, std::string const & name) → std::string

something.

table_list()

Creates a list of the tables found in a database.

# Filename: isis_table_list
# Purpose: Get the list of tables in the database.
# Returns: list[str] - The names of the tables in the database.

from maptek import vulcan

with vulcan.isisdb('thor5ft.cmp.isis', 'r') as db:
    tables = db.table_list()
    for table in tables:
        print(table)

this_key()

Generator to move through the records of the current key from the beginning of the key.

# Filename: isis_this_key.py
# Purpose: Get the current position key.
# Returns: str - The key at the current record position.

from maptek import vulcan

with vulcan.isisdb('thor5ft.cmp.isis', 'r') as db:
    for record in db.this_key:
        if db.get_table_name() == 'ENTRY':
            print(record['ORE'])

this_table(table)

This is a generator to loop in the current or specified table of the current key. If no table is provided, it will loop over the current table. If a table name is provided, it will move until that table is found and return the results of that table. If no table is found, it will return nothing.

# Filename: isis_this_table.py
# Purpose: This is a generator to loop in the current or specified
#          table of the current key. If no table is provided, it will
#          loop over the current table. If a table name is provided,
#          it will move until that table is found and return the results
#          of that table.
#          If no table is found, it will return nothing.
# Returns: Database index for the specified table.

from maptek import vulcan

with vulcan.isisdb('thor5ft.cmp.isis', 'r') as db:
    for record in db.this_table('ENTRY'):
        print(record['DEPTH'])

write(isisdb self) → int

something.