maptek.vulcan module
This module provides access to Vulcan functionality that does not require Envisage interaction.
- Some of the available data classes are:
Block models
Design Databases
Design Layers
Design Objects (Polylines, Text, Dimensions, etc)
Design Object Attributes and Metadata
Design Points
Grids
Isis databases
Map files
Triangulations
Variant data (spec files, etc)
- class variant(*args, **kwargs)
Bases:
MutableMapping
Class to access Vulcan specification files from Variant formats. This implementation behaves like a dictionary with the additional ability to load and save the specfile to the original specification file type.
- load(specfile)
Loads a Vulcan specification file.
- save()
Saves a Vulcan spec file to the original name and type.
- save_as(specfile=None)
Saves a spec file with a new name.
- get(k[, d]) D[k] if k in D, else d. d defaults to None.
- items() a set-like object providing a view on D's items
- keys() a set-like object providing a view on D's keys
- values() an object providing a view on D's values
- class isisdb(name: str, mode: str, env: str = '')
Bases:
object
Interface for Vulcan isis databases.
Instantiates a new isisdb object. Can be used to open an existing database or create a new one.
If creating a new database, this will automatically look for a design file with a name matching the first part of the extension given.
For example,
`vulcan.isisdb("holes.dhd.isis", "create")`
will look for a file named “dhd.dsf” to use as the design.- Parameters:
name (
str
) – The file path of the database to load or create. File must exist for load, and must not exist for create.mode (
str
) – The mode to open the database. Options are: ‘r’ - read-only existing database. ‘create’ - create a new database. ‘w’ - read and write existing database.env (
str
, optional) – Deprecated, included only for backwards compatibility.
Example
Move through all the records and print them. Similar example using for record in db syntax in
isisdb.__iter__()
>>> with vulcan.isisdb("mydatabase.cmp.isis", "r") as db: >>> db.rewind() >>> while not db.eof(): >>> db.next() >>> table = db.get_table_name() >>> for field in db.field_list(table): >>> print (f"{table:10s}:{field:10s}:{str(db[field]):10s}")
- open(name: str, mode: str, env: str = '') int
Open a new database connection on an existing isisdb object. Can be used to open an existing database or create a new one.
- Parameters:
name (
str
) – The file path of the database to load or create. File must exist for load, and must not exist for create.mode (
str
) – The mode to open the database. Options are: ‘r’ - read-only existing database. ‘create’ - create a new database. ‘w’ - read and write existing database.env (
str
, optional) – Deprecated, included only for backwards compatibility.
- Returns:
0 if successful, -1 otherwise.
- Return type:
- close() int
Close the database, performing any pending write operations. It is not valid to continue to use a database after it has been closed.
- Returns:
0 if successful, 1 otherwise.
- Return type:
- key_list() list[str]
Get the list of keys from the current database.
- Returns:
The keys in the database.
- Return type:
list[str]
- Raises:
OSError – If the database is invalid, commonly if it is missing or locked.
- table_list() list[str]
Get the list of tables in the database.
- Returns:
The names of the tables in the database.
- Return type:
list[str]
- field_list(table_name: str) list[str]
Get the list of fields within a table in the database.
- Parameters:
table_name (
str
) – The name of the table to list the fields of.
- field_list_numbers(table_name: str) list[str]
Get the list of numeric fields within a table in the database.
- Parameters:
table_name (
str
) – The name of the table to list the fields of.
- field_list_strings(table_name: str) list[str]
Get the list of string fields within a table in the database.
- Parameters:
table_name (
str
) – The name of the table to list the fields of.
- field_index(name: str, table: str) int
Return a one-based field index.
Warning
This function is deprecated and will be removed in a future release. Use get_field_index() instead.
See also
get_field_index
Gets the index of a field within a table.
- get_default(field_id: int | str, table_id: int | str) float
Get the default value of a numeric field.
- get_default_string(field_id: int | str, table_id: int | str)
Get the default value of a string field.
- get_table_name() str
Get the table name of the current record.
- Returns:
The table name of the current record.
- Return type:
- get_subtype() str
Get the subtype of the current record.
- Returns:
The subtype of the current record.
- Return type:
- put_table_name(rec_type: str) int
Sets a table on the current record, filling any fields with their default values.
- get(name: str | None = None, field_index: int | None = None) float
Get the numeric value of a field in the current table, either by name or by index.
- get_string(name: str | None = None, field_index: int | None = None)
Get the string value of a field in the current table, either by name or by index.
- put(self, name: 'str', v: 'float | str | int')
Put a numeric value into a field.
- Parameters:
name (
str
) – The name of the field to store the value.v (
float|int|str
) – The value to put. Note that any strings passed will be converted to numeric values.
- Raises:
PermissionError – If the database was opened in read-only mode.
Overload
put(self, field_index: ‘int’, v: ‘float | str | int’)
Put a numeric value into a field.
- Parameters:
field_index (
i
) – The index of the field to store the value.v (
float|int|str
) – The value to put. Note that any strings passed will be converted to numeric values.
- Raises:
PermissionError – If the database was opened in read-only mode.
- put_string(self, name: 'str', v: 'float | int | str')
Put a string value into a field.
- Parameters:
- Raises:
PermissionError – If the database was opened in read-only mode.
Overload
put_string(self, field_index: ‘int’, v: ‘float | int | str’)
Put a string value into a field.
- Parameters:
- Raises:
PermissionError – If the database was opened in read-only mode.
- get_position() float
Get the position of the current record.
- Returns:
The position of the current record in the database, or -1 on error.
- Return type:
- next_key() int
Move the current record position to the start of the next key.
- Returns:
0 if successful, 1 otherwise.
- Return type:
- next_same_key() int
Move the current record to the next record with the same key.
- Returns:
0 if successful, or -1 if the next record is in a new key, and will not advance further.
- Return type:
- get_key() str
Get the key of the current record.
- Returns:
The key of the current record.
- Return type:
- next() int
Move to the next record.
- Returns:
0 if successful, 1 if now at end of file, -1 if failure.
- Return type:
- write() int
Write the current record back to the database, saving any pending changes.
- Returns:
0 if successful, 1 otherwise.
- Return type:
- insert_after() int
Insert the current buffer after the current record.
- Returns:
0 if successful, 1 otherwise.
- Return type:
- insert_before() int
Insert the current buffer before the current record.
- Returns:
0 if successful, 1 otherwise.
- Return type:
- get_buffer() str
Get the trimmed record buffer for the current record.
- Returns:
The trimmed record buffer of the current record.
- Return type:
- append_buffer(table_name: str, buffer: str) int
Append a buffer to the current record.
- Parameters:
- Returns:
0 if successful, 1 otherwise.
- Return type:
- Raises:
PermissionError – If the database was opened in read-only mode.
- append() int
Append the current record to the end of the database.
- Returns:
0 if successful, 1 otherwise.
- Return type:
- delete_record() int
Delete the current record from the database.
- Returns:
0 if successful, 1 otherwise.
- Return type:
- get_raw_header() bytes
Get the raw header of the database. This will be a design, including the number of records.
- Returns:
The header of the database.
- Return type:
- has_dsr() int
Check if the database contains DSR information.
- Returns:
1 if the database contains DSR information, 0 otherwise.
- Return type:
- get_coordinate(depth: float) list[float]
Get the coordinate of a drillhole at a given depth.
- Parameters:
depth (
float
) – The depth to query the drillhole coordinates at.- Returns:
The (X, Y, Z) position of the drillhole at the given depth.
- Return type:
list[float]
- get_multiple(fields: list[str]) list[float]
Get the values of multiple numeric fields simultaneously.
- Parameters:
fields (
list[str]
) – The list of field names to get the values of.- Returns:
The values of the fields, in the same order as the field names were passed.
- Return type:
list[float]
- get_multiple_string(fields: list[str]) list[str]
Get the values of multiple string fields simultaneously.
- Parameters:
fields (
list[str]
) – The list of field names to get the values of.- Returns:
The values of the fields, in the same order as the field names were passed.
- Return type:
list[str]
- eof() bool
Check whether the current record position is the end of file.
- Returns:
True if at end of file, False otherwise.
- Return type:
- is_open() bool
Check whether the database is currently open.
- Returns:
True if the database is open, False otherwise.
- Return type:
- __iter__()
Generator to move through all records in an isisdb
- Yields:
self
– Database index for each record.
Example
>>> # Iterates through all the records in a database and >>> # prints the data. >>> for record in db: >>> table = db.get_table_name() >>> for field in record.field_list(table): >>> print ("%10s:%10s:%10s" %(table, field, record[field]))
- property keys: Iterator[str]
Generator to move from one key to the next in an isisdb
- Yields:
self
– Database index for each key.
Example
>>> # Iterates through all the keys in a database and >>> # prints the key names. >>> for key in db.keys: >>> print (db.get_key())
- property this_key: str
Get the current position key.
- Returns:
The key at the current record position.
- Return type:
- key(key: str = '')
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.
- Parameters:
key (
str
, optional) – Key name to be looped. Defaults to the current key.- Yields:
self
– Database index for the specified key- Raises:
NameError – When no key found.
Example
>>> # Prints the contents of the depth field for the >>> # key LK177 on the table SURVEY >>> for record in db.key("LK177"): >>> if db.get_table_name() == "SURVEY": >>> print (record['DEPTH'])
- this_table(table: str = '')
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.
- Parameters:
table (
str
, optional) – Table name to be looped. Defaults to the current table.- Yields:
self
– Database index for the specified table
Example
>>> # Prints the contents of the depth field for the >>> # survey table (on the current key) >>> for record in db.this_table("SURVEY"): >>> print (record['DEPTH'])
- goto_table(table: str) bool
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:
True on success and position of current record is set.
- Return type:
- Raises:
NameError – When no table found with the matching name.
Examples
>>> # Goes to a requested table name >>> db.goto_table("SURVEY"):
- class block_model(name: str, mode: str = 'w', env_deprecated: str = '')
Bases:
object
Interface for Vulcan block models
- __init__(name: str, mode: str = 'w', env_deprecated: str = '') None
Instantiate a new block model object. This can either load an existing block model from file or create a new one.
- Parameters:
name (
str
) – The file path of the block model to open. If attempting to load an existing model, this file must exist. If attempting to create a new model, this file must not exist.mode (
str
) – Mode to open the block model. Options are ‘w’ - write mode ‘r’ - read mode ‘create’ - create modeenv_deprecated (
str
) – Project environment - deprecated, included only for backwards compatibility.
- Returns:
The block model object.
- Return type:
- Raises:
OSError – If the model is unable to be opened.
- open(name: str, mode: str = 'w', env_deprecated: str = '')
Open a different block model. This will clear any information about the previous block model the object referred to.
- Parameters:
name (
str
) – The file path of the block model to open. If attempting to load an existing model, this file must exist. If attempting to create a new model, this file must not exist.mode (
str
) – Mode to open the block model. Options are ‘r’ - read mode ‘w’ - write mode ‘create’ - create modeenv_deprecated (
str
) – Deprecated, included only for backwards compatibility.
- Returns:
0 if successful, 1 otherwise.
- Return type:
- Raises:
OSError – If the model is unable to be opened.
- create_regular(name: str, x0: float, y0: float, z0: float, x1: float, y1: float, z1: float, nx: int, ny: int, nz: int) int
Create a new regular block model. This will clear any information about the previous block model the object referred to.
- Parameters:
name (
str
) – The file path for the new block model.x0 (
float
) – The minimum X coordinate of the model extent.y0 (
float
) – The minimum Y coordinate of the model extent.z0 (
float
) – The minimum Z coordinate of the model extent.x1 (
float
) – The maximum X coordinate of the model extent.y1 (
float
) – The maximum Y coordinate of the model extent.z1 (
float
) – The maximum Z coordinate of the model extent.nx (
int
) – The number of blocks in the X direction.ny (
int
) – The number of blocks in the Y direction.nz (
int
) – The number of blocks in the Z direction.
- Returns:
0 if successful, 1 otherwise.
- Return type:
- create_irregular(name: str, x0: float, y0: float, z0: float, x1: float, y1: float, z1: float, nx: int, ny: int, nz: int, sub_nx: int | None = None, sub_ny: int | None = None, sub_nz: int | None = None) int
Create a new irregular block model optionally with a sub schema. This will clear any information about the previous block model the object referred to.
If any optional sub_* arguments are given, all 3 are required.
- Parameters:
name (
str
) – The file path for the new block model.x0 (
float
) – The minimum X coordinate of the model extent.y0 (
float
) – The minimum Y coordinate of the model extent.z0 (
float
) – The minimum Z coordinate of the model extent.x1 (
float
) – The maximum X coordinate of the model extent.y1 (
float
) – The maximum Y coordinate of the model extent.z1 (
float
) – The maximum Z coordinate of the model extent.nx (
int
) – The number of blocks in the X direction for the main schema.ny (
int
) – The number of blocks in the Y direction for the main schema.nz (
int
) – The number of blocks in the Z direction for the main schema.sub_nx (
int
, optional) – The number of blocks in the X direction for the sub schema.sub_ny (
int
, optional) – The number of blocks in the Y direction for the sub schema.sub_nz (
int
, optional) – The number of blocks in the Z direction for the sub schema.
- Returns:
0 if successful, 1 otherwise.
- Return type:
- create_strat(name: str, x0: float, y0: float, z0: float, x1: float, y1: float, z1: float, nx: int, ny: int) int
Create a new stratigraphic block model. This will clear any information about the previous block model the object referred to.
- Parameters:
name (
str
) – The file path for the new block model.x0 (
float
) – The minimum X coordinate of the model extent.y0 (
float
) – The minimum Y coordinate of the model extent.z0 (
float
) – The minimum Z coordinate of the model extent.x1 (
float
) – The maximum X coordinate of the model extent.y1 (
float
) – The maximum Y coordinate of the model extent.z1 (
float
) – The maximum Z coordinate of the model extent.nx (
int
) – The number of blocks in the X direction.ny (
int
) – The number of blocks in the Y direction.
- Returns:
0 if successful, 1 otherwise.
- Return type:
- translate(x: float, y: float, z: float) int
Translate the origin of the block model.
This operation is additive, i.e.
>>> block_model.translate(0.0, 10.0, 0.0) >>> block_model.translate(5.0, 0.0, 0.0)
is the same as
>>> block_model.translate(5.0, 10.0, 0.0)
- Parameters:
- Return type:
0 if successful.
- Raises:
PermissionError – If the block model is open in read only mode.
See also
set_model_origin
Set the origin to given coordinates.
rotate
Change the rotation of the model.
- rotate(x: float, y: float, z: float) int
Rotate the block model about its origin.
This operation is additive, i.e.
>>> block_model.rotate(0.0, 10.0, 0.0) >>> block_model.rotate(5.0, 0.0, 0.0)
is the same as
>>> block_model.rotate(5.0, 10.0, 0.0)
- Parameters:
- Raises:
PermissionError – If the block model is open in read only mode.
See also
set_model_orientation
Set the rotation of the model to the given values.
- scale(x: float, y: float, z: float) int
Multiplicatively scale the block model size.
- Parameters:
- Raises:
PermissionError – If the block model is open in read only mode.
- select(selection: str) int
Specify block selection criteria for a block model. Note that this will overwrite any selection at the current level.
- Parameters:
selection (
str
) –The selection criteria string.
The selection is in the form an argument string for programs like bcalc. The most useful feature is block selection by triangulation: ‘’’-t “mytri.00t”’’’ or f’’’-t “{myTriVariable}”’’’ Other useful options are -n and -u for upper and lower surface triangulation, and -O (capital o) or blocks outside the triangulation, and -b xl,xu,yl,yu,zl,zu for a bounding box.
Possible options are:
- -v <variable> [value]
Mask with variable.
- -t <triangulation>
Bounding triangulation. Blocks with centroids inside the triangulation will be selected. The -X option may be applied to select based on block extents.
- -n <top surface>
Top bounding surface triangulation.
- -u <lower surface>
Lower bounding surface triangulation.
- -B <triangulation>
Use single bounding surface
- -Z
Project down Z axis. Requires -B.
- -O
Select blocks outside the solid only.
- -bm <xl, xt, yl, yt, zl, zt>
Define the bounding extents using block model coordinates. When using this switch, you will need to specify the minimum and maximum X, Y and Z coordinates. Blocks having extents that are inside, or intersect these extents are selected.
- -bw <xl, xt, yl, yt, zl, zt>
- Define the bounding extents using real world coordinates.
When using this switch, you will need to specify the minimum and maximum X, Y and Z coordinates. Blocks having centroids that are inside the extents are selected. The -X option may be used to reproduce the extents intersection type selection of -bm.
- -s <mx, my, mz>
Sub-block dimensions.
- -p <a, b, c, d>
Include planed blocks.
- -C <condition>
Use conditional expression.
- -r <offset>
Provide a plane offset buffer.
- -X
Use proportional volumes against solid. This modifies the block selection to include blocks that intersect the selecting volume.
- -T
Use selection file with triangulations.
- -S
Reverse block selection
- Returns:
0 if successful, 1 otherwise.
- Return type:
See also
push_select
Add a new selection to the selection stack.
pop_select
Remove the current selection from the selection stack.
- select_xy_seam(x: float, y: float, seam: str) int
Set the selection to match blocks with the given seam in an xy grid square.
- push_select(selection: str) int
Add to the existing selection. Note that there is a limit of 5 ‘levels’ for the selection stack; that is after the initial selection is made, only an additional 4 selections can be pushed.
- Returns:
0 if successful, 1 if the selection stack is full.
- Return type:
- pop_select() int
Remove the most recent selection from the selection stack.
- Returns:
0 if successful, 1 if there is nothing to remove.
- Return type:
- field_list() list[str]
Get the list of fields for the block model.
- Returns:
The list of field names.
- Return type:
list[str]
- field_list_numbers() list[str]
Get the list of numeric fields for the block model.
- Returns:
The list of numeric field names.
- Return type:
list[str]
- field_list_strings() list[str]
Get the list of string fields for the block model.
- Returns:
The list of string field names.
- Return type:
list[str]
- get_translation_values(field_name: str) list[str]
Get the translation values for a field.
This provides the mapping from the values as integers (indices) to string values. Using get_string() will translate the value for a single block to its correpsonding string, where as this function allows bulk-translation of the underlying values.
This is especially useful for large models, where calling get_data_string() may use large amounts of memory. By getting the data out as an integer rather than a string, much less memory is required.
For example, you can call get_data_int64() to load all the values then map the values it return into the translation values for their strings.
>>> selection = bm.get_matches() >>> var = 'region' >>> numeric_values = bm.get_data_int64(var, selection) >>> translation_values = bm.get_translation_values(var) >>> print(numeric_values, translation_values) >>> for value in numeric_values: >>> print(translation_values[value])
Another usage would be to count the occurence of each string, without ever needing to translate the data.
>>> selection = bm.get_matches() >>> var = 'region' >>> translation_values = bm.get_translation_values(var) >>> counter = collections.Counter(bm.get_data_int64(var, selection)) >>> for key, value in counter.items(): >>> print(translation_values[key], value)
- Parameters:
field_name (
str
) – The field to get the translation values for.- Returns:
The translation values.
- Return type:
list[str]
- get(name: str | None = None, k: int | None = None) float
Get the numeric value of a field, either by name or by index.
- get_string(name: str | None = None, i: int | None = None) str
Get the string value of a field, either by name or by index.
- put(self, name: 'str', v: 'str | float | int')
Set the value of a field, either by name or by index.
- Parameters:
- Raises:
PermissionError – If the block model is open in read only mode.
Overload
put(self, k: ‘int’, v: ‘str | float | int’)
Set the value of a field, either by name or by index.
- Parameters:
- Raises:
PermissionError – If the block model is open in read only mode.
- put_string(self, name: 'str', v: 'str')
Set the value of a string field, either by name or by index.
- Parameters:
- Raises:
PermissionError – If the block model is open in read only mode.
Overload
put_string(self, index: ‘int’, v: ‘str’)
Set the value of a string field, either by name or by index.
- Parameters:
- Raises:
PermissionError – If the block model is open in read only mode.
- add_block(x0: float, y0: float, z0: float, x1: float, y1: float, z1: float) int
Add a new block to the model.
The block location is not validated upon adding. The block should be sized equal to a parent or sub block size and should be inserted at a location that correctly aligns to those coordinates.This should only be used where no blocks exist (such as deleted blocks), and will overlap existing blocks if a block already exists at the location.
- Parameters:
x0 (
float
) – The X coordinate of the lower extent of the block.y0 (
float
) – The Y coordinate of the lower extent of the block.z0 (
float
) – The Z coordinate of the lower extent of the block.x1 (
float
) – The X coordinate of the upper extent of the block.y1 (
float
) – The Y coordinate of the upper extent of the block.z1 (
float
) – The Z coordinate of the upper extent of the block.
- Returns:
0 if successful, 1 otherwise.
- Return type:
- Raises:
PermissionError – If the block model is open in read only mode.
- move_block(x0: float, y0: float, z0: float, x1: float, y1: float, z1: float) int
Move the block at the current record to the given coordinates. Note that the ‘current record’ is that pointed to using rewind() and next().
- Parameters:
x0 (
float
) – The X coordinate for the new lower extent of the block.y0 (
float
) – The Y coordinate for the new lower extent of the block.z0 (
float
) – The Z coordinate for the new lower extent of the block.x1 (
float
) – The X coordinate for the new upper extent of the block.y1 (
float
) – The Y coordinate for the new upper extent of the block.z1 (
float
) – The Z coordinate for the new upper extent of the block.
- Returns:
0 if successful, 1 otherwise.
- Return type:
- Raises:
PermissionError – If the block model is open in read only mode.
- next() int
Move to the next record.
Ensure rewind() has been called before beginning iteration.
- Returns:
0 if sucessful, 1 if the current block is the last record.
- Return type:
- rewind() int
Move to the first record.
- Should be called after:
Opening a model
Making a selection
Iterating through the model, if there is more work to be performed.
- get_position() float
Get the current record position.
- Returns:
The current record position.
- Return type:
- find_xyz(x: float, y: float, z: float) int
Find a block at given model coordinates and set the record position.
- find_world_xyz(x: float, y: float, z: float) int
Find a block at given real world coordinates and set the record position.
- find_world_xyz_seam(x: float, y: float, z: float, seam: str) int
Find the seam at given real world coordinates.
- to_world(x: float, y: float, z: float) list[float]
Convert a set of model coordinates to real world coordinates.
- to_model(x: float, y: float, z: float) list[float]
Convert a set of real world coordinates to model coordinates.
- model_extent() list[float]
Get the extent of the model.
- Returns:
In the form [Xmin, Ymin, Zmin, Xmax, Ymax, Zmax] where the min values are the coordinates of the lower extent, and the max values are the coordinates of the upper extent.
- Return type:
list[float]
- model_orientation() list[float]
Get the orientation of the model.
- Returns:
The amount of rotation (in degrees) for each axis, in the form [Z, X, Y]
- Return type:
list[float]
- model_origin() list[float]
Get the origin of the model.
- Returns:
The origin coordinates, in the form [X, Y, Z]
- Return type:
list[float]
- set_model_origin(x0: float, y0: float, z0: float) int
Set the origin of the model.
- Parameters:
- Returns:
0 if successful, 1 otherwise.
- Return type:
- Raises:
PermissionError – If the model is open in read only mode.
- set_model_orientation(a1: float, a2: float, a3: float) int
Set the orientation of the model.
- Parameters:
- Returns:
0 if successful, 1 otherwise.
- Return type:
- Raises:
PermissionError – If the model is open in read only mode.
- model_n_schemas() int
Get the number of schemas associated with the model.
- Returns:
The number of schemas.
- Return type:
- model_schema_extent(k: int) list[float]
Get the extent of a schema within the model.
- Parameters:
k (
int
) – The index of the schema to get the extent of.- Returns:
In the form [Xmin, Ymin, Zmin, Xmax, Ymax, Zmax] where the min values are the coordinates of the lower extent, and the max values are the coordinates of the upper extent.
- Return type:
list[float]
- model_schema_size(k: int) list[float]
Get the size of a schema within the model.
- Parameters:
k (
int
) – The index of the schema to get the size of.- Returns:
The size of the schema, in the form [Xmin, Ymin, Zmin, Xmax, Ymax, Zmax].
- Return type:
list[float]
- model_schema_dimensions(k: int) list[float]
Get the dimensions of a schema within the model.
- Parameters:
k (
int
) – The index of the schema to get the dimensions of.- Returns:
The dimensions of the schema, in the form [X, Y, Z]
- Return type:
list[float]
- match_extent() list[float]
Get the extent of the current match selection.
- Returns:
The extent of the selection.
- Return type:
list[float]
- match_volume() float
Calculates the volume of the current match selection.
- Returns:
The calculated volume.
- Return type:
- block_extent() list[float]
Get the extent of the currently selected block.
- Returns:
For most models, this will be in the form [Xmin, Ymin, Zmin, Xmax, Ymax, Zmax] where the min values are the coordinates of the lower extent, and the max values are the coordinates of the upper extent.
- Return type:
list[float]
- index_model() int
Build the index for the block model.
- Returns:
0 if successful, 1 otherwise.
- Return type:
- is_indexed() int
Check whether the block model is indexed.
- Returns:
1 if the model is indexed, 0 otherwise.
- Return type:
- is_tb_model() bool
Check if the model is an ‘extended’ format model. All new models are ‘extended’ or TB models.
- Returns:
True if the model is an extended (TB) model, False otherwise.
- Return type:
- is_regular() bool
Check if the model is a regular model.
- Returns:
True if the model is a regular model, False if the model is irregular.
- Return type:
- get_matches(match_string: str) numpy.ndarray[numpy.int64]
Get the blocks that match the given match arguments.
- Parameters:
match_string (
str
) – The match arguments.- Returns:
The indexes of the matched blocks.
- Return type:
numpy.ndarray[Int64]
- get_matches_extent(match_string: str) tuple[numpy.ndarray]
Get a list of NumPy arrays containing the block IDs and extents of each block selected in the match.
- Parameters:
match_string (
str
) – The match arguments.- Returns:
The extents of the matched blocks, in the form tuple[[id], [Xmin], [Xmax], [Ymin], [Ymax], [Zmin], [Zmax]]. That is, a tuple of 7 NumPy arrays, where the first array is the list of IDs, the second is the list of minimum X values etc.
- Return type:
tuple[numpy.ndarray]
- Raises:
- get_data_double(name: str, n0: list[numpy.int64]) numpy.ndarray[numpy.double]
Get the float values of a variable in the block model. It is recommended to use get_data() instead.
- Parameters:
name (
str
) – The variable to get the data from.sel (
list[numpy.int64]
) – The IDs of blocks to get data from. This could be the result of get_matches() or ‘numpy.arrange(bm.n_blocks())’ for all blocks
- Returns:
The data.
- Return type:
numpy.ndarray[numpy.double]
- Raises:
NameError – If the variable doesn’t exist.
- get_data_float(name: str, n0: list[numpy.int64]) numpy.ndarray[float]
Get the float values of a variable in the block model. It is recommended to use get_data() instead.
- Parameters:
name (
str
) – The variable to get the data from.sel (
list[Int64]
) – The IDs of blocks to get data from. This could be the result of get_matches() or ‘numpy.arrange(bm.n_blocks())’ for all blocks
- Returns:
The data.
- Return type:
numpy.ndarray[float]
- Raises:
NameError – If the variable doesn’t exist.
- get_data_string(name: str, n0: list[numpy.int64]) numpy.ndarray[str]
Get the string values of a variable in the block model. It is recommended to use get_data() instead.
- Parameters:
name (
str
) – The variable to get the data from.sel (
list[Int64]
) – The IDs of blocks to get data from. This could be the result of get_matches() or ‘numpy.arrange(bm.n_blocks())’ for all blocks
- Returns:
The data.
- Return type:
numpy.ndarray[str]
- Raises:
NameError – If the variable doesn’t exist.
- get_data_int64(name: str, n0: list[numpy.int64]) numpy.ndarray[numpy.int64]
Get the int values of a variable in the block model.
- put_data_double(name: str, n1: numpy.ndarray[numpy.double], n0: list[numpy.int64]) int
Store double data in the block model. It is recommended to use put_data() instead.
- Parameters:
name (
str
) – The variable to put the data into.data (
numpy.ndarray[double]
) – The data to store.sel (
list[Int64]
) – The IDs of blocks to put data into. This could be the result of get_matches() or ‘numpy.arrange(bm.n_blocks())’ for all blockslength. (Note that 'data' and 'sel' MUST have the same) –
- Returns:
0 if successful, 1 otherwise.
- Return type:
- Raises:
NameError – If the variable doesn’t exist.
- put_data_float(name: str, n1: numpy.ndarray[float], n0: list[numpy.int64]) int
Store float data in the block model. It is recommended to use put_data() instead.
- Parameters:
name (
str
) – The variable to put the data into.data (
numpy.ndarray[float]
) – The data to store.sel (
list[Int64]
) – The IDs of blocks to put data into. This could be the result of get_matches() or ‘numpy.arrange(bm.n_blocks())’ for all blockslength. (Note that 'data' and 'sel' MUST have the same) –
- Returns:
0 if successful, 1 otherwise.
- Return type:
- Raises:
NameError – If the variable doesn’t exist.
- put_data_string_list(name: str, data: numpy.ndarray[str], n0: list[numpy.int64]) int
Store string data in the block model.
- Parameters:
name (
str
) – The variable to put the data into.data (
numpy.ndarray[str]
) – The data to store.sel (
list[Int64]
) – The IDs of blocks to put data into. This could be the result of get_matches() or ‘numpy.arrange(bm.n_blocks())’ for all blockslength. (Note that 'data' and 'sel' MUST have the same) –
- Returns:
0 if successful, 1 otherwise.
- Return type:
- Raises:
NameError – If the variable doesn’t exist.
- get_regular_indices() numpy.ndarray[numpy.int64]
Get the indices of a regular block model, in i/j/k order.
- Returns:
The indices of the blocks.
- Return type:
numpy.ndarray[Int64]
- Raises:
TypeError – If the block model is not a regular block model.
- creation_date() str
Check when the block model was created.
- Returns:
The date of the block model creation.
- Return type:
- modified_date() str
Check when the block model was last modified.
- Returns:
The date of the last modification.
- Return type:
- get_multiple(fields: list[str]) list[float]
Get the values from multiple numeric fields in the block model.
- Parameters:
fields (
list[str]
) – The list of field names to get values from.- Returns:
The requested values, in the same order as fields are passed.
- Return type:
list[float]
- get_multiple_string(fields: list[str]) list[str]
Get the values from multiple string fields in the block model.
- Parameters:
fields (
list[str]
) – The list of field names to get values from.- Returns:
The requested values, in the same order as fields are passed.
- Return type:
list[str]
- eof() bool
Check if the current record position is the end of the file.
- Returns:
True if at end of file, False otherwise.
- Return type:
- is_open() bool
Check whether the block model file is open.
- Returns:
True if the file is open, False otherwise.
- Return type:
- add_variable(*args, **kwargs)
- get_pandas(vars: list[str] = None, select: str = '') pandas.DataFrame
Gets block model data as a pandas.DataFrame
- Parameters:
vars (
list[str]
, optional) – Variable list to get from model. Defaults to all variables.select (
str
, optional) – Selection string to use. Defaults to all blocks.
- Return type:
pandas.DataFrame
- get_pandas_extent(vars: list[str] = None, select: str = '') pandas.DataFrame
Gets all matches within an extent.
- Parameters:
vars (
list[str]
, optional) – Variable list to get from model. Defaults to all variables.select (
str
, optional) – Selection string to use. Defaults to all blocks.
- Returns:
Block model within the match extent.
- Return type:
pandas.DataFrame
- get_data(var: str, sel: list[int] = None) numpy.ndarray
Gets the values of a set of blocks, or all blocks if no selection is provided.
- Parameters:
variable (
str
) – Variable to get data fromsel (
list[int]
) – List of block indices to get from such as the return from block_model.get_matches()
- Returns:
NumPy array of all values for the specified variable.
- Return type:
numpy.array()
Example
>>> matches = bm.get_matches('''-C "rocktype eq 'oxide'"''') >>> data = bm.get_data("au", matches)
- put_data(var: str, data: numpy.ndarray, sel: list[int] = None)
Stores the values of a numpy array into the block model.
- Parameters:
variable (
str
) – Variable to get data fromdata (
numpy.array
) – Data to be storedsel (
list[int]
) – List of block indices to store to such as the return from block_model.get_matches()
Example
>>> matches = bm.get_matches('''-C "rocktype eq 'oxide'"''') >>> bm.put_data("au", data, matches)
- put_data_string(var: str, data: numpy.ndarray, sel: list[int] = None)
Stores numpy string array to a block model string variable.
- put_pandas(dataframe: pandas.DataFrame, vars: list[str] = None)
Puts a Pandas dataframe into the block model.
- Parameters:
dataframe (
pandas.DataFrame
) – DataFrame with block model datavars (
list[str]
, optional) – Variables to update. DataFrame columns used when no var list is provided.
- class mapio(name: str, mode: str, env: str = '', project: str = '')
Bases:
object
Interface for interacting with Vulcan map files.
- __init__(name: str, mode: str, env: str = '', project: str = '') None
Initialize a new mapio object.
- next_key() int
Set the current record position to the next key in the file.
- Returns:
0 if successful, 1 otherwise. An unsuccessful result likely means the end of the file was reached before the next key was found.
- Return type:
- field_size() int
Get the size of the fields in the map file.
- Returns:
The size of the fields.
- Return type:
- next() int
Move the current position to the next record.
- Returns:
0 if successful, 1 otherwise.
- Return type:
- rewind() int
Set the current position to the start of the map file.
- Returns:
0 if successful, 1 otherwise.
- Return type:
- get_multiple(fields: list[str]) list[float]
Get the values from multiple numeric fields.
- Parameters:
fields (
list[str]
) – The list of field names to get the values from.- Returns:
The values, in the order the fields were given.
- Return type:
list[float]
- get_multiple_string(fields: list[str]) list[str]
Get the values from multiple text fields.
- Parameters:
fields (
list[str]
) – The list of field names to get the values from.- Returns:
The values, in the order the fields were given.
- Return type:
list[str]
- eof() bool
Check whether the current position is the end of the map file.
- Returns:
True if at end of file, False otherwise.
- Return type:
- is_open() bool
Check whether the map file is currently open.
- Returns:
True if the file is open, False otherwise.
- Return type:
- __iter__()
Generator to move through all records in a map file
- Parameters:
None –
- Yields:
self
– Mapfile index for each record.
Example
>>> # Iterates through all the records in a map file and >>> # prints the data. >>> for record in mapio: >>> for field in record.field_list(): >>> print ("%10s:%10s" %(field, record[field]))
- get_position()
Deprecated since version 2024.0.
- set_position()
Deprecated since version 2024.0.
- class triangulation(name: str, mode: str = 'r')
Bases:
object
Interface for Vulcan triangulations. A triangulation is made up of triangular facets defined by three points. This means a square or rectangle is represented by two facets, a cube is represented as twelve facets (six squares, each made of two facets). More complicated surfaces may require hundreds, thousands or more facets to be represented.
- __init__(name: str, mode: str = 'r') None
- Parameters:
- Raises:
OSError – If file does not exist and is being opened in read mode.
Example
>>> with vulcan.triangulation("cube.00t", "r") as tri: >>> print (len(tri.nodes)) >>> print (len(tri.facets))
>>> # Changes are auto saved with a context manager. >>> with vulcan.triangulation("cube.00t", "w") as tri: >>> for i, vertex in enumerate(tri.nodes): >>> # Shift the z by 5m >>> vertex[2] += 5.0 >>> # Save the node back >>> tri.node[i] = vertex
- save(name: str = '')
Save the triangulation.
- Parameters:
name (
str
, optional) – The file path to save the triangulation to. If not given, triangulation saves back to the path it was opened with.
- load_grid(grid: grid)
Load a grid into the current triangulation (overwrites).
- Parameters:
grid (
vulcan.grid
) – The grid to load into the triangulation.- Raises:
PermissionError – If the triangulation was opened in read-only mode.
- update_grid(grid: grid)
Update a grid with the current triangulation.
- Parameters:
grid (
vulcan.grid
) – The grid to update with triangulation elevations.- Raises:
PermissionError – If the triangulation was opened in read-only mode.
- is_read_only() bool
Check whether the triangulation is open in read only mode.
- Returns:
True if the triangulation is open in read-only mode, False otherwise.
- Return type:
- is_ok() bool
Report the triangulation load status.
- Returns:
True if the triangulation loaded successfully, False otherwise. New triangulations will always return True.
- Return type:
- is_closed() bool
Report the triangulation closure state.
- Returns:
True if the triangulation is closed/watertight, False otherwise.
- Return type:
- is_crossing() bool
Report the existence of crossing triangles.
- Returns:
True if the triangulation has crossing triangles, False otherwise.
- Return type:
- is_consistent() bool
Report the existence of inconsistent triangles.
- Returns:
True if the triangles are consistent, False otherwise.
- Return type:
- n_nodes() int
Get the number of nodes (points) in the triangulation.
- Returns:
The number of nodes/points in the triangulation.
- Return type:
- n_faces() int
Get the number of facets in the triangulation.
- Returns:
The number of facets in the triangulation.
- Return type:
- get_face(k: int) list[int]
Get the point indices of a specific facet.
- Parameters:
k (
int
) – The index of the facet to get the point indices of.- Returns:
The indices of the facet points.
- Return type:
list[int]
- Raises:
IndexError – If k is less than 0 or greater than n_faces.
- set_face(k: int, n1: int, n2: int, n3: int)
Set a facets points by index.
- Parameters:
- Raises:
IndexError – If k is less than 0 or greater than n_faces, or n1, n2, n3 are less than 0 or greater than n_nodes.
PermissionError – If the triangulation was opened in read-only mode.
- get_node(k: int) list[float]
Get a vertex from the triangulation.
- Parameters:
k (
int
) – The index of the point to get.- Returns:
The X, Y, Z coordinates of the point.
- Return type:
list[float]
- Raises:
IndexError – If k is less than 0 or greater than n_nodes.
- set_node(k: int, x: float, y: float, z: float)
Set the coordinates of a triangulation vertex.
- Parameters:
- Raises:
IndexError – If k is less than 0 or greater than n_nodes.
PermissionError – If the triangulation was opened in read-only mode.
- add_face(n1: int, n2: int, n3: int) int
Add a facet to the triangulation.
- Parameters:
- Returns:
The index of the newly added facet.
- Return type:
- Raises:
IndexError – If n1, n2, n3 are less than 0 or greater than n_nodes.
PermissionError – If the triangulation was opened in read-only mode.
- add_node(x: float, y: float, z: float) int
Add a vertex to the triangulation.
- Parameters:
- Returns:
The index of the newly added point.
- Return type:
- Raises:
PermissionError – If the triangulation was opened in read-only mode.
- delete_face(k: int, purge_points: bool = False)
Delete a facet from the triangulation. Optionally purge points that are no longer used.
- Parameters:
- Raises:
IndexError – If k is less than 0 or greater than n_faces.
PermissionError – If the triangulation was opened in read-only mode.
- delete_node(k: int)
Delete a point from the triangulation.
- Parameters:
int (
k
) – The index of the point to delete.- Raises:
IndexError – If k is less than 0 or greater than n_nodes.
PermissionError – If the triangulation was opened in read-only mode.
- clear_triangles()
Clear all vertex and facet data, leaving attributes intact.
- Raises:
PermissionError – If the triangulation was opened in read-only mode.
- clear()
Clear all data from the triangulation.
- Raises:
PermissionError – If the triangulation was opened in read-only mode.
- get_colour_index() int
Get the triangulation colour index.
- Returns:
The colour index of the triangulation.
- Return type:
- set_colour_index(colour: int)
Set the triangulation colour index.
- Parameters:
colour (
int
) – The colour index to set on the triangulation.- Raises:
PermissionError – If the triangulation was opened in read-only mode.
- is_rgb() bool
Checks if the triangulation colour is RGB.
- Returns:
True if the triangulation has an RGB colour, False otherwise.
- Return type:
- get_rgb() list[int]
Get the triangulation colour (RGB).
- Returns:
The R, G, B colour values for the triangulation.
- Return type:
list[int]
- set_rgb(rgb: list[int])
Set the triangulation colour (RGB).
- Parameters:
rgb (
list[int]
) – The [R, G, B] colour value to set.- Raises:
PermissionError – If the triangulation is opened in read-only mode.
- get_translucency() float
Get the triangulation translucency.
- Returns:
The translucency of the triangulation.
- Return type:
- set_translucency(value: float)
Set the triangulation translucency.
- Parameters:
value (
float
) – The translucency value to set.- Raises:
PermissionError – If the triangulation was opened in read-only mode.
- get_properties() dict
Get the triangulation property dictionary.
- Returns:
The triangulation property dictionary.
- Return type:
- set_properties(props: dict)
Set the triangulation property dictionary. Unknown keys will be ignored; calling get_properties first for an established dict with known keys is advised, which can then be modified as needed and set back on to the triangulation.
>>> properties = tri.get_properties() ... # 'property_name_to_edit' should be an existing key in the dict. >>> properties['property_name_to_edit'] = new_value >>> tri.set_properties(properties)
- Parameters:
dict – The key value pairs to set as properties.
- Raises:
PermissionError – If the triangulation was opened in read-only mode.
See also
- get_elevations(x: float, y: float) list[float]
Get any intersection elevations of an x,y location.
- neighbors(k: int) list[int]
Get the neighbors of a facet. This will be every facet which shares an edge with the given facet.
- Parameters:
k (
int
) – The index of the target facet.- Returns:
The indexes of the neighboring facets.
- Return type:
list[int]
- Raises:
IndexError – If k is less than 0 or greater than n_faces.
- node_neighborhood(k: int) list[int]
Get the neighborhood of a node. This is all facets which contain the given node/point.
- Parameters:
k (
int
) – The index of the target node/point.- Returns:
The indexes of the neighborhood facets.
- Return type:
list[int]
- Raises:
IndexError – If k is less than 0 or greater than n_nodes.
- face_neighborhood(k: int) list[int]
Get the facet neighborhood of a given facet. The facet neighborhood is all facets which share either an edge or a point with the given facet.
- Parameters:
k (
int
) – The index of the target facet.- Returns:
The indexes of the neighborhood facets.
- Return type:
list[int]
- Raises:
IndexError – If k is less than 0 or greater than n_faces.
- face_direction(k: int) point
Get the facet direction as a unit vector.
- Parameters:
k (
int
) – The index of the target facet.- Returns:
An (X, Y, Z) unit vector representing the facet direction.
- Return type:
- Raises:
IndexError – If k is less than 0 or greater than n_faces.
- extent_pts() list[point]
Get the triangulation extent as points.
- Returns:
A list of exactly two points representing the lower and upper bounds of the triangulation extent, respectively.
- Return type:
list[point]
- extent() list[list[float]]
Get the triangulation extent as a list.
- Returns:
A list of exactly 2 list of floats, where the first list represents the [X, Y, Z] bounds of the lower extent of the triangulation, and the second list of [X, Y, Z] represents the upper extent.
- Return type:
list[list[float]]
- close() bool
Attempt to close holes in the triangulation.
- Returns:
True if the operations succeeds, False otherwise.
- Return type:
- Raises:
PermissionError – If the triangulation was opened in read-only mode.
- clean()
Clean a triangulation, trying to remove consistency and crossing errors.
- Raises:
PermissionError – If the triangulation was opened in read-only mode.
- normalise()
Normalise a triangulation, fixing facet directions.
- contour(z) list[obj]
Get the contours of a triangulation at a specified Z elevation.
- Parameters:
z (
float
) – The elevation to contour.- Returns:
List of polylines representing the contours.
- Return type:
list[vulcan.obj]
- shortest_path(start: point, end: point) polyline
Get the shortest path along a triangulation between two points.
- volume() float
Get the volume of a closed triangulation.
- Returns:
The volume of the triangulation.
- Return type:
- surface_area() float
Get the surface area of the triangulation.
- Returns:
The surface area of the triangluation.
- Return type:
- translate(translation: point) bool
Translate the triangulation by an x/y/z shift.
- Parameters:
translation (
point
) – The (X, Y, Z) values to shift the triangluation by.- Raises:
PermissionError – If the triangluation was opened in read-only mode.
- scale(xyz_scale: point, xyz_reference: point) bool
Scale the triangulation by a factor in the x/y/z directions based on a reference point.
- Parameters:
- Returns:
Always True. Return value will be removed in a future release.
- Return type:
- Raises:
PermissionError – If the triangluation was opened in read-only mode.
- centroid() point
Get the centroid of the triangulation.
- Returns:
The centroid of the triangluation.
- Return type:
- point_inside(x: float, y: float, z: float) bool
Check if a point is inside a closed triangulation.
- segment_intersections_pt(a: point, b: point) list[point]
Get the intersections of a line segment as points.
- segment_intersections(x0: float, y0: float, z0: float, x1: float, y1: float, z1: float) list[list[float]]
Get the intersections of a line segment as a list.
- Parameters:
x0 (
float
) – The X value of the first end of the line segment.y0 (
float
) – The Y value of the first end of the line segment.z0 (
float
) – The Z value of the first end of the line segment.x1 (
float
) – The X value of the other end of the line segment.y1 (
float
) – The Y value of the other end of the line segment.z1 (
float
) – The Z value of the other end of the line segment.
- Returns:
A list of lists of exactly 3 floats, where each list represents the [X, Y, Z] positions where the line segment intersects the triangluation.
- Return type:
list[list[float]]
- solid_from_polygon(width: float, poly_position: int)
Create a solid from the triangulation points, treating them as a polyline, projecting the points vertically. This should only be used for new solids as the triangulation will be cleared of all previous data.
- Parameters:
width (
float
) – The total height of the projected solid.poly_position (
int
) – The location the points are at, used to determine the projection direction. Possible values are: 0 - Polygon is at the top and will be projected down. 1 - Polygon is at the middle and will be projected 1/2 width up and 1/2 width down. 2 - Polygon is at the top and will be projected up.
- Raises:
PermissionError – If the triangluation was opened in read-only mode.
- get_vertices() numpy.ndarray[float]
Get the vertices of a triangulation as a NumPy array.
- Returns:
A 2D NumPy array of size [n_nodes][3], where each point is represented as an array of X/Y/Z values.
- Return type:
numpy.ndarray[float]
- get_faces() numpy.ndarray[int]
Get the facets of a triangulation as a NumPy array.
- Returns:
A 2D NumPy array of size [n_faces][3], where each facet is represented as an array of point indices.
- Return type:
numpy.ndarray[int]
- put_vertices(n0: numpy.ndarray[float])
Store a NumPy array of vertices to the triangulation.
- Parameters:
numpy.ndarray[float] – A 2D NumPy array of size [*][3], where each point is represented as an array of X/Y/Z values.
- Raises:
PermissionError – If the triangluation was opened in read-only mode.
- put_faces(n0) numpy.ndarray[int]
Store a NumPy array of facets to the triangulation.
- Parameters:
numpy.ndarray[int] – A 2D NumPy array of size [*][3], where each facet is represented as an array of vertex indices.
- Raises:
PermissionError – If the triangluation was opened in read-only mode.
- append_vertices(n0: numpy.ndarray[float])
Append a NumPy array of vertices to the triangulation.
- Parameters:
numpy.ndarray[float] – A 2D NumPy array of size [*][3], where each point is represented as an array of X/Y/Z values.
- Raises:
PermissionError – If the triangluation was opened in read-only mode.
- append_faces(n0: numpy.ndarray[int])
Append a NumPy array of facets to the triangulation.
- Parameters:
numpy.ndarray[int] – A 2D NumPy array of size [*][3], where each facet is represented as an array of vertex indices.
- Raises:
PermissionError – If the triangluation was opened in read-only mode.
- property nodes
Generator to move through each node of a triangulation.
Example
>>> for node in tri.nodes: >>> print (node)
- property faces
Generator to move through each facet of a triangulation.
Example
>>> for face in tri.faces: >>> print (face)
- property node: list[float]
Returns a node from a triangulation using the syntax tri.node[i].
- Returns:
Node x/y/z data at a given index
- Return type:
list[float](len=3)
Example
>>> for i in range(tri.n_nodes()): >>> print (tri.node[i])
- property face: list[int]
Returns a face from a triangulation using the syntax tri.face[i]. Each face is a list of node indices it is linked to (list[3])
- Returns:
Facet node connections of a triangulation at an index.
- Return type:
list[int](len=3)
Example
>>> for i in range(tri.n_faces()): >>> print (tri.face[i])
- get_colour() list[int] | int
Returns the colour of the triangulation in either RGB or colour index.
- Returns:
list[int]
– RGB colour. This must have a length of exactly 3.int
– Colour Index
Example
>>> tri.set_rgb([255,255,255]) >>> tri.get_colour() [255, 255, 255] >>> tri.set_colour_index() >>> tri.get_colour() 1
- class tri_attributes(name: str)
Bases:
object
Interface for Vulcan triangulation attributes.
- is_ok() bool
Check if the triangulation loaded successfully.
- Returns:
True if the triangulation loaded successfully, False otherwise.
- Return type:
- put(name: str, value: int | str, type: str = None)
Add a new attribute into the triangulation.
- Parameters:
- Returns:
True if successful, False otherwise. If false, the error can be checked with get_last_error().
- Return type:
- clear()
Remove all attributes from the triangulation.
- get_keys() list[str]
Get the list of attribute keys associated with the triangulation.
- Returns:
The attribute keys.
- Return type:
list[str]
- get_values() list[str]
Get all the attribute values associated with the triangulation. All values are converted to string format.
- Returns:
The attribute values.
- Return type:
list[str]
- get_hash() dict
Get all attribute keys and values associated with the triangulation.
- Returns:
The key/value pairs for the attributes.
- Return type:
- get_types() list[str]
Get the underlying meta type for all attributes.
- Returns:
The list of attribute types.
- Return type:
list[str]
- get_last_error() str
Get the most recent error associated with the triangulation.
- Returns:
The error message.
- Return type:
- save()
Save any pending changes back to the triangulation.
- class grid_cell
Bases:
object
Interface to create and edit data within grid cells.
- __init__(self) 'None'
Constructs a new grid cell.
Overload
__init__(self, _w: ‘float’, _mask: ‘int’) -> ‘None’
Constructs a new grid cell with w and mask values.
- set_w(_w: float) grid_cell
Set the w value of the cell.
- Parameters:
_w (
float
) – The value to set.
- VGD_grid_cell_t
Alias of
grid_cell
. This alias will be deprecated in the future in favor ofgrid_cell
- class grid
Bases:
object
Interface to create and edit data within Vulcan grids.
- __init__(self) 'None'
Construct a new 1x1 grid with no values.
Overload
__init__(self, name: ‘str’) -> ‘None’
Load a grid file if it exists, otherwise construct a new 1x1 grid with no values.
- Parameters:
name (
str
) – The grid file to load, or the name to assign to the new grid.
Overload
__init__(self, x0: ‘float | int’, y0: ‘float | int’, dx: ‘float | int’, dy: ‘float | int’, nx: ‘int’, ny: ‘int’) -> ‘None’
Construct a new grid with given dimensions.
- Parameters:
x0 (
float
) – The x value of the origin of the grid.y0 (
float
) – The y value of the origin of the grid.dx (
float
) – The size of the grid cells in the x direction.dy (
float
) – The size of the grid cells in the y direction.nx (
int
) – The number of cells in the x direction.ny (
int
) – The number of cells in the y direction.
- clear()
Clear all values from the grid.
- load(name: str = '') int
Load a grid file into the current object.
- Parameters:
name (
str
) – The filepath of the grid file to load.
- save(name: str = '') int
Save the grid to file.
- Parameters:
name (
str
) – The filepath to save the grid to.
- load_esri(name: str = '') int
Load a grid from an ESRI TIN file.
- Parameters:
name (
str
) – The filepath of the ESRI TIN file to load.
- save_esri_ascii(name: str) int
Save a grid in a format readable by ESRI.
- Parameters:
name (
str
) – The filepath to save the grid to.
- __call__(i: int, j: int) grid_cell
Return a cell in the grid. grid(1, 2) returns the cell at position (1, 2)
- Parameters:
- Returns:
The cell.
- Return type:
- put_w(k: int, w: float)
Set the w value of a cell.
- Parameters:
k (
int
) – The index of the cell to set.w (
double
) – The w value to set.
- ij_to_pos(i: int, j: int) int
Convert an (i, j) cell index to a flattened index.
- Parameters:
- Returns:
The index of the cell.
- Return type:
Example
>>> 0 1 2 >>> 3 4 5 >>> 6 7 8 >>> >>> (0,3) using i,j indexing would have a flattened index of 6 for this 3x3 grid.
- get_w(self, k: 'int') 'int'
Get the w value of a cell using a flattened index.
- Parameters:
k (
int
) – The index of the cell to get.- Returns:
The w value of the cell.
- Return type:
Overload
get_w(self, x: ‘float’, y: ‘float’, w: ‘float’, mask: ‘int’)
Deprecated since version 2024.0.
- get_elevation_missing(x: float, y: float, w: float | None = None, mask: int | None = None) float
Get the interpolated value at a given position.
This does not assume unmasked values are valid.
- get_elevation_missing_mask(x: float, y: float, w: float | None = None, mask: int | None = None) int
Get the mask at a given position.
- set_x0(_x0: float) grid
Set the x coordinate of the grid origin.
- Parameters:
_x0 (
float
) – The value to set.
- set_y0(_y0: float) grid
Set the y coordinate of the grid origin.
- Parameters:
_y0 (
float
) – The value to set.
- set_dx(_dx: float) grid
Set the size of the grid cells in the x direction.
- Parameters:
_dx (
float
) – The value to set.
- set_dy(_dy: float) grid
Set the size of the grid cells in the y direction.
- Parameters:
_dy (
float
) – The value to set.
- copy(right: grid)
Copy the size and values from another grid into the current grid.
- Parameters:
right (
grid
) – The grid to copy from.
- basic_stats() tuple[float, float, float, float, int]
Compute some basic stats describing the grid.
- get_values() numpy.ndarray[float]
Get the w values from the grid as a NumPy array.
- Returns:
The w values from the grid.
- Return type:
numpy.ndarray[float]
- get_values_mask() numpy.ndarray[numpy.int64]
Get the mask values from the grid as a NumPy array.
- Returns:
The mask values from the grid.
- Return type:
numpy.ndarray[int]
- get_x_coordinates() numpy.ndarray[float]
Get the x coordinate values from the grid as a NumPy array.
- Returns:
The x coordinate values from the grid.
- Return type:
numpy.ndarray[float]
- get_y_coordinates() numpy.ndarray[float]
Get the y coordinate values from the grid as a NumPy array.
- Returns:
The y coordinate values from the grid.
- Return type:
numpy.ndarray[float]
- put_values(n0: numpy.ndarray[float])
Set the w values of the grid using a NumPy array.
- Parameters:
n0 (
numpy.ndarray[float]
) – The array containing the values to set. This should have the same dimensions as the grid itself.
- put_values_mask(n0: numpy.ndarray[int])
Set the mask values of the grid using a NumPy array.
- Parameters:
n0 (
numpy.ndarray[float]
) – The array containing the values to set. This should have the same dimensions as the grid itself.
- property ok
- __getitem__(index: int)
Get a cell out of the grid.
- Parameters:
index (
int
) – The flattened index of the cell to get.
See also
ij_to_pos
convert an (i, j) index to a flattened index.
- get_grid() numpy.ndarray[float]
Gets the values in the grid.
- Returns:
The values in the grid. This will be an array with the same shape as the grid itself.
- Return type:
numpy.ndarray[float]
- get_grid_mask() numpy.ndarray[numpy.int64]
Gets the masks of the grid.
- Returns:
The masks of the grid. This will be an array with the same shape as the grid itself.
- Return type:
numpy.ndarray[Int64]
- get_grid_x() numpy.ndarray[float]
Gets the X coordinates of the cells in the grid.
- Returns:
The X coordinates of the cells. This will be an array with the same shape as the grid itself.
- Return type:
numpy.ndarray[float]
- get_grid_y() numpy.ndarray[float]
Gets the list of all Y coordinates of the cells in the grid.
- Returns:
The Y coordinates of the cells. This will be an array with the same shape as the grid itself.
- Return type:
numpy.ndarray[float]
- put_grid(data: numpy.ndarray[float])
Sets the values in the grid to the values in ‘data’.
- Parameters:
data (
numpy.ndarray[float]
) – The values to put into the grid. This should be an array with the same shape as the grid itself.
- put_grid_mask(mask: numpy.ndarray[numpy.int64])
Sets the masks in the grid to the values in ‘mask’.
- Parameters:
mask (
numpy.ndarray[Int64]
) – The masks to put into the grid. This should be an array with the same shape as the grid itself.
- get_pandas() pandas.DataFrame
Get the values in the grid as a pandas DataFrame.
- Returns:
The values in the grid.
- Return type:
pandas.DataFrame
- put_pandas(dataframe: pandas.DataFrame) int
Sets the values in the grid from a pandas.DataFrame.
- Parameters:
dataframe (
pandas.DataFrame
) – Dataframe containing the values to set.- Returns:
0 on success.
- Return type:
- property pandas: pandas.DataFrame
Pandas DataFrame for vulcan.grid.
- save_formatted_spec(dictionary: dict, specName: str, sectionOrder: dict = {}) bool
Saves a dictionary into a formatted specfile.
- class dgd(name: str, mode: str = 'read')
Bases:
object
Interface for reading/editing Vulcan design databases.
- Parameters:
Example
>>> # Open and print the data of the first object of each layer. >>> with vulcan.dgd("mydata.dgd.isis", "read") as db: >>> for layer in db: >>> for obj in layer: >>> print(obj) >>> break
- Raises:
ValueError – When the database does not end with
`.dgd.isis`
Note
Opening the currently active dgd in Vulcan with the vulcan.dgd class can cause issues with data syncing on screen. All edits to an open dgd should be done through the vulcan_gui module.
Edits to the dgd through vulcan.dgd will not be reflected in Vulcan GUI without closing and reopening the dgd, and edits in the GUI can overwrite changes to the dgd.
- is_locked() bool
Returns dgd lock status by checking for lock files.
- Returns:
True if lock file is present, False otherwise.
- Return type:
- close()
Closes the dgd.
- get_layer(name: str) layer
Gets a layer from the database. If edited in in write mode, changes must be saved back by using
save_layer()
orsave_layer_as()
- is_open() bool
Checks if the database is open.
- Returns:
True if the database is open, False otherwise.
- Return type:
- save_layer_as(name: str, layerInstance: layer) bool
Saves a layer to the database with a new name.
- append(layerInstance: layer) bool
Adds a new layer to the database.
- Parameters:
layerInstance (
layer
) – The layer to append.- Returns:
True if successful, False otherwise.
- Return type:
- Raises:
ValueError – If layer already exists.
- __enter__()
Context manager for a design database. Automatically closes when scope ends. See
dgd
for parameters.
- is_valid_layer_name(layer_name: str) bool
Tests if a layer name is valid or not.
New in version 2024.2.
- get_valid_layer_name(layer_name: str) str
Returns a validated version of the provided layer name. Blank strings will still return blanks.
New in version 2024.2.
- class layer(name: str)
Bases:
object
Interface for Vulcan layers.
- Parameters:
name (
str
) – The name to assign to the layer.- Returns:
The created layer
- Return type:
- __eq__(other: layer) bool
Compares the layer with another given layer for equality.
- Returns:
True if the layers are equal, False otherwise.
- Return type:
- __ne__(other: layer) bool
Compares the layer with another given layer for inequality.
- Returns:
True if the layers are not equal, False otherwise.
- Return type:
- set_description(description: str)
Sets the layer description.
- Parameters:
description (
str
) – The description to set.
- clear_objects()
Deletes all objects from the layer.
- append(object: obj)
Appends an object to the layer.
- Parameters:
object (
obj
) – The object to append.
- get_objects_enumerate(types: list[type]) enumerate[int, obj]
Gets the objects of a specified types from a layer and layer indices.
- Parameters:
types (
list[type]
) – List of object types to get from the layer.- Yields:
list[idx,obj]
– Index of the Vulcan object of the specified types and the object.
Example
>>> types = [vulcan.polyline] >>> for i, obj in layer.get_objects_enumerate(types): >>> for pt in obj: >>> pt += 5 # Shift the object by 5 in x/y/z >>> layer[i] = obj
- get_objects(types: list[type]) Iterator[obj]
Gets the objects of a specified types from a layer. This is not suitable for putting objects back into layers with enumerate() since the objects are filtered and indices are unknown. To have indices for modifying objects, use get_objects_enumerate()
- Parameters:
types (
list
) – List of object types to get from the layer.- Yields:
vulcan.obj
– Vulcan object matching the specified types.
Example
>>> types = [vulcan.text, vulcan.text3d] >>> for obj in get_objects(types): >>> print (type(obj))
- class obj(*args, **kwargs)
Bases:
object
Base class for shared methods in design object datatypes. This base class cannot be constructed and must be instantiated through one of the other derived types.
See Also:
polyline
text
text3d
arrow
arrow3d
dim_angle
dim_arc
dim_line
dim_radius
- clear()
Clear out an object’s data.
- set_description(desc: str)
Sets the object description.
- Parameters:
desc (
str
) – The description to set.
- set_feature(feature: str)
Sets the object feature.
Defaults to searching the paths: VULCAN_CORPORATE > CWD > ENVIS_RESO. First found will be used.
Note
Layer information is not set automatically like in Vulcan.
- Parameters:
feature (
str
) – The feature to set.
- set_feature_with_file(feature: str, ignoreMissingFeatures: bool = True, featureFile: str = '')
Sets the object feature with a specific feature file.
Blank file will search the same as set_feature. If ignore flag is set, missing files and invalid feature codes will be set without attributes.
Note
Layer information is not set automatically like in Vulcan.
- Parameters:
- Raises:
ValueError – If ignoreMissingFeatures=False when missing feature codes.
FileNotFoundError – When files are missing.
- set_colour(colour: int)
Sets the object colour.
- Parameters:
colour (
int
) – The index of the colour to set.
- get_linktype(k: int) int
Gets the object link type.
- Parameters:
k (
int
) – Index of the link record to get the type of.
- get_attributes() attributes
Gets a reference to the object attribute data.
- set_attributes(attr: attributes)
Sets the object attribute data.
- Parameters:
attr (
attributes
) – The attributes to set.
- set_metadata(meta: metadata)
Sets the object metadata.
- Parameters:
meta (
metadata
) – The metadata to set.
- get_section_widths() section_widths
Gets a reference to the object section width data.
- set_section_widths(sect: section_widths)
Sets the object section width data.
- Parameters:
sect (
section_widths
) – The section width data to set.
- property attributes: attributes
Object attribute data
- property section_widths: section_widths
Object section width data
- class point(x: float = 0.0, y: float = 0.0, z: float = 0.0, w: float = 0.0, t: int = 0, name: str = '')
Bases:
object
Interface for Vulcan design points.
This class allows accessing points from Vulcan objects with the additional w-tag/t/name values over the basic x/y/z values.
- __init__(x: float = 0.0, y: float = 0.0, z: float = 0.0, w: float = 0.0, t: int = 0, name: str = '') None
Initialize a point.
- class polyline(points: list[point] = None)
Bases:
obj
Interface for Vulcan design polylines.
- __init__(points: list[point] = None) None
- Parameters:
points (
list[point]|list[float[3]]
,Optional
) – Optional list of points to build polyline from. Points can be a list ofpoint
or a list of values that will be used to build the points from. The points can have x, y, z, w, t, or n in that order. Missing values will be defaulted.
- get_linetype() list[int]
Gets the linetype as a list (style, thickness).
Style uses a 0 based index (0-7), while thickness uses a 1 based index (1-10).
- set_linetype(style: list[int])
Sets the linetype from a style and thickness.
Style uses a 0 based index (0-7), while thickness uses a 1 based index (1-10).
- Parameters:
style (
list[int]
) – A list of exactly length 2, containing the [style, thickness] to set.
- set_pattern(pattern: int)
Sets the pattern index of a line.
- Parameters:
pattern (
int
) – The index of the pattern to set.
- set_coordinates(pl: list[point] = None)
Sets the coordinates of a line from a list of x/y/z or vulcan.point
- set_connected(start: int = -1, end: int = -1, connected: bool = True)
Sets the connected state between a series of points.
This will create a continuous connection between all points between the start and end points.
set_connected(1, 4, True) will connect points 1-2, 2-3, 3-4.
set_connected(-1, -1, True) will connect all points in their index order.
set_connected(2, 3, False) will disconnect points 2-3.
set_connected(-1, -1, False) will disconnect all points.
- Parameters:
start (
int
) – The index of the point to start the connected chain. A value of -1 will start the connection from the point with the lowest index. Defaults to -1.end (
int
) – The index of the point to end the connected chain. A value of -1 will end the connectection at the point with the highest index. Defaults to -1.connected (
bool
) – A value of True will connect the points, False will disconnect the points.
- set_direction(dir: int = 0)
Sets the direction of a polyline.
- Parameters:
dir (
int
) – The direction to set; 0 for clockwise and 1 for counter clockwise.
- make_clockwise()
Makes a polyline clockwise.
- make_counter_clockwise()
Makes a polyline counter clockwise.
- planar_area(plan: bool = True) float
Gets the planar area of a polyline (in plan or a best fit plane).
- property attributes: attributes
Object attribute data
- clear()
Clear out an object’s data.
- get_attributes() attributes
Gets a reference to the object attribute data.
- get_linktype(k: int) int
Gets the object link type.
- Parameters:
k (
int
) – Index of the link record to get the type of.
- get_section_widths() section_widths
Gets a reference to the object section width data.
- property section_widths: section_widths
Object section width data
- set_attributes(attr: attributes)
Sets the object attribute data.
- Parameters:
attr (
attributes
) – The attributes to set.
- set_colour(colour: int)
Sets the object colour.
- Parameters:
colour (
int
) – The index of the colour to set.
- set_description(desc: str)
Sets the object description.
- Parameters:
desc (
str
) – The description to set.
- set_feature(feature: str)
Sets the object feature.
Defaults to searching the paths: VULCAN_CORPORATE > CWD > ENVIS_RESO. First found will be used.
Note
Layer information is not set automatically like in Vulcan.
- Parameters:
feature (
str
) – The feature to set.
- set_feature_with_file(feature: str, ignoreMissingFeatures: bool = True, featureFile: str = '')
Sets the object feature with a specific feature file.
Blank file will search the same as set_feature. If ignore flag is set, missing files and invalid feature codes will be set without attributes.
Note
Layer information is not set automatically like in Vulcan.
- Parameters:
- Raises:
ValueError – If ignoreMissingFeatures=False when missing feature codes.
FileNotFoundError – When files are missing.
- set_metadata(meta: metadata)
Sets the object metadata.
- Parameters:
meta (
metadata
) – The metadata to set.
- set_section_widths(sect: section_widths)
Sets the object section width data.
- Parameters:
sect (
section_widths
) – The section width data to set.
- class text(text: str = '')
Bases:
obj
Interface for Vulcan design text (2D).
- delete_all_lines()
Deletes all lines of text.
- set_origin(pt: point)
Sets the text origin point.
- Parameters:
pt (
point
) – The point to set as the text origin.
- is_framed() bool
Check if the text is framed.
- Returns:
True if the text is framed, False otherwise.
- Return type:
- set_framed(frame: bool = True)
Set the framed state of the text.
- Parameters:
frame (
bool
, optional) – True sets the text as framed, False sets the text as not framed.
- property attributes: attributes
Object attribute data
- clear()
Clear out an object’s data.
- get_attributes() attributes
Gets a reference to the object attribute data.
- get_linktype(k: int) int
Gets the object link type.
- Parameters:
k (
int
) – Index of the link record to get the type of.
- get_section_widths() section_widths
Gets a reference to the object section width data.
- property section_widths: section_widths
Object section width data
- set_attributes(attr: attributes)
Sets the object attribute data.
- Parameters:
attr (
attributes
) – The attributes to set.
- set_colour(colour: int)
Sets the object colour.
- Parameters:
colour (
int
) – The index of the colour to set.
- set_description(desc: str)
Sets the object description.
- Parameters:
desc (
str
) – The description to set.
- set_feature(feature: str)
Sets the object feature.
Defaults to searching the paths: VULCAN_CORPORATE > CWD > ENVIS_RESO. First found will be used.
Note
Layer information is not set automatically like in Vulcan.
- Parameters:
feature (
str
) – The feature to set.
- set_feature_with_file(feature: str, ignoreMissingFeatures: bool = True, featureFile: str = '')
Sets the object feature with a specific feature file.
Blank file will search the same as set_feature. If ignore flag is set, missing files and invalid feature codes will be set without attributes.
Note
Layer information is not set automatically like in Vulcan.
- Parameters:
- Raises:
ValueError – If ignoreMissingFeatures=False when missing feature codes.
FileNotFoundError – When files are missing.
- set_metadata(meta: metadata)
Sets the object metadata.
- Parameters:
meta (
metadata
) – The metadata to set.
- set_section_widths(sect: section_widths)
Sets the object section width data.
- Parameters:
sect (
section_widths
) – The section width data to set.
- class text3d(text: str = '')
Bases:
obj
Interface for Vulcan design text (3D)
- delete_line(line_num: int)
Deletes a line of text.
- Parameters:
line_num (
int
) – The line number to remove.
- delete_all_lines()
Deletes all lines of text.
- set_origin(pt: point)
Sets the origin point.
- Parameters:
pt (
point
) – The point to set as the text origin.
- set_direction(direction: point)
Sets the text direction.
- Parameters:
direction (
point
) – The point containing the x/y/z direction to set.
- set_normal(normal: point)
Sets the text normal.
- Parameters:
normal (
point
) – The point to use as the normal.
- set_italic(italic: bool = True)
Sets the font italics.
- Parameters:
italic (
bool
) – True to set the text as italic, False to set the text as not italic.
- set_mirrored_vertical(mirror: bool = True)
Set the text as mirrored vertically.
- Parameters:
mirror (
bool
) – True to mirror the text, False to not mirror the text.
- set_mirrored_horizontal(mirror: bool = True)
Set the text as mirrored horizontally.
- Parameters:
mirror (
bool
) – True to mirror the text, False to not mirror the text.
- set_horizontal_align(alignment: str)
Sets the horizontal alignment.
- Parameters:
alignment (
str
) – The alignment to set. Options are [“LEFT”, “CENTRE”, “RIGHT”]
- set_vertical_align(alignment: str)
Sets the vertical alignment.
- Parameters:
alignment (
str
) – The alignment to set. Options are [“BOTTOM”, “CENTRE”, “TOP”]
- property attributes: attributes
Object attribute data
- clear()
Clear out an object’s data.
- get_attributes() attributes
Gets a reference to the object attribute data.
- get_linktype(k: int) int
Gets the object link type.
- Parameters:
k (
int
) – Index of the link record to get the type of.
- get_section_widths() section_widths
Gets a reference to the object section width data.
- property section_widths: section_widths
Object section width data
- set_attributes(attr: attributes)
Sets the object attribute data.
- Parameters:
attr (
attributes
) – The attributes to set.
- set_colour(colour: int)
Sets the object colour.
- Parameters:
colour (
int
) – The index of the colour to set.
- set_description(desc: str)
Sets the object description.
- Parameters:
desc (
str
) – The description to set.
- set_feature(feature: str)
Sets the object feature.
Defaults to searching the paths: VULCAN_CORPORATE > CWD > ENVIS_RESO. First found will be used.
Note
Layer information is not set automatically like in Vulcan.
- Parameters:
feature (
str
) – The feature to set.
- set_feature_with_file(feature: str, ignoreMissingFeatures: bool = True, featureFile: str = '')
Sets the object feature with a specific feature file.
Blank file will search the same as set_feature. If ignore flag is set, missing files and invalid feature codes will be set without attributes.
Note
Layer information is not set automatically like in Vulcan.
- Parameters:
- Raises:
ValueError – If ignoreMissingFeatures=False when missing feature codes.
FileNotFoundError – When files are missing.
- set_metadata(meta: metadata)
Sets the object metadata.
- Parameters:
meta (
metadata
) – The metadata to set.
- set_section_widths(sect: section_widths)
Sets the object section width data.
- Parameters:
sect (
section_widths
) – The section width data to set.
- class arrow
Bases:
obj
Interface for Vulcan design arrows.
- __init__()
Interface for Vulcan design arrows.
- set_start(point: point)
Sets the arrow starting point.
- Parameters:
point (
point
) – The point to use as the arrow start point.
- set_end(point: point)
Sets the arrow end point.
- Parameters:
point (
point
) – The point to use as the arrow end point.
- set_normal(point: point)
Sets the arrow normal.
- Parameters:
point (
point
) – The point to use as the normal.
- set_auto_scale(autoscale: bool = True)
Sets the arrow auto scale setting.
- Parameters:
autoscale (
bool
) – True to auto scale, False to manually scale.
- set_filled(filled: bool = True)
Sets the arrow fill setting.
- Parameters:
filled (
bool
) – True to set the arrow as filled, False to not fill.
- set_num_facets(facets: int)
Sets the number of facets.
- Parameters:
facets (
int
) – The number of facets to set.
- set_head_length(percentage: float)
Sets the arrow head length.
- Parameters:
percentage (
float
) – The percentage of the arrow’s length to use as the head.
- set_head_width(percentage: float)
Sets the arrow head width.
- Parameters:
percentage (
float
) – The percentage of the arrow’s width to use as the head.
- property attributes: attributes
Object attribute data
- clear()
Clear out an object’s data.
- get_attributes() attributes
Gets a reference to the object attribute data.
- get_linktype(k: int) int
Gets the object link type.
- Parameters:
k (
int
) – Index of the link record to get the type of.
- get_section_widths() section_widths
Gets a reference to the object section width data.
- property section_widths: section_widths
Object section width data
- set_attributes(attr: attributes)
Sets the object attribute data.
- Parameters:
attr (
attributes
) – The attributes to set.
- set_colour(colour: int)
Sets the object colour.
- Parameters:
colour (
int
) – The index of the colour to set.
- set_description(desc: str)
Sets the object description.
- Parameters:
desc (
str
) – The description to set.
- set_feature(feature: str)
Sets the object feature.
Defaults to searching the paths: VULCAN_CORPORATE > CWD > ENVIS_RESO. First found will be used.
Note
Layer information is not set automatically like in Vulcan.
- Parameters:
feature (
str
) – The feature to set.
- set_feature_with_file(feature: str, ignoreMissingFeatures: bool = True, featureFile: str = '')
Sets the object feature with a specific feature file.
Blank file will search the same as set_feature. If ignore flag is set, missing files and invalid feature codes will be set without attributes.
Note
Layer information is not set automatically like in Vulcan.
- Parameters:
- Raises:
ValueError – If ignoreMissingFeatures=False when missing feature codes.
FileNotFoundError – When files are missing.
- set_metadata(meta: metadata)
Sets the object metadata.
- Parameters:
meta (
metadata
) – The metadata to set.
- set_section_widths(sect: section_widths)
Sets the object section width data.
- Parameters:
sect (
section_widths
) – The section width data to set.
- class dimension(*args, **kwargs)
Bases:
obj
Base class for Vulcan design dimensions.
- set_scale(scale: str)
Sets the dimension scale.
- Parameters:
scale (
str
) – The scale to set. This is a string in the form of a ratio, i.e. “1:1000”.
- property attributes: attributes
Object attribute data
- clear()
Clear out an object’s data.
- get_attributes() attributes
Gets a reference to the object attribute data.
- get_linktype(k: int) int
Gets the object link type.
- Parameters:
k (
int
) – Index of the link record to get the type of.
- get_section_widths() section_widths
Gets a reference to the object section width data.
- property section_widths: section_widths
Object section width data
- set_attributes(attr: attributes)
Sets the object attribute data.
- Parameters:
attr (
attributes
) – The attributes to set.
- set_colour(colour: int)
Sets the object colour.
- Parameters:
colour (
int
) – The index of the colour to set.
- set_description(desc: str)
Sets the object description.
- Parameters:
desc (
str
) – The description to set.
- set_feature(feature: str)
Sets the object feature.
Defaults to searching the paths: VULCAN_CORPORATE > CWD > ENVIS_RESO. First found will be used.
Note
Layer information is not set automatically like in Vulcan.
- Parameters:
feature (
str
) – The feature to set.
- set_feature_with_file(feature: str, ignoreMissingFeatures: bool = True, featureFile: str = '')
Sets the object feature with a specific feature file.
Blank file will search the same as set_feature. If ignore flag is set, missing files and invalid feature codes will be set without attributes.
Note
Layer information is not set automatically like in Vulcan.
- Parameters:
- Raises:
ValueError – If ignoreMissingFeatures=False when missing feature codes.
FileNotFoundError – When files are missing.
- set_metadata(meta: metadata)
Sets the object metadata.
- Parameters:
meta (
metadata
) – The metadata to set.
- set_section_widths(sect: section_widths)
Sets the object section width data.
- Parameters:
sect (
section_widths
) – The section width data to set.
- class dim_angle
Bases:
dimension
Interface for Vulcan design dimension angles.
- __init__()
Interface for Vulcan design dimension angles.
- swap_points()
Swaps the dimension points.
- property attributes: attributes
Object attribute data
- clear()
Clear out an object’s data.
- get_attributes() attributes
Gets a reference to the object attribute data.
- get_linktype(k: int) int
Gets the object link type.
- Parameters:
k (
int
) – Index of the link record to get the type of.
- get_section_widths() section_widths
Gets a reference to the object section width data.
- property section_widths: section_widths
Object section width data
- set_attributes(attr: attributes)
Sets the object attribute data.
- Parameters:
attr (
attributes
) – The attributes to set.
- set_colour(colour: int)
Sets the object colour.
- Parameters:
colour (
int
) – The index of the colour to set.
- set_description(desc: str)
Sets the object description.
- Parameters:
desc (
str
) – The description to set.
- set_feature(feature: str)
Sets the object feature.
Defaults to searching the paths: VULCAN_CORPORATE > CWD > ENVIS_RESO. First found will be used.
Note
Layer information is not set automatically like in Vulcan.
- Parameters:
feature (
str
) – The feature to set.
- set_feature_with_file(feature: str, ignoreMissingFeatures: bool = True, featureFile: str = '')
Sets the object feature with a specific feature file.
Blank file will search the same as set_feature. If ignore flag is set, missing files and invalid feature codes will be set without attributes.
Note
Layer information is not set automatically like in Vulcan.
- Parameters:
- Raises:
ValueError – If ignoreMissingFeatures=False when missing feature codes.
FileNotFoundError – When files are missing.
- set_metadata(meta: metadata)
Sets the object metadata.
- Parameters:
meta (
metadata
) – The metadata to set.
- set_scale(scale: str)
Sets the dimension scale.
- Parameters:
scale (
str
) – The scale to set. This is a string in the form of a ratio, i.e. “1:1000”.
- set_section_widths(sect: section_widths)
Sets the object section width data.
- Parameters:
sect (
section_widths
) – The section width data to set.
- class dim_arc
Bases:
dimension
Interface for Vulcan design dimension arcs.
- __init__()
Interface for Vulcan design dimension arcs.
- swap_points()
Swaps the dimension points.
- property attributes: attributes
Object attribute data
- clear()
Clear out an object’s data.
- get_attributes() attributes
Gets a reference to the object attribute data.
- get_linktype(k: int) int
Gets the object link type.
- Parameters:
k (
int
) – Index of the link record to get the type of.
- get_section_widths() section_widths
Gets a reference to the object section width data.
- property section_widths: section_widths
Object section width data
- set_attributes(attr: attributes)
Sets the object attribute data.
- Parameters:
attr (
attributes
) – The attributes to set.
- set_colour(colour: int)
Sets the object colour.
- Parameters:
colour (
int
) – The index of the colour to set.
- set_description(desc: str)
Sets the object description.
- Parameters:
desc (
str
) – The description to set.
- set_feature(feature: str)
Sets the object feature.
Defaults to searching the paths: VULCAN_CORPORATE > CWD > ENVIS_RESO. First found will be used.
Note
Layer information is not set automatically like in Vulcan.
- Parameters:
feature (
str
) – The feature to set.
- set_feature_with_file(feature: str, ignoreMissingFeatures: bool = True, featureFile: str = '')
Sets the object feature with a specific feature file.
Blank file will search the same as set_feature. If ignore flag is set, missing files and invalid feature codes will be set without attributes.
Note
Layer information is not set automatically like in Vulcan.
- Parameters:
- Raises:
ValueError – If ignoreMissingFeatures=False when missing feature codes.
FileNotFoundError – When files are missing.
- set_metadata(meta: metadata)
Sets the object metadata.
- Parameters:
meta (
metadata
) – The metadata to set.
- set_scale(scale: str)
Sets the dimension scale.
- Parameters:
scale (
str
) – The scale to set. This is a string in the form of a ratio, i.e. “1:1000”.
- set_section_widths(sect: section_widths)
Sets the object section width data.
- Parameters:
sect (
section_widths
) – The section width data to set.
- class dim_line
Bases:
dimension
Interface for Vulcan design dimension lines.
- __init__()
Interface for Vulcan design dimension lines.
- swap_points()
Swaps the dimension points.
- property attributes: attributes
Object attribute data
- clear()
Clear out an object’s data.
- get_attributes() attributes
Gets a reference to the object attribute data.
- get_linktype(k: int) int
Gets the object link type.
- Parameters:
k (
int
) – Index of the link record to get the type of.
- get_section_widths() section_widths
Gets a reference to the object section width data.
- property section_widths: section_widths
Object section width data
- set_attributes(attr: attributes)
Sets the object attribute data.
- Parameters:
attr (
attributes
) – The attributes to set.
- set_colour(colour: int)
Sets the object colour.
- Parameters:
colour (
int
) – The index of the colour to set.
- set_description(desc: str)
Sets the object description.
- Parameters:
desc (
str
) – The description to set.
- set_feature(feature: str)
Sets the object feature.
Defaults to searching the paths: VULCAN_CORPORATE > CWD > ENVIS_RESO. First found will be used.
Note
Layer information is not set automatically like in Vulcan.
- Parameters:
feature (
str
) – The feature to set.
- set_feature_with_file(feature: str, ignoreMissingFeatures: bool = True, featureFile: str = '')
Sets the object feature with a specific feature file.
Blank file will search the same as set_feature. If ignore flag is set, missing files and invalid feature codes will be set without attributes.
Note
Layer information is not set automatically like in Vulcan.
- Parameters:
- Raises:
ValueError – If ignoreMissingFeatures=False when missing feature codes.
FileNotFoundError – When files are missing.
- set_metadata(meta: metadata)
Sets the object metadata.
- Parameters:
meta (
metadata
) – The metadata to set.
- set_scale(scale: str)
Sets the dimension scale.
- Parameters:
scale (
str
) – The scale to set. This is a string in the form of a ratio, i.e. “1:1000”.
- set_section_widths(sect: section_widths)
Sets the object section width data.
- Parameters:
sect (
section_widths
) – The section width data to set.
- class dim_radius
Bases:
dimension
Interface for Vulcan design dimension radii.
- __init__()
Interface for Vulcan design dimension radii.
- swap_points()
Swaps the dimension points.
- property attributes: attributes
Object attribute data
- clear()
Clear out an object’s data.
- get_attributes() attributes
Gets a reference to the object attribute data.
- get_linktype(k: int) int
Gets the object link type.
- Parameters:
k (
int
) – Index of the link record to get the type of.
- get_section_widths() section_widths
Gets a reference to the object section width data.
- property section_widths: section_widths
Object section width data
- set_attributes(attr: attributes)
Sets the object attribute data.
- Parameters:
attr (
attributes
) – The attributes to set.
- set_colour(colour: int)
Sets the object colour.
- Parameters:
colour (
int
) – The index of the colour to set.
- set_description(desc: str)
Sets the object description.
- Parameters:
desc (
str
) – The description to set.
- set_feature(feature: str)
Sets the object feature.
Defaults to searching the paths: VULCAN_CORPORATE > CWD > ENVIS_RESO. First found will be used.
Note
Layer information is not set automatically like in Vulcan.
- Parameters:
feature (
str
) – The feature to set.
- set_feature_with_file(feature: str, ignoreMissingFeatures: bool = True, featureFile: str = '')
Sets the object feature with a specific feature file.
Blank file will search the same as set_feature. If ignore flag is set, missing files and invalid feature codes will be set without attributes.
Note
Layer information is not set automatically like in Vulcan.
- Parameters:
- Raises:
ValueError – If ignoreMissingFeatures=False when missing feature codes.
FileNotFoundError – When files are missing.
- set_metadata(meta: metadata)
Sets the object metadata.
- Parameters:
meta (
metadata
) – The metadata to set.
- set_scale(scale: str)
Sets the dimension scale.
- Parameters:
scale (
str
) – The scale to set. This is a string in the form of a ratio, i.e. “1:1000”.
- set_section_widths(sect: section_widths)
Sets the object section width data.
- Parameters:
sect (
section_widths
) – The section width data to set.
- class callback(func: Callable = None)
Bases:
swig_callback
Callback creator for Vulcan utilities. Create a callback and pass it to a function that uses it.
Example
>>> def my_func(*args, **kwargs): >>> return {"result" : "new data"} >>> cb = vulcan.callback(my_func)
- set_callback(func: Callable)
Sets a callback from a callable function.
- __call__(*args, **kwargs)
Executes stored function and passes the return back to the C++ code.
`*args`
and`**kwargs`
are passed through to the callback.
- class attributes
Bases:
object
Class for accessing object attribute data.
- __init__()
Class for accessing object attribute data.
- attribute_list(templateName: str, templateVariant: dict = {}) list[str]
List of attributes in a given template. Ordered by the second argument template
- get_date_attribute(temp: str, attribute: str) datetime.datetime
Gets a date attribute as a Python datetime object.
- class metadata
Bases:
object
Class for manipulating object metadata.
- __init__()
Class for manipulating object metadata.
- get_timestamp(field: str) datetime.datetime
Gets a timestamp of a field.
- class section_widths
Bases:
object
Controls section widths of an object
- __init__()
Controls section widths of an object
- class compare_isis(isis_name_0: str = '', isis_name_1: str = '')
Bases:
object
Interface to allow comparing two isis databases.
- __init__(isis_name_0: str = '', isis_name_1: str = '') None
Initializes a new compare_isis object.
- clear()
Clears the comparison information.
- compare() bool
Compares the two isis databases provided.
- Returns:
True if equal, False otherwise.
- Return type:
- get_check_key_match(self) std::string
- class compare_tris(tri_name_0: str = '', tri_name_1: str = '')
Bases:
object
Interface to compare two triangulations.
- clear()
Clears the comparison information.
- compare() bool
Compares the two triangulations provided.
- Returns:
True if equal, False otherwise.
- Return type:
- class compare_grids(grid_name_0: str = '', grid_name_1: str = '')
Bases:
object
Interface to allow comparing two grids.
- __init__(grid_name_0: str = '', grid_name_1: str = '') None
Initializes a new compare_grids object.
- clear()
Clears the comparison information.
- compare() bool
Compares the two grids provided.
- Returns:
True if equal, False otherwise.
- Return type:
- set_check_extents(on_off: bool, tol: float = 0.0001)
Sets whether to extents are included for comparison.
- class compare_dgds(dgd_name_0: str = '', dgd_name_1: str = '')
Bases:
object
Interface to allow comparing two dgds.
- clear()
Clears the comparison information.
- compare(layer_name: str = '') bool
Compares the two dgds provided.
- Returns:
True if equal, False otherwise.
- Return type:
- set_check_object_description(on_off: bool)
Sets whether to include object descriptions for comparison.
- class compare_blockmodels(model_name_0: str = '', model_name_1: str = '')
Bases:
object
Interface to allow comparing two block models.
- __init__(model_name_0: str = '', model_name_1: str = '') None
Initializes a new compare_blockmodels object.
- set_blockmodels(model_name_0: str, model_name_1: str)
Sets the block model files to use for comparison.
- clear()
Clears the comparison information.
- compare() bool
Compares the two block models provided.
- Returns:
True if equal, False otherwise.
- Return type:
- set_check_origin(on_off: bool, tol: float = 0.0001)
Sets whether to include origins for comparison.
- set_check_rotation(on_off: bool, tol: float = 0.0001)
Sets whether to check rotation when comparing.
- set_check_variable_value(on_off: bool, tol: float = 0.0001)
Sets whether to include variable values when comparing.
- enum field_type(value)
Bases:
IntEnum
Options for the field types.
- Member Type:
Valid values are as follows:
- ERROR = <field_type.ERROR: -1>
- CHAR = <field_type.CHAR: 0>
- INT32 = <field_type.INT32: 1>
- FLOAT32 = <field_type.FLOAT32: 2>
- FLOAT64 = <field_type.FLOAT64: 3>
- MISSING = <field_type.MISSING: 4>
- enum design_type(value)
Bases:
StrEnum
Options for the design types.
- Member Type:
Valid values are as follows:
- BLOCKOUT = <design_type.BLOCKOUT: 'Blockout'>
- DRILLING = <design_type.DRILLING: 'Drilling'>
- GEOTECH = <design_type.GEOTECH: 'Geotech'>
- class Synonyms
Bases:
object
- class Drilling
Bases:
object
- enum Table(value)
Bases:
StrEnum
Options for drilling table synonyms.
- Member Type:
Valid values are as follows:
- HOLE_ID = <Table.HOLE_ID: 'HoleId'>
- LOCATION = <Table.LOCATION: 'Location'>
- HOLE_ID_LOCATION = <Table.HOLE_ID_LOCATION: 'HoleId,Location'>
- GEOLOGICAL = <Table.GEOLOGICAL: 'Geological'>
- ASSAY = <Table.ASSAY: 'Assay'>
- ANALYTICAL = <Table.ANALYTICAL: 'Analytical'>
- SURVEY = <Table.SURVEY: 'Survey'>
- GEOTECH = <Table.GEOTECH: 'Geotech'>
- enum Hole_Id(value)
Bases:
StrEnum
Options for drilling holeid synonyms.
- Member Type:
Valid values are as follows:
- HOLE_ID = <Hole_Id.HOLE_ID: 'HoleId'>
- enum Location(value)
Bases:
StrEnum
Options for drilling location synonyms.
- Member Type:
Valid values are as follows:
- EASTING = <Location.EASTING: 'Easting'>
- NORTHING = <Location.NORTHING: 'Northing'>
- ELEVATION = <Location.ELEVATION: 'Elevation'>
- TOTAL_DEPTH = <Location.TOTAL_DEPTH: 'TotalDepth'>
- enum Geological(value)
Bases:
StrEnum
Options for drilling geological synonyms.
- Member Type:
Valid values are as follows:
- HORIZON = <Geological.HORIZON: 'Horizon'>
- ROCK_TYPE = <Geological.ROCK_TYPE: 'RockType'>
- PLY = <Geological.PLY: 'Ply'>
- SAMPLE_NUM = <Geological.SAMPLE_NUM: 'SampleNum'>
- TOP_DEPTH = <Geological.TOP_DEPTH: 'TopDepth'>
- BOTTOM_DEPTH = <Geological.BOTTOM_DEPTH: 'BottomDepth'>
- NEXT_MODIFIER = <Geological.NEXT_MODIFIER: 'NextModifier'>
- CONTINUATION = <Geological.CONTINUATION: 'Continuation'>
- PERCENTAGE = <Geological.PERCENTAGE: 'Percentage'>
- enum Assay(value)
Bases:
StrEnum
Options for drilling assay synonyms.
- Member Type:
Valid values are as follows:
- HORIZON = <Assay.HORIZON: 'Horizon'>
- BOTTOM_DEPTH = <Assay.BOTTOM_DEPTH: 'BottomDepth'>
- ASSAY1 = <Assay.ASSAY1: 'Assay1'>
- ASSAY2 = <Assay.ASSAY2: 'Assay2'>
- ASSAY3 = <Assay.ASSAY3: 'Assay3'>
- ASSAY4 = <Assay.ASSAY4: 'Assay4'>
- enum Analytical(value)
Bases:
StrEnum
Options for drilling analytical synonyms.
- Member Type:
Valid values are as follows:
- HORIZON = <Analytical.HORIZON: 'Horizon'>
- BOTTOM_DEPTH = <Analytical.BOTTOM_DEPTH: 'BottomDepth'>
- ANALYTICAL1 = <Analytical.ANALYTICAL1: 'Analytical1'>
- ANALYTICAL2 = <Analytical.ANALYTICAL2: 'Analytical2'>
- ANALYTICAL3 = <Analytical.ANALYTICAL3: 'Analytical3'>
- ANALYTICAL4 = <Analytical.ANALYTICAL4: 'Analytical4'>
- enum Survey(value)
Bases:
StrEnum
Options for drilling survey synonyms.
- Member Type:
Valid values are as follows:
- INCLINATION = <Survey.INCLINATION: 'Inclination'>
- BEARING = <Survey.BEARING: 'Bearing'>
- INTERCEPT_DEPTH = <Survey.INTERCEPT_DEPTH: 'InterceptDepth'>
- enum Geotech(value)
Bases:
StrEnum
Options for drilling geotech synonyms.
- Member Type:
Valid values are as follows:
- DEPTH = <Geotech.DEPTH: 'Depth'>
- ALPHA = <Geotech.ALPHA: 'Alpha'>
- BETA = <Geotech.BETA: 'Beta'>
- __init__()
- class Blockout
Bases:
object
- enum Table(value)
Bases:
StrEnum
Options for blockout table synonyms.
- Member Type:
Valid values are as follows:
- BLAST_SOLID_POINTS = <Table.BLAST_SOLID_POINTS: 'blast_solid_points'>
- BLAST_SOLID_TRIS = <Table.BLAST_SOLID_TRIS: 'blast_solid_tris'>
- GRADE_BLOCK_SOLID_POINTS = <Table.GRADE_BLOCK_SOLID_POINTS: 'grade_block_solid_points'>
- GRADE_BLOCK_SOLID_TRIS = <Table.GRADE_BLOCK_SOLID_TRIS: 'grade_block_solid_tris'>
- STRING_HEADER = <Table.STRING_HEADER: 'string_header'>
- STRING_POINTS = <Table.STRING_POINTS: 'string_points'>
- STRING_TRIANGLES = <Table.STRING_TRIANGLES: 'string_triangles'>
- POLY_POINTS = <Table.POLY_POINTS: 'poly_points'>
- GRADE_BLOCKS = <Table.GRADE_BLOCKS: 'grade_blocks'>
- BLOCK_MODEL_GRADES = <Table.BLOCK_MODEL_GRADES: 'block_model_grades'>
- BLOCK_MODEL_GRADE_BLOCKS = <Table.BLOCK_MODEL_GRADE_BLOCKS: 'block_model_grade_blocks'>
- FACE_POINTS = <Table.FACE_POINTS: 'face_points'>
- HOLE_COLLARS = <Table.HOLE_COLLARS: 'hole_collars'>
- enum Blast_Solid_Points(value)
Bases:
StrEnum
Options for blockout blast solid points synonyms.
- Member Type:
Valid values are as follows:
- POINT_NO = <Blast_Solid_Points.POINT_NO: 'point_no'>
- EASTING = <Blast_Solid_Points.EASTING: 'Easting'>
- NORTHING = <Blast_Solid_Points.NORTHING: 'Northing'>
- ELEVATION = <Blast_Solid_Points.ELEVATION: 'Elevation'>
- enum Blast_Solid_Tris(value)
Bases:
StrEnum
Options for blockout blast solid tris synonyms.
- Member Type:
Valid values are as follows:
- TRI_NO = <Blast_Solid_Tris.TRI_NO: 'tri_no'>
- POINT1 = <Blast_Solid_Tris.POINT1: 'point1'>
- POINT2 = <Blast_Solid_Tris.POINT2: 'point2'>
- POINT3 = <Blast_Solid_Tris.POINT3: 'point3'>
- enum Grade_Block_Solid_Points(value)
Bases:
StrEnum
Options for blockout grade block solid points synonyms.
- Member Type:
Valid values are as follows:
- POINT_NO = <Grade_Block_Solid_Points.POINT_NO: 'point_no'>
- EASTING = <Grade_Block_Solid_Points.EASTING: 'Easting'>
- NORTHING = <Grade_Block_Solid_Points.NORTHING: 'Northing'>
- ELEVATION = <Grade_Block_Solid_Points.ELEVATION: 'Elevation'>
- enum Grade_Block_Solid_Tris(value)
Bases:
StrEnum
Options for blockout grade block solid tris synonyms.
- Member Type:
Valid values are as follows:
- TRI_NO = <Grade_Block_Solid_Tris.TRI_NO: 'tri_no'>
- POINT1 = <Grade_Block_Solid_Tris.POINT1: 'point1'>
- POINT2 = <Grade_Block_Solid_Tris.POINT2: 'point2'>
- POINT3 = <Grade_Block_Solid_Tris.POINT3: 'point3'>
- enum String_Header(value)
Bases:
StrEnum
- Member Type:
Valid values are as follows:
- STRING_NO = <String_Header.STRING_NO: 'string_no'>
- STRING_TYPE = <String_Header.STRING_TYPE: 'string_type'>
- enum String_Points(value)
Bases:
StrEnum
- Member Type:
Valid values are as follows:
- STRING_NO = <String_Points.STRING_NO: 'string_no'>
- POINT_NO = <String_Points.POINT_NO: 'point_no'>
- EASTING = <String_Points.EASTING: 'Easting'>
- NORTHING = <String_Points.NORTHING: 'Northing'>
- ELEVATION = <String_Points.ELEVATION: 'Elevation'>
- enum String_Triangles(value)
Bases:
StrEnum
- Member Type:
Valid values are as follows:
- STRING_NO = <String_Triangles.STRING_NO: 'string_no'>
- TRI_NO = <String_Triangles.TRI_NO: 'tri_no'>
- POINT1 = <String_Triangles.POINT1: 'point1'>
- POINT2 = <String_Triangles.POINT2: 'point2'>
- POINT3 = <String_Triangles.POINT3: 'point3'>
- enum Poly_Points(value)
Bases:
StrEnum
- Member Type:
Valid values are as follows:
- POINT_NO = <Poly_Points.POINT_NO: 'point_no'>
- EASTING = <Poly_Points.EASTING: 'Easting'>
- NORTHING = <Poly_Points.NORTHING: 'Northing'>
- ELEVATION = <Poly_Points.ELEVATION: 'Elevation'>
- enum Grade_Blocks(value)
Bases:
StrEnum
- Member Type:
Valid values are as follows:
- VOLUME = <Grade_Blocks.VOLUME: 'volume'>
- EASTING = <Grade_Blocks.EASTING: 'Easting'>
- NORTHING = <Grade_Blocks.NORTHING: 'Northing'>
- ELEVATION = <Grade_Blocks.ELEVATION: 'Elevation'>
- EASTING_USER = <Grade_Blocks.EASTING_USER: 'Easting_user'>
- NORTHING_USER = <Grade_Blocks.NORTHING_USER: 'Northing_user'>
- ELEVATION_USER = <Grade_Blocks.ELEVATION_USER: 'Elevation_user'>
- enum Block_Model_Grades(value)
Bases:
StrEnum
- Member Type:
Valid values are as follows:
- BLOCK_MODEL = <Block_Model_Grades.BLOCK_MODEL: 'block_model'>
- VOLUME = <Block_Model_Grades.VOLUME: 'volume'>
- enum Block_Model_Grade_Blocks(value)
Bases:
StrEnum
- Member Type:
Valid values are as follows:
- BLOCK_MODEL = <Block_Model_Grade_Blocks.BLOCK_MODEL: 'block_model'>
- VOLUME = <Block_Model_Grade_Blocks.VOLUME: 'volume'>
- enum Face_Points(value)
Bases:
StrEnum
- Member Type:
Valid values are as follows:
- POINT_NO = <Face_Points.POINT_NO: 'point_no'>
- EASTING = <Face_Points.EASTING: 'Easting'>
- NORTHING = <Face_Points.NORTHING: 'Northing'>
- ELEVATION = <Face_Points.ELEVATION: 'Elevation'>
- enum Hole_Collars(value)
Bases:
StrEnum
- Member Type:
Valid values are as follows:
- HOLE_NO = <Hole_Collars.HOLE_NO: 'hole_no'>
- EASTING = <Hole_Collars.EASTING: 'Easting'>
- NORTHING = <Hole_Collars.NORTHING: 'Northing'>
- ELEVATION = <Hole_Collars.ELEVATION: 'Elevation'>
- INTERCEPT_DEPTH = <Hole_Collars.INTERCEPT_DEPTH: 'InterceptDepth'>
- BEARING = <Hole_Collars.BEARING: 'Bearing'>
- INCLINATION = <Hole_Collars.INCLINATION: 'Inclination'>
- __init__()
- class Geotech
Bases:
object
- enum Table(value)
Bases:
StrEnum
- Member Type:
Valid values are as follows:
- HEADER = <Table.HEADER: 'Header'>
- GEOTECH = <Table.GEOTECH: 'Geotech'>
- enum Header(value)
Bases:
StrEnum
- Member Type:
Valid values are as follows:
- AREA = <Header.AREA: 'Area'>
- enum Geotech(value)
Bases:
StrEnum
- Member Type:
Valid values are as follows:
- SITE_ID = <Geotech.SITE_ID: 'SiteId'>
- TYPE = <Geotech.TYPE: 'Type'>
- EASTING = <Geotech.EASTING: 'Easting'>
- NORTHING = <Geotech.NORTHING: 'Northing'>
- ELEVATION = <Geotech.ELEVATION: 'Elevation'>
- DIP = <Geotech.DIP: 'Dip'>
- DIP_DIRECTION = <Geotech.DIP_DIRECTION: 'DipDirection'>
- SOURCE = <Geotech.SOURCE: 'Source'>
- COMMENT = <Geotech.COMMENT: 'Comment'>
- FAULT = <Geotech.FAULT: 'Fault'>
- STRIKE = <Geotech.STRIKE: 'Strike'>
- ORIENTATION = <Geotech.ORIENTATION: 'Orientation'>
- LENGTH = <Geotech.LENGTH: 'Length'>
- SPACING = <Geotech.SPACING: 'Spacing'>
- THROW = <Geotech.THROW: 'Throw'>
- SCAN_DISTANCE = <Geotech.SCAN_DISTANCE: 'ScanDistance'>
- WEIGHT = <Geotech.WEIGHT: 'Weight'>
- __init__()
- __init__()
- class isis_field(*args, **kwargs)
Bases:
object
Exposes an interface to edit Isis fields. Can be created by calling isis_table.add_field()
- is_numeric()
Check whether the field type is numeric.
- Returns:
True if numeric; false otherwise.
- Return type:
- property type: field_type
The type of the field.
- map_odbc_column(odbc_column_name: str)
Map an ODBC source column to this Isis field.
- Parameters:
odbc_column_name (
str
) – The name of the column in the data source.
Warning
This function performs no validation. It is up to the caller to ensure inputs match the data source.
See also
isis_design.apply_odbc_mappings
Apply ODBC data source changes.
- class isis_table(*args, **kwargs)
Bases:
object
Exposes an interface to edit Isis tables. Can be created by calling isis_design.add_table()
- get_field(self, field: 'int') 'isis_field'
Get a given field from the table.
- Parameters:
field (
int|str
) – The index (or name) of the field within the table.- Returns:
The field with the given index/name.
- Return type:
- Raises:
IndexError – If index/name doesn’t exist on the table.
- num_fields() int
Get the number of fields associated with the table.
- Returns:
The number of associated fields.
- Return type:
- add_field(field_name: str, field_type: field_type = field_type.ERROR, field_synonym: str = '', field_description: str = '', field_length: int = 12, decimal_precision: int = 3)
Add a new field to the table.
- Parameters:
field_name (
str
) – The name to assign to the new field.field_type (
field_type
) – The type to assign to the field. Defaults to field_type.ERROR See vulcan.field_type for options.field_synonym (
str
) – The synonym to assign to the field. See vulcan.Synonyms for options.field_description (
str (Optional)
) – The description to assign to the field.field_length (
int
) – The length to assign to the new field. Defaults to 12.decimal_precision (
int
) – The number of decimal places the field is accurate to. Defaults to 3 for float type fields, 0 otherwise.
- Returns:
The new field.
- Return type:
- Raises:
ValueError – If field length is less than 1, text field length is greater than 256, numeric field length is greater than 1024, precision is less than 0, field name is empty or contains whitespace, or field type is MISSING or ERROR.
- delete_field(self, field_index: 'int') 'bool'
Remove a field from the table.
- Parameters:
field_index (
int
) – The index of the field to remove.- Returns:
True if successful.
- Return type:
- Raises:
IndexError – If field_index doesn’t exist.
Overload
delete_field(self, field_name: ‘str’) -> ‘bool’
Remove a field from the table.
- Parameters:
field_name (
str
) – The name of the field to remove.- Returns:
True if successful.
- Return type:
- Raises:
IndexError – If field with name doesn’t exist.
- map_odbc_table(odbc_table_name: str, odbc_sort_column_name: str = '')
Map an ODBC source table to this Isis table.
- Parameters:
Warning
This function performs no validation. It is up to the caller to ensure inputs match the data source.
See also
isis_design.apply_odbc_mappings
Apply ODBC data source changes.
- class isis_design(*args, **kwargs)
Bases:
object
Exposes an interface to create and edit Isis database designs. Must be instantiated with
isis_design.create_design()
orisis_design.load_design()
- static create_design(type: design_type, description: str = '') isis_design
Create a new design.
- Parameters:
design_type (
design_type
) – The type of the design.description (
str
) – The description of the design.
- Returns:
The new design.
- Return type:
- static load_design(design_file: str) isis_design
Load an existing design.
- save_design(design_file: str) bool
Save the design to file.
- Parameters:
design_file (
str
) – The file path to save the design to.- Returns:
True if design saves successfully. If false, failures can be checked with get_errors().
- Return type:
- Raises:
ValueError – If design is invalid.
OSError – If design_file is an already existing file
- is_valid() bool
Checks if the design is valid. Also occurs when saving.
- Returns:
True if design saves successfully. If false, failures can be checked with get_errors().
- Return type:
- Raises:
ValueError – If design is invalid.
- add_table(table_name: str, table_synonym: str = None, table_description: str = None)
Add a table to the design.
- Parameters:
table_name (
str.
) – The name to give the newly constructed table.table_synonym (
str
) – The synonym to assign to the table. See vulcan.Synonyms for options.table_description (
str (Optional)
) – The description to assign to the table. Defaults to ‘Created via Python script.’.
- Returns:
The table added to the design.
- Return type:
- Raises:
ValueError – If table name is empty or contains whitespace.
- get_field_index(table: int | str, field_name: str) int
Return the index of a field within a given table.
- Parameters:
table (
int | str
) – The index (or name) of the table within the design to search for the given field.field_name (
str
) – The name of the field to search for.
- Returns:
The index of the field within the given table.
- Return type:
- Raises:
IndexError – If table doesn’t exist.
- get_field_name(table: int | str, field_index: int) str
Return the name of a field within a given table.
- Parameters:
table (
int | str
) – The index (or name) of the table within the design to search for the given field.field_index (
int
) – The index of the field within the given table.
- Returns:
The name of the given field within the given table.
- Return type:
- Raises:
IndexError – If table or field_index don’t exist.
- get_field_type(table: int | str, field: int | str) field_type
Return the type of a field within a given table.
- Parameters:
table (
int | str
) – The index (or name) of the table within the design to search for the given field.field (
int | str
) – The index (or name) of the field within the given table.
- Returns:
The type of the given field within the given table.
- Return type:
- Raises:
IndexError – If table or field don’t exist.
- get_table_description(table: int | str) str
Return the description of a given table.
- Parameters:
table (
int | str
) – The index (or name) of the table within the design to get the description from.- Returns:
The description of the table.
- Return type:
- Raises:
IndexError – If table doesn’t exist.
- get_field_description(table: int | str, field: int | str) str
Return the description of a given field.
- Parameters:
table (
int | str
) – The index (or name) of the field’s parent table within the design.field (
int | str
) – The index (or name) of the field within its table.
- Returns:
The description of the field.
- Return type:
- Raises:
IndexError – If table or field don’t exist.
- get_field_length(table: int | str, field: int | str) int
Return the length of a given field.
- Parameters:
table (
int | str
) – The index (or name) of the field’s parent table within the design.field (
int | str
) – The index (or name) of the field within its table.
- Returns:
The length of the given field.
- Return type:
- Raises:
IndexError – If table or field don’t exist.
- num_decimals(self, table_index: 'int', field_index: 'int') 'int'
Return the number of decimal places a given field is accurate to.
- Parameters:
- Returns:
The number of decimal places.
- Return type:
- Raises:
IndexError – If table_index or field_index don’t exist.
Overload
num_decimals(self, table_name: ‘str’, field_name: ‘str’) -> ‘int’
Return the number of decimal places a given field is accurate to.
- Parameters:
- Returns:
The number of decimal places.
- Return type:
- Raises:
IndexError – If table_name or field_name don’t exist.
- set_field_type(table: int | str, field: int | str, field_type: field_type) bool
Set the field type of a given field.
- Parameters:
table (
int | str
) – The index (or name) of the field’s parent table within the design.field (
int | str
) – The index (or name) of the field within its table.field_type (
field_type
) – The type to set the field to.
- Returns:
True if successful; false otherwise.
- Return type:
- Raises:
ValueError – If field_type is MISSING or ERROR.
IndexError – If table or field don’t exist.
- set_field_length(table: int | str, field: int | str, field_length: int) bool
Set the field length of a given field.
- Parameters:
table (
int|str
) – The index of the field’s parent table within the design.field (
int|str
) – The index of the field within its table.field_length (
int
) – The length to set the field to.
- Returns:
True if successful; false otherwise.
- Return type:
- Raises:
ValueError – If field length is less than 1, greater than 256 for text fields, or greater than 1024 for numeric fields.
IndexError – If table or field don’t exist.
- get_table_name(table_index: int) str
Return the name of a table at a given index.
- Parameters:
table_index (
int
) – The index of the table within the design,- Returns:
The name of the table at the given index.
- Return type:
- Raises:
IndexError – If table_index doesn’t exist.
- num_fields(table_index: int | str) int
Return the number of fields within a given table.
- Parameters:
table_index (
int|str
) – The index (or name) of the table to retrieve number of fields from.- Returns:
The number of fields within the given table.
- Return type:
- Raises:
IndexError – If table_index doesn’t exist.
- get_table(table: int | str) isis_table
Return the table at a given index.
- Parameters:
table (
int|str
) – The index (or name) of the table within the design.- Returns:
The table at the given index.
- Return type:
- Raises:
IndexError – If table doesn’t exist.
- property type: design_type
The type of the design.
- get_dsr() [<class 'int'>, <class 'float'>, <class 'float'>]
Return the design’s Dsr style, interval and tolerance.
- Returns:
int
– The Dsr style.double
– The Dsr interval.double
– The Dsr tolerance.A return
of[0
,0.0
,0.0] indicates there is no Dsr defined
- clear_keys()
Clear the keys from the design.
- set_odbc_data_source(data_source: str, username: str = '', password: str = '')
Set an odbc data source for the design.
- Parameters:
Warning
This function performs no validation. It is up to the caller to ensure inputs match the data source.
See also
apply_odbc_mappings
Apply ODBC data source changes.
- apply_odbc_mappings()
Apply the currently set mappings for DSN, tables and fields to the design.
This function is required for any currently set source information to take effect.
- remove_odbc_mappings()
Remove all the ODBC mappings applied to the design, tables and fields.
- get_errors() list[str]
Get the list of errors identified by the design.
- Returns:
The list of errors identified by the design during save or load.
- Return type:
list[str]
- clear()
Reset the design to default values, clearning any tables, fields, synonyms, keys and errors.