Commit 363c02c8 authored by Maximilian Schanner's avatar Maximilian Schanner
Browse files

Add gradients for uncertainty handling.

parent fa3f0f56
......@@ -39,6 +39,32 @@ def _nicelabel(label):
return fr'${parts[0]}$ {parts[1]}'
def grad_d(n, e, z):
'''Calculate the gradient of D.
'''
res = np.column_stack((-e, n, np.zeros_like(n)))
res /= (n**2 + e**2)[:, np.newaxis]
return np.rad2deg(res)
def grad_i(n, e, z):
'''Calculate the gradient of I.
'''
res = -np.column_stack((n, e, z)) \
* z[:, np.newaxis]
res /= (n**2 + e**2 + z**2)[:, np.newaxis]
res[:, 2] += 1.
res /= np.sqrt(n**2 + e**2)[:, np.newaxis]
return np.rad2deg(res)
def grad_f(n, e, z):
'''Calculate the gradient of F '''
res = np.column_stack((n, e, z))
res /= np.sqrt(n**2 + e**2 + z**2)[:, np.newaxis]
return res
def nez2dif(n, e, z):
'''Transform the magnetic field components north, east and vertically
downward to declination, inclination and intensity.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment