maptek.vulcan.isisdb

Functions for Vulcan Isis databases.


Functions

append()

# Comment

from maptek import vulcan

db = vulcan.isisdb("editeddrilling.dhd.isis")

# Do something...

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

# Comment

from maptek import vulcan

db = vulcan.isisdb("editeddrilling.dhd.isis")

# Do something...

close()

Closes a database after saving any modifications and removes the lock.

# Open and close a database.

from maptek import vulcan

db = vulcan.isisdb("originaldrilling.dhd.isis")

# Do something...

db.close()

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

# Comment

from maptek import vulcan

db = vulcan.isisdb("editeddrilling.dhd.isis")

# Do something...

delete_record (isisdb self) → int

# Comment

from maptek import vulcan

db = vulcan.isisdb("editeddrilling.dhd.isis")

# Do something...

field_index(field, table)

Returns the one-based index number of field.

Note:  Python begins with zero (0, 1, 2, 3...) when counting items. This function will begin counting with 1.

# Returns the one-based index number of field.
# [1, 2, 3, ... ]

from maptek import vulcan

db_source = "originaldrilling.dhd.isis"

with vulcan.isisdb(db_source, 'r', '') as db:
    field = "DIP"
    table = "SURVEY"
    index = db.field_index(field, table)
    print (f"{index}")
				
>>> 3

field_list(table)

Create a list of database fields.

# Create a list of fields found in each table of the database.

from maptek import vulcan

db_source = "originaldrilling.dhd.isis"

with vulcan.isisdb(db_source, 'r', '') as db:
    table = "SURVEY"
    fields = db.field_list(table)
    print (f"{fields}")

>>> ['DEPTH', 'AZIMUTH', 'DIP']

field_list_numbers(table)

Outputs the numeric fields found in a database as a list.

# Create a list of numeric tables found in the database.

from maptek import vulcan

db_source = "originaldrilling.dhd.isis"

with vulcan.isisdb(db_source, 'r', '') as db:
    table = "SURVEY"
    fields = db.field_list_numbers(table)
    print (f"{fields}")

>>> ['DEPTH', 'AZIMUTH', 'DIP']

field_list_strings(table)

Outputs the string fields found in a database as a list.

# Create a list of string tables found in the database.

from maptek import vulcan

db_source = "originaldrilling.dhd.isis"

with vulcan.isisdb(db_source, 'r', '') as db:
    table = "COLLAR"
    fields = db.field_list_strings(table)
    print (f"{fields}")

>>> ['HOLEID']

field_size(field, table)

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

# Returns the size of the AU field in the ASSAY table.

from maptek import vulcan

db_source = "originaldrilling.dhd.isis"

with vulcan.isisdb(db_source, 'r', '') as db:
    field = "AU"
    table = "ASSAY"
    size = db.field_size(field, table)
    print (f"{size}")
				
>>> 12

find_key(key)

Forces a move to a specific key. This function is similar to a boolean function, but a little different. If will return a zero if it finds the key, then position you at the beginning of that key (first table, first record).

# Print 'Key has been found.' if key is found, and 'Key does not exist.' if key is not found.

from maptek import vulcan

db_source = "originaldrilling.dhd.isis"
key = "LK177"

with vulcan.isisdb(db_source, 'r', '') as db:
    if db.find_key(key) == 0:
        print("Key has been found.")
    else:
        print("Key does not exist.")
				
>>> Key has been found.

get (isisdb self, std::string const & name) → double

get (isisdb self, int field_index) → double

# Comment

from maptek import vulcan

db = vulcan.isisdb("editeddrilling.dhd.isis")

# Do something...

get_buffer (isisdb self) → std::string

# Comment

from maptek import vulcan

db = vulcan.isisdb("editeddrilling.dhd.isis")

# Do something...

get_coordinate(depth)

Returns the downhole survey record coordinates of the selected depth as a list.

# Prints the max depth of drillhole and generates a list of the coordinates at that depth.

from maptek import vulcan

db_source = "originaldrilling.dhd.isis"
drillhole = "LK010"
total_depth_field = "TOT_DEPTH"
survey_table = "SURVEY"
depth_field = "DEPTH"

