Exemple #1
0
def tahg_mag(x, y, mag, area, cel=200):
    #TAHG Filter
    #(Ferreira et al. 2013)

    #Calculating the derivatives through Fatiando library
    numcols, numrows = int((area[1] - area[0]) / cel), int(
        (area[3] - area[2]) / cel)
    deriv_x = transform.derivx(x, y, mag, (numcols, numrows))
    deriv_y = transform.derivy(x, y, mag, (numcols, numrows))

    thd = np.sqrt(deriv_x**2 + deriv_y**2)
    derivx_thd = transform.derivx(x, y, thd, (numcols, numrows))
    derivy_thd = transform.derivy(x, y, thd, (numcols, numrows))
    derivz_thd = transform.derivz(x, y, thd, (numcols, numrows))

    #applying the equations
    tahg = np.arctan(derivz_thd / np.sqrt(derivx_thd**2 + derivy_thd**2))

    return tahg
Exemple #2
0
def stdr_mag(x, y, mag, area, cel=200, M=50000):
    #STDR Map
    #(Nasuti et al. 2018)

    #Calculating the derivatives through Fatiando library
    numcols, numrows = int((area[1] - area[0]) / cel), int(
        (area[3] - area[2]) / cel)
    deriv_x = transform.derivx(x, y, mag, (numcols, numrows))
    deriv_y = transform.derivy(x, y, mag, (numcols, numrows))
    deriv_z = transform.derivz(x, y, mag, (numcols, numrows))

    deriv2_z = transform.derivz(x, y, deriv_z, (numcols, numrows))
    thd = np.sqrt(deriv_x**2 + deriv_y**2)
    derivx_thd = transform.derivx(x, y, thd, (numcols, numrows))
    derivy_thd = transform.derivy(x, y, thd, (numcols, numrows))

    #applying the equations
    stdr = np.arctan(M * deriv2_z / np.sqrt(derivx_thd**2 + derivy_thd**2))

    return stdr
Exemple #3
0
def thd_tdr_mag(x, y, mag, area, cel=200):
    # Total Horizontal Derivative of the Tilt Angle (THD_TDR)
    #(Verduzco et al. 2004)

    #Calculating the derivatives through Fatiando library
    numcols, numrows = int((area[1] - area[0]) / cel), int(
        (area[3] - area[2]) / cel)
    deriv_x = transform.derivx(x, y, mag, (numcols, numrows))
    deriv_y = transform.derivy(x, y, mag, (numcols, numrows))
    deriv_z = transform.derivz(x, y, mag, (numcols, numrows))

    #applying the equations
    thd = np.sqrt(deriv_x**2 + deriv_y**2)
    tdr = np.arctan(deriv_z / thd)
    derivx_tdr = transform.derivx(x, y, tdr, (numcols, numrows))
    derivy_tdr = transform.derivy(x, y, tdr, (numcols, numrows))

    thd_tdr = np.sqrt(derivx_tdr**2 + derivy_tdr**2)

    return thd_tdr
Exemple #4
0
def asta_mag(x, y, mag, area, cel=200):
    #Analytic Signal of Tilt Angle
    #(Ansari and Alamdar, 2011)

    #Calculating the derivatives through Fatiando library
    numcols, numrows = int((area[1] - area[0]) / cel), int(
        (area[3] - area[2]) / cel)
    deriv_x = transform.derivx(x, y, mag, (numcols, numrows))
    deriv_y = transform.derivy(x, y, mag, (numcols, numrows))
    deriv_z = transform.derivz(x, y, mag, (numcols, numrows))

    #Calculating TDR and its derivatives
    thd = np.sqrt(deriv_x**2 + deriv_y**2)
    tdr = np.arctan(deriv_z / thd)
    deriv_tdr_x = transform.derivx(x, y, tdr, (numcols, numrows))
    deriv_tdr_y = transform.derivy(x, y, tdr, (numcols, numrows))
    deriv_tdr_z = transform.derivz(x, y, tdr, (numcols, numrows))

    #applyng the equations
    asta = np.sqrt(deriv_tdr_x**2 + deriv_tdr_y**2 + deriv_tdr_z**2)

    return asta
