Skip to content

Drillholes🍋

Drillholes 🍋

Bases: GeoRefObject

Object representing a 3D group of drillhole. Each drillhole is identified by a unique holeid.

Parameters:

Name Type Description Default
name str

object name.

required
xyz Optional[Data]

geometry data, respectively X, Y and Z.

None
holeid Optional[Data]

unique identifier for each drillhole.

None
start Optional[Data]

starting depth of edges. Sorted by ascending holeid and descending z.

None
end Optional[Data]

ending depth of edges. Sorted by ascending holeid and descending z.

None

Raises:

Type Description
ValueError
  • Holeid is not defined at all points.
  • Holeid are not grouped.
  • Start is defined but not end or vice-versa.
  • Start greater than end when provided.
  • Start or end values are not sorted.

Example

import geolime as geo
import numpy as np
import pandas as pd
hid = np.array(
    ["A", "A", "C", "F", "A", "B", "C", "A", "E", "D", "B", "C", "E"]
)
xyz = np.array([
    [0,   0,   2,   5,   0,   1,   2,   0,   4,   3,   1,   2,   4],  # noqa
    [0,   0,   2,   5,   0,   1,   2,   0,   4,   3,   1,   2,   4],  # noqa
    [0,  -2,  -4,   1,  -5,   0,  -3,  -3,  -2,   2,  -3,  -2,   0]   # noqa
])
df = pd.DataFrame({
    geo.Attribute.HOLEID: hid,
    geo.Coord.X: xyz[0],
    geo.Coord.Y: xyz[1],
    geo.Coord.Z: xyz[2]
})
df.sort_values([geo.Attribute.HOLEID, geo.Coord.Z], ascending=[True, False], inplace=True)

dh = geo.Drillholes("test", df[['X', 'Y', 'Z']].to_numpy(), df.HOLEID)

aggregate(properties=None, agg_methods=[AggregationMethod.SUM, AggregationMethod.MIN, AggregationMethod.MAX, AggregationMethod.MEAN, AggregationMethod.FIRST]) 🍋

Return the object data grouped by location (X, Y) and hole ID.

Parameters:

Name Type Description Default
properties Optional[List[str]]

list of properties name to transfer to the GIS Object. Setting to None or empty list will select all existing properties.

None
agg_methods List[AggregationMethod]

aggregation data methods. See pandas.DataFrame.groupby to find out supported methods.

[AggregationMethod.SUM, AggregationMethod.MIN, AggregationMethod.MAX, AggregationMethod.MEAN, AggregationMethod.FIRST]

Returns:

Type Description
pd.DataFrame

DataFrame of XY coordinates with aggregated data.

Raises:

Type Description
ValueError
  • No aggregation method is provided.
  • 'X', 'Y' or 'HOLEID' are part of the properties.
AttributeError

One of the aggregation methods is not supported.

collar_coords() 🍋

Return only coordinates of collars, being top location of each drillhole.

Returns:

Type Description
np.ndarray

XYZ coordinates of collars.

Example

import geolime as geo
import numpy as np
import pandas as pd
hid = np.array(
    ["A", "A", "C", "F", "A", "B", "C", "A", "E", "D", "B", "C", "E"]
)
xyz = np.array([
    [0,   0,   2,   5,   0,   1,   2,   0,   4,   3,   1,   2,   4],  # noqa
    [0,   0,   2,   5,   0,   1,   2,   0,   4,   3,   1,   2,   4],  # noqa
    [0,  -2,  -4,   1,  -5,   0,  -3,  -3,  -2,   2,  -3,  -2,   0]   # noqa
])
df = pd.DataFrame({
    geo.Attribute.HOLEID: hid,
    geo.Coord.X: xyz[0],
    geo.Coord.Y: xyz[1],
    geo.Coord.Z: xyz[2]
})
df.sort_values([geo.Attribute.HOLEID, geo.Coord.Z], ascending=[True, False], inplace=True)