with vulcan.isisdb(db_source, 'r', '') as db:
    if not db.has_dsr():
        print ("No dsr data available")
        exit()
    db.find_key(drillhole) # Force a move to the specific drillhole
    depth = 0.0
    end = None

    # find max hole depth
    if db.is_field(total_depth_field):
        end = db[total_depth_field]
    else:
        start = False
        for row in db:
            table = db.get_table_name()
            if table == survey_table:
                # Once survey has been hit, stop updating the end depth if the table changes
                start = True
                end = db[depth_field]
            elif start:
                break

    print (f"Max hole depth:{end}")
    stop = False
    while True:
        # Go to end by total depth
        if end is not None and depth > end:
            # Update the last to be the end of hole
            # Note: This will keep providing depths based on the last segment.
            depth = end
            stop = True
        coord = db.get_coordinate(depth)
        depth += 50.0
        if stop:
            print (f"Coords:{coord}")
            break
				

>>> Max hole depth:184.0
>>> Coords:[24.461534057741652, -52.01947522415403, -174.1941677292476]

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

# Comment

from maptek import vulcan

db = vulcan.isisdb("editeddrilling.dhd.isis")

# Do something...

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

# Comment

from maptek import vulcan

db = vulcan.isisdb("editeddrilling.dhd.isis")

# Do something...

get_field_index(field, table)

Returns a zero based field index. Python begins with zero (0, 1, 2, 3...) when counting items.

# Returns the index number of field.

from maptek import vulcan

db_source = "originaldrilling.dhd.isis"

with vulcan.isisdb(db_source, 'r', '') as db:
    field = "DIP"
    table = "SURVEY"
    index = db.get_field_index(field, table)
    print (f"{index}")
				
>>> 2

get_key()

Returns the first key found.

# Returns the first key found.

from maptek import vulcan

db_source = "blockmodel.cmp.isis"

with vulcan.isisdb(db_source, 'r', '') as db:
    key = db.get_key()
    print(f"{key}")
				
>>> BLOCK

get_position (isisdb self) → double

# Comment

from maptek import vulcan

db = vulcan.isisdb("editeddrilling.dhd.isis")

# Do something...

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

get_string (isisdb self, int field_index) → std::string

# Comment

from maptek import vulcan

db = vulcan.isisdb("editeddrilling.dhd.isis")

# Do something...

get_subtype (isisdb self) → std::string

# Comment

from maptek import vulcan

db = vulcan.isisdb("editeddrilling.dhd.isis")

# Do something...

get_table_index(table)

Returns a zero based table index. Python begins with zero (0, 1, 2, 3...) when counting items.

# Returns the index number of table.

from maptek import vulcan

db_source = "originaldrilling.dhd.isis"

with vulcan.isisdb(db_source, 'r', '') as db:
    table = "SURVEY"
    index = db.get_table_index(table)
    print (f"{index}")
				
>>> 1

get_table_name()

Returns the name of the first table found.

# Returns the name of the first table found.

from maptek import vulcan

db_source = "originaldrilling.dhd.isis"

with vulcan.isisdb(db_source, 'r', '') as db:
    name = db.get_table_name()
    print (f"{name}")
				
>>> COLLAR

goto_table(table)

This function will move to a specified table by moving to the beginning of the current key, then find the start of the table. If no table is found, it will raise NameError.

# Goes to a requested table name

from maptek import vulcan

db_source = "originaldrilling.dhd.isis"

with vulcan.isisdb(db_source, 'r', '') as db:
    if db.goto_table("SURVEY"):
        print("TRUE")

>>> TRUE

has_dsr()

Checks to verify if downhole survey record exists. Returns '1' if true, '0' is false.

# Checks to verify if downhole survey record exists. Returns '1' if true, '0' is false.

from maptek import vulcan

db_source = "originaldrilling.dhd.isis"

with vulcan.isisdb(db_source, 'r', '') as db:
    dsr = db.has_dsr()
    print(f"{dsr}")

>>> 1

insert_after (isisdb self) → int

# Comment

from maptek import vulcan

db = vulcan.isisdb("editeddrilling.dhd.isis")

# Do something...

insert_before (isisdb self) → int

# Comment

from maptek import vulcan