Exemple #5
0
def thd_mag(x, y, mag, area, cel=200):
    # Total Horizontal Gradient (THD)
    #(Cordell and Grauch 1985)

    #Calculating the derivatives through Fatiando library
    numcols, numrows = int((area[1] - area[0]) / cel), int(
        (area[3] - area[2]) / cel)
    deriv_x = transform.derivx(x, y, mag, (numcols, numrows))
    deriv_y = transform.derivy(x, y, mag, (numcols, numrows))

    #applying the equations
    thd = np.sqrt(deriv_x**2 + deriv_y**2)

    return thd
Exemple #6
0
def test_laplace_from_potential():
    "gravmag.transform 2nd derivatives of potential obey the Laplace equation"
    model = [Prism(-1000, 1000, -500, 500, 0, 2000, {'density': 200})]
    shape = (300, 300)
    x, y, z = gridder.regular([-10000, 10000, -10000, 10000], shape, z=-100)
    potential = prism.potential(x, y, z, model)
    gxx = utils.si2eotvos(
        transform.derivx(x, y, potential, shape, order=2, method='fft'))
    gyy = utils.si2eotvos(
        transform.derivy(x, y, potential, shape, order=2, method='fft'))
    gzz = utils.si2eotvos(transform.derivz(x, y, potential, shape, order=2))
    laplace = _trim(gxx + gyy + gzz, shape)
    assert np.all(np.abs(laplace) <= 1e-10), \
        "Max: {} Mean: {} STD: {}".format(
            laplace.max(), laplace.mean(), laplace.std())
Exemple #7
0
def gdo_mag(x, y, mag, area, theta, phi, cel=200):
    #Generalised derivative operator
    #(Cooper and Cowan 2011)
    #Calculating the derivatives through Fatiando library
    numcols, numrows = int((area[1] - area[0]) / cel), int(
        (area[3] - area[2]) / cel)
    deriv_x = transform.derivx(x, y, mag, (numcols, numrows))
    deriv_y = transform.derivy(x, y, mag, (numcols, numrows))
    deriv_z = transform.derivz(x, y, mag, (numcols, numrows))

    gdo = (
        (deriv_x * np.sin(theta) + deriv_y * np.cos(theta)) * np.cos(phi) +
        deriv_z * np.sin(phi)) / np.sqrt(deriv_x**2 + deriv_y**2 + deriv_z**2)

    return gdo
Exemple #8
0
def asa_mag(x, y, mag, area, cel=200):
    # Analytical Signal or Total Gradient (ASA or GT)
    #(Nabighian 1972; Roest et al. 1992)

    #Calculating the derivatives through Fatiando library
    numcols, numrows = int((area[1] - area[0]) / cel), int(
        (area[3] - area[2]) / cel)
    deriv_x = transform.derivx(x, y, mag, (numcols, numrows))
    deriv_y = transform.derivy(x, y, mag, (numcols, numrows))
    deriv_z = transform.derivz(x, y, mag, (numcols, numrows))

    #applying the equations
    asa = np.sqrt(deriv_x**2 + deriv_y**2 + deriv_z**2)

    return asa
Exemple #9
0
def test_laplace_from_potential():
    "gravmag.transform 2nd derivatives of potential obey the Laplace equation"
    model = [Prism(-1000, 1000, -500, 500, 0, 2000, {'density': 200})]
    shape = (300, 300)
    x, y, z = gridder.regular([-10000, 10000, -10000, 10000], shape, z=-100)
    potential = prism.potential(x, y, z, model)
    gxx = utils.si2eotvos(transform.derivx(x, y, potential, shape, order=2,
                                           method='fft'))
    gyy = utils.si2eotvos(transform.derivy(x, y, potential, shape, order=2,
                                           method='fft'))
    gzz = utils.si2eotvos(transform.derivz(x, y, potential, shape, order=2))
    laplace = _trim(gxx + gyy + gzz, shape)
    assert np.all(np.abs(laplace) <= 1e-10), \
        "Max: {} Mean: {} STD: {}".format(
            laplace.max(), laplace.mean(), laplace.std())
