db.geometry package

Submodules

db.geometry.model_geometries module

Contains ModelGeometries class

class db.geometry.model_geometries.ModelGeometries[source]

Bases: object

Class used to store abstract geometry of parts of a geological model and its data It should be independent as possible of any model’s input format Each class only stores data for 1 volume, but for many line segments and triangle faces All sequence numbers for _*_arr start at 1

_atom_arr = None

Array of named tuples ‘ATOM’ used to store atom data

_ijk_data = None

Generic property data associated with IJK volume indexes First point is (0,0,0) This is an array of a dictionary mapping (I,J,K) => [data1, data2, data3, … ]

_max_data = None

Array of maximum values in ‘xyz_data’ or ‘vol_data’

_min_data = None

Array of minimum value in ‘xyz_data’ or ‘vol_data’

_no_data_marker = None

Array of values indicating no data exists at a point in space

_seg_arr = None

Array of named tuples ‘SEG’ used to store line segment data

_trgl_arr = None

Array of named tuples ‘TRGL’ used store triangle face data

_vrtx_arr = None

Array of named tuples ‘VRTX’ used to store vertex data

_xyz_data = None

Generic property data associated with XYZ points This is an array of a dictionary mapping (X,Y,Z) => [data1, data2, data3, … ]

add_loose_3d_data(is_xyz, data_dict)[source]

Adds an instance of XYZ data :param is_xyz: True iff xyz data (float, float, float) else ijk (int, int, int) data :param data_dict: dictionary of (X,Y,Z) => data, or (I,J,K) => data values to be added

add_stats(min_val, max_val, no_data)[source]

Adds minimum, maximum and no data marker :param min_val: minimum value :param max_val: maximum value :param no_data: value used in a dataset when no data is recorded for a location

atom_arr

Returns array of ATOM objects

calc_minmax(x_coord, y_coord, z_coord)[source]

Calculates and stores the max and min of all x,y,z coords

Parameters:y_coord, z_coord (x_coord,) – x,y,z coords (python or numpy float)
get_extent()[source]
Returns:estimate of the geographic extent of the model, using max and min coordinate values format is [min_x, max_x, min_y, max_y]
get_loose_3d_data(is_xyz, idx=0)[source]

Retrieves data from xyz data dictionary :param is_xyz: True iff xyz data (float, float, float) else ijk (int, int, int) data :param idx: index for when there are multiple values for each point in space, omit for volumes :returns: dictionary of (X,Y,Z) => data value or (I,J,K) => data value

get_max_data(idx=0)[source]

Retrieves maximum value of data point :param idx: index into property data, omit for volume data :returns: maximum data value

get_min_data(idx=0)[source]

Retrieves minimum value of data point :param idx: index into property data, omit for volume data :returns: minimum data value

get_no_data_marker(idx=0)[source]

Retrieve no data marker :param idx: index into property data, omit for volume data :returns: no data marker

get_rotation()[source]
Returns:three unit vectors of the volume’s XYZ axes
get_vol_side_lengths()[source]
Returns:the lengths of the sides of a volume in [X, Y, Z] form, where X,Y,Z are floats
is_line()[source]

Returns True iff this contails line data

is_point()[source]

Returns True iff this contains point data

is_single_layer_vo()[source]

Returns True if this is extracted from a GOCAD VOXEL that only has a single layer and should be converted into a PNG instead of a GLTF

is_trgl()[source]

Returns True iff this contains triangle data

is_vert_line = None

Is true for wells that are represented by vertical lines

is_volume()[source]

Returns True iff this contains volume data

line_width = None

If this contains lines, desired line width

max_x = None

Maximum X coordinate, used to calculate extent

max_y = None

Maximum Y coordinate, used to calculate extent

max_z = None

Maximum Z coordinate, used to calculate extent

min_x = None

Minimum X coordinate, used to calculate extent

min_y = None

Minimum Y coordinate, used to calculate extent

min_z = None

Minimum Z coordinate, used to calculate extent

seg_arr

Returns array of SEG objects

trgl_arr

Returns array of TRGL objects

vol_axis_u = None

Full length U-axis volume vector

vol_axis_v = None

Full length V-axis volume vector

vol_axis_w = None

Full length W-axis volume vector

vol_data = None

3d numpy array of volume data

vol_data_type = None

Type of data in ‘vol_data’/’_xyz_data’ e.g. ‘FLOAT_32’ ‘INT_16’, ‘RGBA’ NB: If >8 bits, always stored in big-endian fashion

vol_origin = None

Origin of volume’s XYZ axes

vol_sz = None

3 dimensional size of voxel volume

vrtx_arr

