-
-
Notifications
You must be signed in to change notification settings - Fork 266
Description
I am trying to calculate dip and azimuth using two points in x,y,z space. I calculated the gradient at point one and from that I try to obtain the dip and azimuth. My code looks like this:
import gempy as gp
import numpy as np
import pandas as pd
import math
dfs=(pd.read_csv("C:\Users\17138\geoLOGIC\gridding\gempy\input_gempy.csv", sep=',', names=['X', 'Y', 'Z'],header=0))
xyz=dfs.values.tolist()
x1=xyz[0][0]
x2=xyz[1][0]
y1=xyz[0][1]
y2=xyz[1][1]
z1=xyz[0][2]
z2=xyz[1][2]
print ("x,y,z values of two distinct points: ",x1,x2,y1,y2,z1,z2)
seglen=math.sqrt((x2-x1)**2+(y2-y1)**2+(z2-z1)**2)
print (seglen)
agrad=(x2-x1)/seglen
bgrad=(y2-y1)/seglen
cgrad=(z2-z1)/seglen
print("gradient in x,y,z direction: ",agrad,bgrad,cgrad)
dip = np.degrees(np.arccos(cgrad)) % 360
azimuth = np.degrees(np.arctan2(agrad, bgrad)) % 360
print("dip: ",dip," azimuth:",azimuth)
Upon running I get the following output:
x,y,z values of two distinct points: 770919.216889751 766191.216889751 7033413.96520266 7034671.46849271 -1330.0 -1294.0
4892.503911545284 (segment length)
gradient in x,y,z direction: -0.9663763352018812 0.2570265272721167 0.007358195445699603
dip: 89.57840265164364 azimuth: 284.89411220637817
Is this the correct calculation or if not, what would you suggest?
Many thanks for your assistance.