mapteksdk.geologycore.fields module

Module containing the class and enums representing fields.

Fields are the ‘columns’ of a table in a drillhole database. Each field stores data of a particular type for a particular purpose.

UNKNOWN_FIELD_TYPE = 'UNKNOWN_FIELD_TYPE'

String constant used to represent an unknown field type.

This will cause an error to be raised if it is passed as the dtype to a numpy function.

class DrillholeFieldType(value)

Bases: Enum

Enumeration of supported common field types.

The field type indicates what the data in the field is intended to represent.

NONE = ''

This field stores custom data not covered by another field type.

EASTING = 'Easting'
NORTHING = 'Northing'
ELEVATION = 'RL'
TOTAL_DEPTH = 'Total depth'
FROM_DEPTH = 'From depth'
TO_DEPTH = 'To depth'
THICKNESS = 'Thickness'
ROCK_TYPE = 'Rock type'
HORIZON = 'Horizon'
DEPTH = 'Depth'
AZIMUTH = 'Azimuth'
DIP = 'Dip'
UNKNOWN = '?'
can_be_repeated()

True if a table can contain multiple fields of this type.

Return type

bool

supports_data_type(data_type)

Determine if this field type supports the specified data type.

Parameters

data_type (dtype) – Data type to check if it is supported.

Returns

True if the data type is supported.

Return type

bool

property is_built_in: bool

If the field is a built in field.

This will return False for DrillholeFieldType.NONE and True for every other field type.

property is_custom: bool

If the field is a user-defined field.

This is the inverse of is_built_in.

property supports_distance_units: bool

True if this field type supports distance units.

property supports_angle_units: bool

True if the field type supports angle units.

property default_unit: DistanceUnit | AngleUnit | NO_UNIT

The default unit for fields of this type.

This is NO_UNIT for the OTHER field type, metres for distance fields and radians for angle fields.

class BaseField(field_information)

Bases: object

Base class containing shared functionality for field objects.

Parameters

field_information (dict) – The field information used to construct this object. Scripts should not construct these objects directly and thus should never need to provide this.

property name: str

The name of the field.

This is a user-provided string. It may differ for equivalent fields in different databases.

property field_type: DrillholeFieldType

The kind of data stored in this field.

The field type indicates the kind of data stored in this field. Fields with the same field type store the same kind of data even if they are part of different drillhole databases (though the way that data is represented may still vary based on the database conventions, unit and data_type of the field).

property data_type: dtype

The type of the data stored in this field.

property unit: DistanceUnit | AngleUnit | UnsupportedUnit | NO_UNIT

The unit of the data stored in this field.

This will be a DistanceUnit for the following field types: * Easting * Northing * Elevation * Total depth * To depth * From depth * Thickness * Depth

This will be an AngleUnit for the following field types: * Azimuth * Dip

If a field has a unit which is neither a DistanceUnit or an AngleUnit, it will be represented as an UnsupportedUnit.

If a field has no unit information at all, this will be NO_UNIT.

property is_numeric: bool

If the data type is numeric.

This is True if this field can be used to colour the drillhole using a NumericColourMap.

property is_string: bool

If the data type is a string.

This is True if this field can be used to colour the drillhole using a StringColourMap.

property description: str

User provided description of the field.

This can be used to provide additional details on the data stored in this field.

property is_read_only: bool

True if the field is read-only.

class FieldInformation(field_information)

Bases: BaseField

Access metadata of a field.

This class represents the configuration of the field and cannot be used to access any of the values in the database.

Changes made to this object are made to all of the fields for all of the drillholes in the drillhole database.

Parameters

field_information (dict) –

property description: str

User provided description of the field.

This can be used to provide additional details on the data stored in this field.

property field_type: DrillholeFieldType

The kind of data stored in this field.

The field type indicates the kind of data stored in this field. Fields with the same field type store the same kind of data even if they are part of different drillhole databases (though the way that data is represented may still vary based on the database conventions, unit and data_type of the field).

property unit: DistanceUnit | AngleUnit | UnsupportedUnit | NO_UNIT

The unit of the data stored in this field.

This will be a DistanceUnit for the following field types: * Easting * Northing * Elevation * Total depth * To depth * From depth * Thickness * Depth

This will be an AngleUnit for the following field types: * Azimuth * Dip

If a field has a unit which is neither a DistanceUnit or an AngleUnit, it will be represented as an UnsupportedUnit.

If a field has no unit information at all, this will be NO_UNIT.

delete()

Deletes this field from the database.

This will not raise an error if the field has already been deleted.

Warning

Deleting a field will permanently delete all values in that field for all drillholes in the database. There is no way to undo this change once it is done.

property data_type: dtype

The type of the data stored in this field.

property is_numeric: bool

If the data type is numeric.

This is True if this field can be used to colour the drillhole using a NumericColourMap.

property is_read_only: bool

True if the field is read-only.

property is_string: bool

If the data type is a string.

This is True if this field can be used to colour the drillhole using a StringColourMap.

property name: str

The name of the field.

This is a user-provided string. It may differ for equivalent fields in different databases.

class DrillholeDatabaseField(field_information)

Bases: BaseField

A field retrieved from a drillhole.

This allows access to the values of the field for a specific drillhole. The number of values stored in a particular field will vary between drillholes, but will be the same for all fields in the same drillhole and table.

Parameters

field_information (dict) –

property data_type: dtype

The type of the data stored in this field.

property description: str

User provided description of the field.

This can be used to provide additional details on the data stored in this field.

property field_type: DrillholeFieldType

The kind of data stored in this field.

The field type indicates the kind of data stored in this field. Fields with the same field type store the same kind of data even if they are part of different drillhole databases (though the way that data is represented may still vary based on the database conventions, unit and data_type of the field).

property is_numeric: bool

If the data type is numeric.

This is True if this field can be used to colour the drillhole using a NumericColourMap.

property is_read_only: bool

True if the field is read-only.

property is_string: bool

If the data type is a string.

This is True if this field can be used to colour the drillhole using a StringColourMap.

property name: str

The name of the field.

This is a user-provided string. It may differ for equivalent fields in different databases.

property unit: DistanceUnit | AngleUnit | UnsupportedUnit | NO_UNIT

The unit of the data stored in this field.

This will be a DistanceUnit for the following field types: * Easting * Northing * Elevation * Total depth * To depth * From depth * Thickness * Depth

This will be an AngleUnit for the following field types: * Azimuth * Dip

If a field has a unit which is neither a DistanceUnit or an AngleUnit, it will be represented as an UnsupportedUnit.

If a field has no unit information at all, this will be NO_UNIT.

property values: MaskedArray

Masked numpy array containing the values for this field.

The array may contain invalid values as indicated by the array mask. The type of the data stored in this array is determined by the data_type property of this object.

Raises
  • ValueError – If attempting to set this property in read-only mode or to an array of an incorrect shape.

  • NotImplementedError – If reading data for the data_type of this field is not implemented.

Notes

  • This cannot be resized by assigning an array with a different length. Call add_rows and remove_rows on the table to add/remove values from this array.

  • For string fields, the strings in the array have a fixed length. Assigning an array of longer strings to this property will cause a new array containing longer strings to be allocated. This invalidates any existing references to the values in this array.