Exemple #10
0
def theta_mag(x, y, mag, area, cel=200):
    # Theta Map
    #(Wijns et al. 2005)

    #Calculating the derivatives through Fatiando library
    numcols, numrows = int((area[1] - area[0]) / cel), int(
        (area[3] - area[2]) / cel)
    deriv_x = transform.derivx(x, y, mag, (numcols, numrows))
    deriv_y = transform.derivy(x, y, mag, (numcols, numrows))
    deriv_z = transform.derivz(x, y, mag, (numcols, numrows))

    #applying the equations
    asa = np.sqrt(deriv_x**2 + deriv_y**2 + deriv_z**2)
    thd = np.sqrt(deriv_x**2 + deriv_y**2)
    theta = (thd / asa)
    return theta
Exemple #11
0
def tdr_mag(x, y, mag, area, cel=200):
    # Tilt Angle Filter (TDR or ISA)
    #(Miller and Singh 1994)

    #Calculating the derivatives through Fatiando library
    numcols, numrows = int((area[1] - area[0]) / cel), int(
        (area[3] - area[2]) / cel)
    deriv_x = transform.derivx(x, y, mag, (numcols, numrows))
    deriv_y = transform.derivy(x, y, mag, (numcols, numrows))
    deriv_z = transform.derivz(x, y, mag, (numcols, numrows))

    #applying the equations
    thd = np.sqrt(deriv_x**2 + deriv_y**2)
    tdr = np.arctan(deriv_z / thd)

    return tdr
Exemple #12
0
def tdx_mag(x, y, mag, area, cel=200):
    #TDX Filter
    #(Cooper and Cowan 2006)

    #Calculating the derivatives through Fatiando library
    numcols, numrows = int((area[1] - area[0]) / cel), int(
        (area[3] - area[2]) / cel)
    deriv_x = transform.derivx(x, y, mag, (numcols, numrows))
    deriv_y = transform.derivy(x, y, mag, (numcols, numrows))
    deriv_z = transform.derivz(x, y, mag, (numcols, numrows))

    #applying the equations
    thd = np.sqrt(deriv_x**2 + deriv_y**2)
    tdx = np.arctan(thd / np.abs(deriv_z))

    return tdx
Exemple #13
0
def euler_deconv(inc, dec,syn_bounds,area,depth=-300,magnetization = 0.5,si=1.0,size = (1000, 1000),windows=(10, 10),proc_data='None'):
    
    # IN PROGRESSING #####
    
    
    mag = utils.ang2vec(magnetization, inc, dec)
    model = []
    for i in range(len(syn_bounds)):
        model.append(Prism(syn_bounds[i][0], syn_bounds[i][1], syn_bounds[i][2], syn_bounds[i][3], syn_bounds[i][4], syn_bounds[i][5], {'magnetization': mag}))
    #model = [Prism(syn_bounds[0]-1000, syn_bounds[1]-1000, syn_bounds[2]-1000, syn_bounds[3]-1000, syn_bounds[4], syn_bounds[5], {'magnetization': mag}),Prism(syn_bounds[0]+1000, syn_bounds[1]+1000, syn_bounds[2]+1000, syn_bounds[3]+1000, syn_bounds[4], syn_bounds[5], {'magnetization': mag})]
    
    
    cel = 200
    numcols, numrows = int((area[1] - area[0])/cel), int((area[3] - area[2])/cel)
    x, y, z = gridder.regular(area[:4], (numcols, numrows), z=depth)
    
    
    mag = prism.tf(x, y, z, model, inc, dec)
    #derivatives
    deriv_x = transform.derivx(x, y, mag, (numcols, numrows))
    deriv_y = transform.derivy(x, y, mag, (numcols, numrows))
    deriv_z = transform.derivz(x, y, mag, (numcols, numrows))
    #label = 'Total Magnetic Intensity (nT)'
    
    solver = euler.EulerDeconvMW(x, y, z, mag, deriv_x, deriv_y, deriv_z,
                             structural_index=si, windows=windows,
                             size=size)
    
    
    solver_expand = euler.EulerDeconvEW(x, y, z, mag, deriv_x, deriv_y, deriv_z,
                             structural_index=si, center = (-1250,0),sizes=np.linspace(300, 7000, 20))
    
    solver.fit()
    solver_expand.fit()
    #print('Kept Euler solutions after the moving window scheme:')
    #print(solver_expand.estimate_)
    return solver,solver_expand
