# drillcore_transformations.transformations module

Module with all calculations.

drillcore_transformations.transformations.calc_difference_between_two_planes(dip_first, dir_first, dip_second, dir_second)

Calculate difference between two measured planes.

Result is in range [0, 180].

drillcore_transformations.transformations.calc_global_normal_vector(alpha, beta, trend, plunge)

Calculate the normal vector of a measured plane.

Based on alpha and beta measurements and the trend and plunge of the drillcore.

Help and code snippets from: https://tinyurl.com/tqr84ww

Parameters
• alpha (float) – Alpha of the measured plane in degrees.

• beta (float) – Beta of the measured plane in degrees.

• trend (float) – Trend of the drillcore

• plunge (float) – Plunge of the drillcore

Returns

Normalized normal vector of a plane. Always points upwards (z >= 0)

Return type

numpy.ndarray

drillcore_transformations.transformations.calc_normal_vector_of_plane(dip, dip_dir)

Calculate normalized normal vector of plane based on dip and dip dir.

Parameters
• dip (float) – Dip of the plane

• dir (float) – Dip direction of the plane

Returns

Normalized normal vector of the plane

Return type

numpy.ndarray

drillcore_transformations.transformations.calc_plane_dir_dip(normal)

Calculate direction of dip and dip of a plane.

Based on normal vector of plane. Normal vector should point upwards but it will be reversed if not.

Parameters

normal (numpy.ndarray) – Normal vector of a plane.

Returns

Direction of dip and dip in degrees

Return type

tuple[float, float]

drillcore_transformations.transformations.calc_vector_trend_plunge(vector)

Calculate trend and plunge of a vector.

Does not assume that the data is axial and a negative plunge result implies that the gamma feature is pointed upwards.

Parameters

vector (numpy.ndarray) – vector vector of a plane.

Returns

Direction of dip and dip in degrees

Return type

tuple[float, float]

drillcore_transformations.transformations.fix_to_numerical(values)

Fix values to numerical.

Rotate a given vector about another vector.

Implements Rodrigues’ rotation formula: https://en.wikipedia.org/wiki/Rodrigues%27_rotation_formula

E.g.

```>>> rotate_vector_about_vector(np.array([1, 0, 1]), np.array([0, 0, 1]), np.pi)
array([-1.0000000e+00,  1.2246468e-16,  1.0000000e+00])
```

TODO: Is gamma axial or vector data? Right now treated as vector. => Negative plunges possible.

Parameters
• vector (numpy.ndarray) – Vector to rotate.

• amount (float) – How many radians to rotate.

Returns

Rotated vector.

Return type

np.ndarray

drillcore_transformations.transformations.transform_with_gamma(alpha, beta, drillcore_trend, drillcore_plunge, gamma, visualize=False, img_dir=None, curr_conv=None)

Transform alpha, beta and gamma measurements from core.

E.g.

```>>> transform_with_gamma(45, 0, 0, 90, 10)
(45.00000000000001, 0.0, -36.39247, 137.48165)
```
Parameters
• alpha (float) – Angle in degrees between drillcore axis and plane.

• beta (float) – Angle in degrees between TOP mark of core and ellipse long axis at DOWN hole end in counterclockwise direction.

• drillcore_trend (float) – Trend of the drillcore.

• drillcore_plunge (float) – Plunge of the drillcore.

• gamma (float) – Linear feature on a plane. Measured in clockwise direction from ellipse long axis at DOWN hole end.

• visualize (bool) – Automatic visualization using 3D plots. WARNING: Will drastically increase code run-time.

Returns

Plane dip and direction + Linear feature plunge and trend.

Return type

tuple[float, float, float, float]

drillcore_transformations.transformations.transform_without_gamma(alpha, beta, drillcore_trend, drillcore_plunge)

Transform alpha and beta measurements from core.

E.g.

```>>> transform_without_gamma(45, 0, 0, 90)
(45.00000000000001, 0.0)
```
Parameters
• alpha (float) – Angle in degrees between drillcore axis and plane.

• beta (float) – Angle in degrees between TOP mark of core and ellipse long axis at DOWN hole end.

• drillcore_trend (float) – Trend of the drillcore.

• drillcore_plunge (float) – Plunge of the drillcore.

Returns

Plane dip and direction

Return type

Tuple

drillcore_transformations.transformations.vector_from_dip_and_dir(dip, dip_dir)

Assemble a normalized vector that always points downwards from dip data.

Assumes dip is positive. Uses dip and dip direction. Credits to PhD Jussi Mattila for this snippet.

E.g.

```>>> vector_from_dip_and_dir(45, 0)
array([ 0.        ,  0.70710678, -0.70710678])
```
Parameters
• dip (float) – Dip of a feature. Between [0, 90]

• dip_dir (float) – Dip direction of feature.

Returns

Normalized vector pointing in the direction and the dip.

Return type

numpy.ndarray