Returns array of VRTX objects

db.geometry.model_geometries.unit_vector(vector)[source]
Returns:the unit vector of the vector.

db.geometry.types module

Contains named tuples of basic types, independent of any geological model file format

class db.geometry.types.ATOM(n, v)

Bases: tuple

Immutable named tuple which stores atom data

N:sequence number
V:vertex it refers to
_asdict()

Return a new OrderedDict which maps field names to their values.

_fields = ('n', 'v')
classmethod _make(iterable, new=<built-in method __new__ of type object at 0x9d43a0>, len=<built-in function len>)

Make a new ATOM object from a sequence or iterable

_replace(_self, **kwds)

Return a new ATOM object replacing specified fields with new values

_source = "from builtins import property as _property, tuple as _tuple\nfrom operator import itemgetter as _itemgetter\nfrom collections import OrderedDict\n\nclass ATOM(tuple):\n 'ATOM(n, v)'\n\n __slots__ = ()\n\n _fields = ('n', 'v')\n\n def __new__(_cls, n, v):\n 'Create new instance of ATOM(n, v)'\n return _tuple.__new__(_cls, (n, v))\n\n @classmethod\n def _make(cls, iterable, new=tuple.__new__, len=len):\n 'Make a new ATOM object from a sequence or iterable'\n result = new(cls, iterable)\n if len(result) != 2:\n raise TypeError('Expected 2 arguments, got %d' % len(result))\n return result\n\n def _replace(_self, **kwds):\n 'Return a new ATOM object replacing specified fields with new values'\n result = _self._make(map(kwds.pop, ('n', 'v'), _self))\n if kwds:\n raise ValueError('Got unexpected field names: %r' % list(kwds))\n return result\n\n def __repr__(self):\n 'Return a nicely formatted representation string'\n return self.__class__.__name__ + '(n=%r, v=%r)' % self\n\n def _asdict(self):\n 'Return a new OrderedDict which maps field names to their values.'\n return OrderedDict(zip(self._fields, self))\n\n def __getnewargs__(self):\n 'Return self as a plain tuple. Used by copy and pickle.'\n return tuple(self)\n\n n = _property(_itemgetter(0), doc='Alias for field number 0')\n\n v = _property(_itemgetter(1), doc='Alias for field number 1')\n\n"
count(value) → integer -- return number of occurrences of value
index(value[, start[, stop]]) → integer -- return first index of value.

Raises ValueError if the value is not present.

n

Alias for field number 0

v

Alias for field number 1

class db.geometry.types.SEG(ab)

Bases: tuple

Immutable named tuple which stores segment data

Ab:segment vertices
_asdict()

Return a new OrderedDict which maps field names to their values.

_fields = ('ab',)
classmethod _make(iterable, new=<built-in method __new__ of type object at 0x9d43a0>, len=<built-in function len>)

Make a new SEG object from a sequence or iterable

_replace(_self, **kwds)

Return a new SEG object replacing specified fields with new values

_source = "from builtins import property as _property, tuple as _tuple\nfrom operator import itemgetter as _itemgetter\nfrom collections import OrderedDict\n\nclass SEG(tuple):\n 'SEG(ab,)'\n\n __slots__ = ()\n\n _fields = ('ab',)\n\n def __new__(_cls, ab,):\n 'Create new instance of SEG(ab,)'\n return _tuple.__new__(_cls, (ab,))\n\n @classmethod\n def _make(cls, iterable, new=tuple.__new__, len=len):\n 'Make a new SEG object from a sequence or iterable'\n result = new(cls, iterable)\n if len(result) != 1:\n raise TypeError('Expected 1 arguments, got %d' % len(result))\n return result\n\n def _replace(_self, **kwds):\n 'Return a new SEG object replacing specified fields with new values'\n result = _self._make(map(kwds.pop, ('ab',), _self))\n if kwds:\n raise ValueError('Got unexpected field names: %r' % list(kwds))\n return result\n\n def __repr__(self):\n 'Return a nicely formatted representation string'\n return self.__class__.__name__ + '(ab=%r)' % self\n\n def _asdict(self):\n 'Return a new OrderedDict which maps field names to their values.'\n return OrderedDict(zip(self._fields, self))\n\n def __getnewargs__(self):\n 'Return self as a plain tuple. Used by copy and pickle.'\n return tuple(self)\n\n ab = _property(_itemgetter(0), doc='Alias for field number 0')\n\n"
ab

Alias for field number 0

count(value) → integer -- return number of occurrences of value
index(value[, start[, stop]]) → integer -- return first index of value.

Raises ValueError if the value is not present.

class db.geometry.types.TRGL(n, abc)