dh = geo.Drillholes("test", df[['X', 'Y', 'Z']].to_numpy(), df.HOLEID)
dh.collar_coords()
Output
array([[ 0,  0,  0],
    [ 1,  1,  0],
    [ 2,  2, -2],
    [ 3,  3,  2],
    [ 4,  4,  0],
    [ 5,  5,  1]])

coords(region=None) 🍋

Provided for convenience, return the composites mid-points (see mid_coords()).

Parameters:

Name Type Description Default
region Optional[str]

Object region or condition to select data from.

None

Returns:

Type Description
np.ndarray

XYZ of the mid-points of each composite.

Example

import geolime as geo
import numpy as np
import pandas as pd
hid = np.array(
    ["A", "A", "C", "F", "A", "B", "C", "A", "E", "D", "B", "C", "E"]
)
xyz = np.array([
    [0,   0,   2,   5,   0,   1,   2,   0,   4,   3,   1,   2,   4],  # noqa
    [0,   0,   2,   5,   0,   1,   2,   0,   4,   3,   1,   2,   4],  # noqa
    [0,  -2,  -4,   1,  -5,   0,  -3,  -3,  -2,   2,  -3,  -2,   0]   # noqa
])
df = pd.DataFrame({
    geo.Attribute.HOLEID: hid,
    geo.Coord.X: xyz[0],
    geo.Coord.Y: xyz[1],
    geo.Coord.Z: xyz[2]
})
df.sort_values([geo.Attribute.HOLEID, geo.Coord.Z], ascending=[True, False], inplace=True)

dh = geo.Drillholes("test", df[['X', 'Y', 'Z']].to_numpy(), df.HOLEID)
dh.coords()
Output
array([[ 0. ,  0. , -1. ],
    [ 0. ,  0. , -2.5],
    [ 0. ,  0. , -4. ],
    [ 1. ,  1. , -1.5],
    [ 2. ,  2. , -2.5],
    [ 2. ,  2. , -3.5],
    [ 4. ,  4. , -1. ]])

delete_composites(region) 🍋

Delete composites in region.

Parameters:

Name Type Description Default
region str

Region to select composites.

required

delete_holes(region, method=DrillHolesSelectionMethod.ALL) 🍋

Delete Holes in region.

Selections are any or all composites from a hole in a region.

Parameters:

Name Type Description Default
region str

Region to select holes.

required
method DrillHolesSelectionMethod

Method of selection of holes, might be any composite or all composites.

DrillHolesSelectionMethod.ALL

Raises:

Type Description
ValueError
  • A dynamic expression is provided instead of a region.
  • Region does not exist.
  • Selection method is not supported.

element_count() 🍋

Return the number of drillholes in the Drillholes group.

Returns:

Type Description
int

Number of drillholes.

Example

import geolime as geo
import numpy as np
import pandas as pd
hid = np.array(
    ["A", "A", "C", "F", "A", "B", "C", "A", "E", "D", "B", "C", "E"]
)
xyz = np.array([
    [0,   0,   2,   5,   0,   1,   2,   0,   4,   3,   1,   2,   4],  # noqa
    [0,   0,   2,   5,   0,   1,   2,   0,   4,   3,   1,   2,   4],  # noqa
    [0,  -2,  -4,   1,  -5,   0,  -3,  -3,  -2,   2,  -3,  -2,   0]   # noqa
])
df = pd.DataFrame({
    geo.Attribute.HOLEID: hid,
    geo.Coord.X: xyz[0],
    geo.Coord.Y: xyz[1],
    geo.Coord.Z: xyz[2]
})
df.sort_values([geo.Attribute.HOLEID, geo.Coord.Z], ascending=[True, False], inplace=True)

dh = geo.Drillholes("test", df[['X', 'Y', 'Z']].to_numpy(), df.HOLEID)
dh.element_count()
Output
7

holeids() 🍋

Return the holeids present in this Drillholes object

