STRUCTURAL GEOLOGY: An Introduction to Geometrical Techniques
Post type
Discipline
Participation type
Node type
Node
Code
Geology
Instantiating
Equation
Equation 2.1
Language
Version
Python
3.0
# This code was written in Python 3
# The code calculates the thickness of a layer outcropped on the surface.
# Equation 2.1 in Ragan (2009): t = w sin δ
# w: Width of the layer outcropped
# d: Dip angle of the layer (in degrees)
# Sample of arrays of input data:
# w = [1, 1, 1, 1]
# delta = [0, 30, 60, 90]
# Importing the module math
import math
# Importing the numpy package
import numpy as np
# The function thickness calculates the true thickness of the layer
def thickness(w, d):
return w * math.sin(math.radians(d))
# The two following lines request users to enter w and delta as arrays
w = input('Enter w values as an array: ')
d = input('Enter delta values as an array: ')
# The following two lines convert input values to array
w = np.array(eval(w))
d = np.array(eval(d))
# Iterating the function thickness for each value of input data
for i in range(0, len(w), 1):
print(thickness(w[i], d[i]))