# Make a model
bounds = [-5000, 5000, -5000, 5000, 0, 5000]
model = [
    Prism(-1500, -500, -500, 500, 1000, 2000, {'magnetization': 2})]
# Generate some data from the model
shape = (200, 200)
area = bounds[0:4]
xp, yp, zp = gridder.regular(area, shape, z=-1)
# Add a constant baselevel
baselevel = 10
# Convert from nanoTesla to Tesla because euler and derivatives require things
# in SI
tf = (utils.nt2si(prism.tf(xp, yp, zp, model, inc, dec)) + baselevel)
# Calculate the derivatives using FFT
xderiv = transform.derivx(xp, yp, tf, shape)
yderiv = transform.derivy(xp, yp, tf, shape)
zderiv = transform.derivz(xp, yp, tf, shape)

mpl.figure()
titles = ['Total field', 'x derivative', 'y derivative', 'z derivative']
for i, f in enumerate([tf, xderiv, yderiv, zderiv]):
    mpl.subplot(2, 2, i + 1)
    mpl.title(titles[i])
    mpl.axis('scaled')
    mpl.contourf(yp, xp, f, shape, 50)
    mpl.colorbar()
    mpl.m2km()
mpl.show()

# Run the Euler deconvolution on the whole dataset
euler = Classic(xp, yp, zp, tf, xderiv, yderiv, zderiv, 3).fit()
Exemple #15
0
    plt.axis('square')
    # plt.xlim(min(Xs),max(Ys))
    # plt.ylim(min(Xs),max(Ys))
    plt.xlim(300, 500)
    plt.ylim(300, 500)
    plt.savefig('publi_mirror' + file + '.png', dpi=450)

    #%% ------------------------------- Pad the edges of grids

    # xp,yp,U, shape = dEXP.pad_edges(xp,yp,U,shape,pad_type=0) # reflexion=5
    # pEXP.plot_line(xp, yp,U,p1,p2, interp=interp)

    #%% ------------------------------- Plot the derivatives

    xderiv = transform.derivx(Xs, Ys, U, shape, order=0)
    yderiv = transform.derivy(Xs, Ys, U, shape, order=0)
    zderiv = transform.derivz(Xs, Ys, U, shape, order=0)

    # interp = True
    pEXP.plot_line(Xs,
                   Ys,
                   xderiv,
                   p1_s,
                   p2_s,
                   title='xderiv',
                   x_resolution=interp_size,
                   savefig=False,
                   interp=interp,
                   smooth=smooth,
                   Xaxis=x_axis)
# Make a model of two spheres magnetized by induction only
model = [
    mesher.Sphere(x=-1000, y=-1000, z=1500, radius=1000,
                  props={'magnetization': utils.ang2vec(2, inc, dec)}),
    mesher.Sphere(x=1000, y=1500, z=1000, radius=1000,
                  props={'magnetization': utils.ang2vec(1, inc, dec)}),
    ]
# Generate some magnetic data from the model
shape = (100, 100)
area = [-5000, 5000, -5000, 5000]
x, y, z = gridder.regular(area, shape, z=-150)
data = sphere.tf(x, y, z, model, inc, dec)

# We also need the derivatives of our data
xderiv = transform.derivx(x, y, data, shape)
yderiv = transform.derivy(x, y, data, shape)
zderiv = transform.derivz(x, y, data, shape)

# Now we can run our Euler deconv solver using expanding windows. We'll run 2
# solvers, each one expanding windows from points close to the anomalies.

# We use a structural index of 3 to indicate that we think the sources are
# spheres.

# Make the solver and use fit() to obtain the estimate for the lower right
# anomaly
print("Euler solutions:")
sol1 = euler.EulerDeconvEW(x, y, z, data, xderiv, yderiv, zderiv,
                           structural_index=3, center=(-2000, -2000),
                           sizes=np.linspace(300, 7000, 20))