db = vulcan.isisdb("editeddrilling.dhd.isis")

# Do something...

is_field(field, table)

This is a boolean function that checks if field exists in table.

# Returns True if DEPTH field exists in SURVEY table.

from maptek import vulcan

db_source = "originaldrilling.dhd.isis"

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

is_number(field, table)

Checks if field type is defined as numeric.

# 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)

# Prints the contents of the depth field for the current key on the table SURVEY.

from maptek import vulcan

db_source = "originaldrilling.dhd.isis"

with vulcan.isisdb(db_source, 'r', '') as db:
    for record in db.key("LK177"):
        if db.get_table_name() == "SURVEY":
            depth = record['DEPTH']
            print(f"{depth}")
				
>>> 0.0
>>> 2.0
>>> 10.0
>>> 20.0
>>> 30.0
>>> ...

keys()

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

# Iterates through all the keys in a database and prints the key names.

from maptek import vulcan

db_source = "originaldrilling.dhd.isis"

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

>>> LK010
>>> LK011
>>> LK012
>>> LK013
>>>  ...

key_list()

Create a list of keys found in a database.

# Generates a list of all the keys in a database and prints the key names.

from maptek import vulcan

db_source = "originaldrilling.dhd.isis"

with vulcan.isisdb(db_source, 'r', '') as db:
    db_key = db.key_list()
    print(f"{db_key}")

>>> ['LK010', 'LK011', 'LK012', ...]

next(isisdb self) → int

# Comment

from maptek import vulcan

db = vulcan.isisdb("editeddrilling.dhd.isis")

# Do something...

next_key(isisdb self) → int

# Comment

from maptek import vulcan

db = vulcan.isisdb("editeddrilling.dhd.isis")

# Do something...

next_same_key(isisdb self) → int

# Comment

from maptek import vulcan

db = vulcan.isisdb("editeddrilling.dhd.isis")

# Do something...

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

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

put(isisdb self, int field_index, double v)

# Comment

from maptek import vulcan

db = vulcan.isisdb("editeddrilling.dhd.isis")

# Do something...

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

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

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

# Comment

from maptek import vulcan

db = vulcan.isisdb("editeddrilling.dhd.isis")

# Do something...

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

# Comment

from maptek import vulcan

db = vulcan.isisdb("editeddrilling.dhd.isis")

# Do something...

rewind(isisdb self) → int

# Comment

from maptek import vulcan

db = vulcan.isisdb("editeddrilling.dhd.isis")

# Do something...

set_position(isisdb self, double pos) → int

# Comment

from maptek import vulcan

db = vulcan.isisdb("editeddrilling.dhd.isis")

# Do something...

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

# Comment

from maptek import vulcan

db = vulcan.isisdb("editeddrilling.dhd.isis")

# Do something...

table_list()

Creates a list of the tables found in a database.

# Prints a list of tables found in the database.

from maptek import vulcan

db_source = "originaldrilling.dhd.isis"

with vulcan.isisdb(db_source, 'r', '') as db:
    tables = db.table_list()
    print (f"{tables}")

>>> ['COLLAR', 'SURVEY', 'ASSAY', 'STRUCT']

this_key()

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

# Prints the contents of the depth field for the current key on the table SURVEY.

from maptek import vulcan

db_source = "originaldrilling.dhd.isis"

with vulcan.isisdb(db_source, 'r', '') as db:
    for record in db.this_key:
        if db.get_table_name() == "SURVEY":
            depth = record['DEPTH']
            print(f"{depth}")
				
>>> 0.0
>>> 2.0
>>> 10.0
>>> 20.0
>>> 30.0
>>> ...  

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.

# Prints the contents of the depth field for the survey table (on the current key).

from maptek import vulcan

db_source = "originaldrilling.dhd.isis"

with vulcan.isisdb(db_source, 'r', '') as db:
    for record in db.this_table("SURVEY"):
        depth = record['DEPTH']
        print(f"{depth}")
				
>>> 0.0
>>> 2.0
>>> 10.0
>>> 20.0
>>> 30.0
>>> ...

write(isisdb self) → int

# Comment

from maptek import vulcan

db = vulcan.isisdb("editeddrilling.dhd.isis")

# Do something...