Returns:

Type Description
np.ndarray

List of Hold ID names.

Example

import geolime as geo
import numpy as np
import pandas as pd
hid = np.array(
    ["A", "A", "C", "F", "A", "B", "C", "A", "E", "D", "B", "C", "E"]
)
xyz = np.array([
    [0,   0,   2,   5,   0,   1,   2,   0,   4,   3,   1,   2,   4],  # noqa
    [0,   0,   2,   5,   0,   1,   2,   0,   4,   3,   1,   2,   4],  # noqa
    [0,  -2,  -4,   1,  -5,   0,  -3,  -3,  -2,   2,  -3,  -2,   0]   # noqa
])
df = pd.DataFrame({
    geo.Attribute.HOLEID: hid,
    geo.Coord.X: xyz[0],
    geo.Coord.Y: xyz[1],
    geo.Coord.Z: xyz[2]
})
df.sort_values([geo.Attribute.HOLEID, geo.Coord.Z], ascending=[True, False], inplace=True)

dh = geo.Drillholes("test", df[['X', 'Y', 'Z']].to_numpy(), df.HOLEID)
dh.holeids()
Output
array(['A', 'B', 'C', 'D', 'E', 'F'], dtype=object)

keep_composites(region) 🍋

Keep composites in region.

Parameters:

Name Type Description Default
region str

Region to select composites.

required

keep_holes(region, method=DrillHolesSelectionMethod.ALL) 🍋

Keep Holes in region.

Selections are any or all composites from a hole in a region.

Parameters:

Name Type Description Default
region str

Region to select holes.

required
method DrillHolesSelectionMethod

Method of selection of holes, might be any composite or all composites.

DrillHolesSelectionMethod.ALL

Raises:

Type Description
ValueError
  • A dynamic expression is provided instead of a region.
  • Region does not exist.
  • Selection method is not supported.

mid_coords(region=None) 🍋

Return Mid-Points of each composite.

Parameters:

Name Type Description Default
region Optional[str]

Object region or condition to select data from.

None

Returns:

Type Description
np.ndarray

Barycentric coordinates.

Example

import geolime as geo
import numpy as np
import pandas as pd
hid = np.array(
    ["A", "A", "C", "F", "A", "B", "C", "A", "E", "D", "B", "C", "E"]
)
xyz = np.array([
    [0,   0,   2,   5,   0,   1,   2,   0,   4,   3,   1,   2,   4],  # noqa
    [0,   0,   2,   5,   0,   1,   2,   0,   4,   3,   1,   2,   4],  # noqa
    [0,  -2,  -4,   1,  -5,   0,  -3,  -3,  -2,   2,  -3,  -2,   0]   # noqa
])
df = pd.DataFrame({
    geo.Attribute.HOLEID: hid,
    geo.Coord.X: xyz[0],
    geo.Coord.Y: xyz[1],
    geo.Coord.Z: xyz[2]
})
df.sort_values([geo.Attribute.HOLEID, geo.Coord.Z], ascending=[True, False], inplace=True)

dh = geo.Drillholes("test", df[['X', 'Y', 'Z']].to_numpy(), df.HOLEID)
dh.mid_coords()
Output
array([[ 0. ,  0. , -1. ],
    [ 0. ,  0. , -2.5],
    [ 0. ,  0. , -4. ],
    [ 1. ,  1. , -1.5],
    [ 2. ,  2. , -2.5],
    [ 2. ,  2. , -3.5],
    [ 4. ,  4. , -1. ]])

node_coords(region=None) 🍋

Return the object node coordinates, respectively X, Y, and Z as data arrays. Node coordinates correspond to beginning and end of each composite.

Parameters:

Name Type Description Default
region Optional[str]

Object region to select data from.

None

Returns:

Type Description
np.ndarray

XYZ coordinates.

Example