sol1.fit()
Exemple #17
0
                  props={'magnetization': utils.ang2vec(2, inc, dec)}),
    mesher.Sphere(x=1000,
                  y=1500,
                  z=1000,
                  radius=1000,
                  props={'magnetization': utils.ang2vec(1, inc, dec)})
]
# Generate some magnetic data from the model
shape = (100, 100)
area = [-5000, 5000, -5000, 5000]
x, y, z = gridder.regular(area, shape, z=-150)
data = sphere.tf(x, y, z, model, inc, dec)

# We also need the derivatives of our data
xderiv = transform.derivx(x, y, data, shape)
yderiv = transform.derivy(x, y, data, shape)
zderiv = transform.derivz(x, y, data, shape)

# Now we can run our Euler deconv solver using expanding windows. We'll run 2
# solvers, each one expanding windows from points close to the anomalies.

# We use a structural index of 3 to indicate that we think the sources are
# spheres.

# Make the solver and use fit() to obtain the estimate for the lower right
# anomaly
print("Euler solutions:")
sol1 = euler.EulerDeconvEW(x,
                           y,
                           z,
                           data,
inc, dec = -45, 0
# Make a model
bounds = [-5000, 5000, -5000, 5000, 0, 5000]
model = [Prism(-1500, -500, -500, 500, 1000, 2000, {'magnetization': 2})]
# Generate some data from the model
shape = (200, 200)
area = bounds[0:4]
xp, yp, zp = gridder.regular(area, shape, z=-1)
# Add a constant baselevel
baselevel = 10
# Convert from nanoTesla to Tesla because euler and derivatives require things
# in SI
tf = (utils.nt2si(prism.tf(xp, yp, zp, model, inc, dec)) + baselevel)
# Calculate the derivatives using FFT
xderiv = transform.derivx(xp, yp, tf, shape)
yderiv = transform.derivy(xp, yp, tf, shape)
zderiv = transform.derivz(xp, yp, tf, shape)

mpl.figure()
titles = ['Total field', 'x derivative', 'y derivative', 'z derivative']
for i, f in enumerate([tf, xderiv, yderiv, zderiv]):
    mpl.subplot(2, 2, i + 1)
    mpl.title(titles[i])
    mpl.axis('scaled')
    mpl.contourf(yp, xp, f, shape, 50)
    mpl.colorbar()
    mpl.m2km()
mpl.show()

# Run the Euler deconvolution on the whole dataset
euler = Classic(xp, yp, zp, tf, xderiv, yderiv, zderiv, 3).fit()
Exemple #19
0
    #%%
    # Plot field data over a 2d line crossing the anomalies
    # pEXP.plot_line(xp, yp, U,p1,p2, interp=False, Xaxis='x')

    pEXP.plot_line(xp, yp, U, p1, p2, interp=True, Xaxis=x_axis)
    square([x1, x2, y1, y2])

    pEXP.plot_field(xp, yp, U, shape)
    square([x1, x2, y1, y2])

    # Gaussian function to derivate
    #%% ------------------------------- Plot the derivatives
    # http://campar.in.tum.de/Chair/HaukeHeibelGaussianDerivatives

    xderiv = transform.derivx(xp, yp, U, shape, order=qorder)
    yderiv = transform.derivy(xp, yp, U, shape, order=qorder)
    zderiv = transform.derivz(xp, yp, U, shape, order=qorder)

    # # plt.plot(xderiv)
    # # plt.plot(yderiv)

    # # interp = True
    pEXP.plot_line(xp,
                   yp,
                   xderiv,
                   p1,
                   p2,
                   title='xderiv',
                   savefig=False,
                   interp=interp,
                   Xaxis=x_axis)
Exemple #20
0
mpl.contourf(yp, xp, gz, shape, 30)
plt.colorbar()
plt.xlabel('East (km)')
plt.ylabel('North (km)')
mpl.m2km()
plt.show()
#plt.title(strname +'ztop' + str(za) +'_zbot'+ str(zb) + '_data', fontsize=20)
#plt.savefig(pathFig+strname + '_ExempleFig_z' + str(za) + str(zb) + '_data' + '.png')

#x1, x2, y1, y2, z1, z2 = np.array(model[0].get_bounds())
square([y1, y2, x1, x2])

# %% ------------------------------- derivatives

xderiv = transform.derivx(xp, yp, gz, shape, order=1)
yderiv = transform.derivy(xp, yp, gz, shape)
zderiv = transform.derivz(xp, yp, gz, shape, order=1)

plt.subplots_adjust()
levels = 30
cbargs = dict(orientation='horizontal')

ax = plt.subplot(1, 3, 1)
plt.axis('scaled')
plt.title('x derivative')
mpl.contourf(yp, xp, xderiv, shape, levels, cmap=plt.cm.RdBu_r)
plt.colorbar(**cbargs).set_label('u/m')
mpl.m2km()
plt.xlabel('x (m)')
plt.ylabel('y (m)')
Exemple #21
0
fig.savefig('data.png', dpi=200, bbox_inches='tight', pad_inches=0)


xc = np.loadtxt('xc.txt')
yc = np.loadtxt('yc.txt')

gauss = sp.ndimage.filters.gaussian_filter(data,1.) # apply mild smoothing

d = gauss.ravel() # rearrange data, X, and Y from 2D arrays to 1D arrays

y = xc.ravel() # x, y are switched because x in Fatiando is North-South. 
x = yc.ravel() # If we wanted to plot the data using coordinates we'd have to pass it, as , for example: contourf(y, x, ...)

xderiv = transform.derivx(x, y, d, data.shape) # calculate derivatives using Fatiando a Terra 
yderiv = transform.derivy(x, y, d, data.shape) 
zderiv = transform.derivz(x, y, d, data.shape)

xderiv2D = np.reshape(xderiv, (81, 81)) # reshape output arrays back to 2D
yderiv2D = np.reshape(yderiv, (81, 81))
zderiv2D = np.reshape(zderiv, (81, 81))

dx = xderiv2D # rename for convenience
dy = yderiv2D
dz = zderiv2D




fig = plt.figure(figsize=(10,7))
# Make a model
bounds = [-5000, 5000, -5000, 5000, 0, 5000]
model = [
    Prism(-1500, -500, -1500, -500, 500, 1500, {'density': 1000}),
    Prism(500, 1500, 1000, 2000, 500, 1500, {'density': 1000})]
# Generate some data from the model
shape = (100, 100)
area = bounds[0:4]
xp, yp, zp = gridder.regular(area, shape, z=-1)
# Add a constant baselevel
baselevel = 10
# Convert the data from mGal to SI because Euler and FFT derivation require
# data in SI
gz = utils.mgal2si(prism.gz(xp, yp, zp, model)) + baselevel
xderiv = transform.derivx(xp, yp, gz, shape)
yderiv = transform.derivy(xp, yp, gz, shape)
zderiv = transform.derivz(xp, yp, gz, shape)

mpl.figure()
titles = ['Gravity anomaly', 'x derivative', 'y derivative', 'z derivative']
for i, f in enumerate([gz, xderiv, yderiv, zderiv]):
    mpl.subplot(2, 2, i + 1)
    mpl.title(titles[i])
    mpl.axis('scaled')
    mpl.contourf(yp, xp, f, shape, 50)
    mpl.colorbar()
    mpl.m2km()
mpl.show()

# Run the euler deconvolution on moving windows to produce a set of solutions
euler = Classic(xp, yp, zp, gz, xderiv, yderiv, zderiv, 2)
                                 shape_grid,
                                 zmin=0,
                                 zmax=max_elevation,
                                 nlayers=nlay,
                                 qorder=qorder)

    plt, cmap = pEXP.plot_xy(mesh,
                             label=label_prop,
                             Xaxis=x_axis,
                             p1p2=np.array([p1, p2]))
    plt.colorbar(cmap)

    #%%

    xderiv = transform.derivx(xp, yp, gravity, shape_grid, order=qorder)
    yderiv = transform.derivy(xp, yp, gravity, shape_grid, order=qorder)
    zderiv = transform.derivz(xp, yp, gravity, shape_grid, order=qorder)

    # # plt.plot(xderiv)
    # # plt.plot(yderiv)

    # # interp = True
    pEXP.plot_line(xp,
                   yp,
                   xderiv,
                   p1,
                   p2,
                   title='xderiv',
                   savefig=False,
                   interp=interp,
                   Xaxis=x_axis)