Bases: tuple

Immutable named tuple which stores triangle data

N:sequence number
Abc:triangle vertices
_asdict()

Return a new OrderedDict which maps field names to their values.

_fields = ('n', 'abc')
classmethod _make(iterable, new=<built-in method __new__ of type object at 0x9d43a0>, len=<built-in function len>)

Make a new TRGL object from a sequence or iterable

_replace(_self, **kwds)

Return a new TRGL object replacing specified fields with new values

_source = "from builtins import property as _property, tuple as _tuple\nfrom operator import itemgetter as _itemgetter\nfrom collections import OrderedDict\n\nclass TRGL(tuple):\n 'TRGL(n, abc)'\n\n __slots__ = ()\n\n _fields = ('n', 'abc')\n\n def __new__(_cls, n, abc):\n 'Create new instance of TRGL(n, abc)'\n return _tuple.__new__(_cls, (n, abc))\n\n @classmethod\n def _make(cls, iterable, new=tuple.__new__, len=len):\n 'Make a new TRGL object from a sequence or iterable'\n result = new(cls, iterable)\n if len(result) != 2:\n raise TypeError('Expected 2 arguments, got %d' % len(result))\n return result\n\n def _replace(_self, **kwds):\n 'Return a new TRGL object replacing specified fields with new values'\n result = _self._make(map(kwds.pop, ('n', 'abc'), _self))\n if kwds:\n raise ValueError('Got unexpected field names: %r' % list(kwds))\n return result\n\n def __repr__(self):\n 'Return a nicely formatted representation string'\n return self.__class__.__name__ + '(n=%r, abc=%r)' % self\n\n def _asdict(self):\n 'Return a new OrderedDict which maps field names to their values.'\n return OrderedDict(zip(self._fields, self))\n\n def __getnewargs__(self):\n 'Return self as a plain tuple. Used by copy and pickle.'\n return tuple(self)\n\n n = _property(_itemgetter(0), doc='Alias for field number 0')\n\n abc = _property(_itemgetter(1), doc='Alias for field number 1')\n\n"
abc

Alias for field number 1

count(value) → integer -- return number of occurrences of value
index(value[, start[, stop]]) → integer -- return first index of value.

Raises ValueError if the value is not present.

n

Alias for field number 0

class db.geometry.types.VRTX(n, xyz)

Bases: tuple

Immutable named tuple which stores vertex data

N:sequence number
Xyz:coordinates
_asdict()

Return a new OrderedDict which maps field names to their values.

_fields = ('n', 'xyz')
classmethod _make(iterable, new=<built-in method __new__ of type object at 0x9d43a0>, len=<built-in function len>)

Make a new VRTX object from a sequence or iterable

_replace(_self, **kwds)

Return a new VRTX object replacing specified fields with new values

_source = "from builtins import property as _property, tuple as _tuple\nfrom operator import itemgetter as _itemgetter\nfrom collections import OrderedDict\n\nclass VRTX(tuple):\n 'VRTX(n, xyz)'\n\n __slots__ = ()\n\n _fields = ('n', 'xyz')\n\n def __new__(_cls, n, xyz):\n 'Create new instance of VRTX(n, xyz)'\n return _tuple.__new__(_cls, (n, xyz))\n\n @classmethod\n def _make(cls, iterable, new=tuple.__new__, len=len):\n 'Make a new VRTX object from a sequence or iterable'\n result = new(cls, iterable)\n if len(result) != 2:\n raise TypeError('Expected 2 arguments, got %d' % len(result))\n return result\n\n def _replace(_self, **kwds):\n 'Return a new VRTX object replacing specified fields with new values'\n result = _self._make(map(kwds.pop, ('n', 'xyz'), _self))\n if kwds:\n raise ValueError('Got unexpected field names: %r' % list(kwds))\n return result\n\n def __repr__(self):\n 'Return a nicely formatted representation string'\n return self.__class__.__name__ + '(n=%r, xyz=%r)' % self\n\n def _asdict(self):\n 'Return a new OrderedDict which maps field names to their values.'\n return OrderedDict(zip(self._fields, self))\n\n def __getnewargs__(self):\n 'Return self as a plain tuple. Used by copy and pickle.'\n return tuple(self)\n\n n = _property(_itemgetter(0), doc='Alias for field number 0')\n\n xyz = _property(_itemgetter(1), doc='Alias for field number 1')\n\n"
count(value) → integer -- return number of occurrences of value
index(value[, start[, stop]]) → integer -- return first index of value.

Raises ValueError if the value is not present.

n

Alias for field number 0

xyz

Alias for field number 1

Module contents