import geolime as geo
import numpy as np
import pandas as pd
hid = np.array(
    ["A", "A", "C", "F", "A", "B", "C", "A", "E", "D", "B", "C", "E"]
)
xyz = np.array([
    [0,   0,   2,   5,   0,   1,   2,   0,   4,   3,   1,   2,   4],  # noqa
    [0,   0,   2,   5,   0,   1,   2,   0,   4,   3,   1,   2,   4],  # noqa
    [0,  -2,  -4,   1,  -5,   0,  -3,  -3,  -2,   2,  -3,  -2,   0]   # noqa
])
df = pd.DataFrame({
    geo.Attribute.HOLEID: hid,
    geo.Coord.X: xyz[0],
    geo.Coord.Y: xyz[1],
    geo.Coord.Z: xyz[2]
})
df.sort_values([geo.Attribute.HOLEID, geo.Coord.Z], ascending=[True, False], inplace=True)

dh = geo.Drillholes("test", df[['X', 'Y', 'Z']].to_numpy(), df.HOLEID)
dh.node_coords()
Output
array([[ 0,  0,  0],
    [ 0,  0, -2],
    [ 0,  0, -3],
    [ 0,  0, -5],
    [ 1,  1,  0],
    [ 1,  1, -3],
    [ 2,  2, -2],
    [ 2,  2, -3],
    [ 2,  2, -4],
    [ 3,  3,  2],
    [ 4,  4,  0],
    [ 4,  4, -2],
    [ 5,  5,  1]])

sample_count() 🍋

Return the total number of samples for all drillholes.

Returns:

Type Description
int

Number of samples for all drillholes.

Example

import geolime as geo
import numpy as np
import pandas as pd
hid = np.array(
    ["A", "A", "C", "F", "A", "B", "C", "A", "E", "D", "B", "C", "E"]
)
xyz = np.array([
    [0,   0,   2,   5,   0,   1,   2,   0,   4,   3,   1,   2,   4],  # noqa
    [0,   0,   2,   5,   0,   1,   2,   0,   4,   3,   1,   2,   4],  # noqa
    [0,  -2,  -4,   1,  -5,   0,  -3,  -3,  -2,   2,  -3,  -2,   0]   # noqa
])
df = pd.DataFrame({
    geo.Attribute.HOLEID: hid,
    geo.Coord.X: xyz[0],
    geo.Coord.Y: xyz[1],
    geo.Coord.Z: xyz[2]
})
df.sort_values([geo.Attribute.HOLEID, geo.Coord.Z], ascending=[True, False], inplace=True)

dh = geo.Drillholes("test", df[['X', 'Y', 'Z']].to_numpy(), df.HOLEID)
dh.sample_count()
Output
13

transform(properties=None, agg_methods=None, support=AttributeSupportType.ELEMENT) 🍋

Return the object data grouped by location (X, Y) and hole ID.

Parameters:

Name Type Description Default
properties Optional[List[str]]

list of properties name to transfer to the GIS Object. Setting to None or empty list will select all existing properties.

None
agg_methods Optional[Union[str, Callable]]

aggregation data methods. See pandas.DataFrame.groupby to find out supported methods.

None
support AttributeSupportType

type supporting the transformation (e.g. node = points, element = segments)

AttributeSupportType.ELEMENT

Returns:

Type Description
pd.DataFrame

DataFrame of XY coordinates with aggregated data.

Raises:

Type Description
ValueError
  • No aggregation method is provided.
  • 'X', 'Y' or 'HOLEID' are part of the properties.
ValueError

if one of the aggregation methods is not supported.

translate_by(coord, expr, region=None) 🍋

Shift the given existing X, Y or Z coordinate by the given expression or value.

Parameters:

Name Type Description Default
coord Union[Attribute, Coord]

coordinate property.

required
expr str

expression use to compute the property values. Use backquotes when attribute names contains whitespace.

required
region Optional[str]

region or condition in which to set the property data.

None

Raises:

Type Description
ValueError

Coord doesn't exist.