GravMag: Calculating the derivatives of the gravity anomaly using FFT
"""
from fatiando import mesher, gridder, utils
from fatiando.gravmag import prism, transform
from fatiando.vis import mpl

model = [mesher.Prism(-1000, 1000, -1000, 1000, 0, 2000, {'density': 100})]
area = (-5000, 5000, -5000, 5000)
shape = (51, 51)
z0 = -500
xp, yp, zp = gridder.regular(area, shape, z=z0)
gz = utils.contaminate(prism.gz(xp, yp, zp, model), 0.001)

# Need to convert gz to SI units so that the result can be converted to Eotvos
gxz = utils.si2eotvos(transform.derivx(xp, yp, utils.mgal2si(gz), shape))
gyz = utils.si2eotvos(transform.derivy(xp, yp, utils.mgal2si(gz), shape))
gzz = utils.si2eotvos(transform.derivz(xp, yp, utils.mgal2si(gz), shape))

gxz_true = prism.gxz(xp, yp, zp, model)
gyz_true = prism.gyz(xp, yp, zp, model)
gzz_true = prism.gzz(xp, yp, zp, model)

mpl.figure()
mpl.title("Original gravity anomaly")
mpl.axis('scaled')
mpl.contourf(xp, yp, gz, shape, 15)
mpl.colorbar(shrink=0.7)
mpl.m2km()

mpl.figure(figsize=(14, 10))
mpl.subplots_adjust(top=0.95, left=0.05, right=0.95)
Exemple #25
0
plt.axis('square')
# plt.xlim(min(Xs),max(Ys))
# plt.ylim(min(Xs),max(Ys))
plt.xlim(300, 500)
plt.ylim(300, 500)
plt.savefig('publi_mirror_field.png', dpi=450)

#%% ------------------------------- Pad the edges of grids

# xp,yp,U, shape = dEXP.pad_edges(xp,yp,U,shape,pad_type=0) # reflexion=5
# pEXP.plot_line(xp, yp,U,p1,p2, interp=interp)

#%% ------------------------------- Plot the derivatives

xderiv = transform.derivx(XFs, YFs, UF, shape, order=0)
yderiv = transform.derivy(XFs, YFs, UF, shape, order=0)
zderiv = transform.derivz(XFs, YFs, UF, shape, order=0)

# interp = True
pEXP.plot_line(XFs,
               YFs,
               xderiv,
               p1_s,
               p2_s,
               title='xderiv',
               x_resolution=interp_size,
               savefig=False,
               interp=interp,
               smooth=smooth,
               Xaxis=x_axis)
Exemple #26
0
for hi in zz:
    num= (x-x0)*np.cos(theta) + (hi-z0)*np.sin(theta)
    den = ((x-x0)**2 + (hi-z0)**2)**m
    Sxz = np.concatenate([Sxz,-K*num/den],axis=0)

Sxz=[]
for hi in zz:
    num= (x-x0)*np.cos(theta) + (hi-z0)*np.sin(theta)
    den = ((x-x0)**2 + (hi-z0)**2)**m
    Sxz = np.concatenate([Sxz,-K*num/den],axis=0)



shape = (len(x),nlayers)
S_d1x = transform.derivx(x, zz, Sxz, shape, order=1)
S_d1y = transform.derivy(x, zz, Sxz, shape, order=1)

S_d1 = S_d1x - S_d1y
len(S_d1)
len(Sxz)

# ---------------------------------------
# extend the problem to a x,y grid and use  transform.derivz to obtain the first vertical derivative S_d1 ??
# extract then the profile to plot p_S_d1
# ---------------------------------------

# ---------------------------------------
# Try to obtain same result from gradient fct
# 1st order vertical derivative
#dz = np.abs(zz[1] - zz[0])
#S_d1 = np.gradient(Sxz[-1,:],dz)