Exemple #1
0
mesh = PrismMesh((0, 10000, 0, 20000, 0, 5000), (20, 20, 20))
mesh.addprop('density', 1000.0 * np.random.rand(8000))
mesh.dump(meshfile, densfile, 'density')  #输出网格到磁盘,MeshTools3D可视化
#生成核矩阵
kernel = []
xp, yp, zp = gridder.regular((-5000, 15000, -5000, 25000), (20, 20), z=-1)
for i, layer in enumerate(mesh.layers()):
    for j, p in enumerate(layer):
        x1 = mesh.get_layer(i)[j].x1
        x2 = mesh.get_layer(i)[j].x2
        y1 = mesh.get_layer(i)[j].y1
        y2 = mesh.get_layer(i)[j].y2
        z1 = mesh.get_layer(i)[j].z1
        z2 = mesh.get_layer(i)[j].z2
        den = mesh.get_layer(i)[j].props
        model = [geometry.Prism(x1, x2, y1, y2, z1, z2, {'density': 1000})]
        field = prism.gz(xp, yp, zp, model)
        kernel.append(field)

kk = np.array(kernel)
kk = np.transpose(kk)  #kernel matrix for inversion, 500 cells * 400 points

#TO-DO list for Bei: understanding the forward and inversion of potential field
# 1. COO/CSR format for sparse matrix

# 2. SAVE the sensitivity matrix with HDF5 format

# 3. TEST compression by Haar wavelet approach

# 4. TEST compressed ratio and results
Exemple #2
0
"""
GravMag: Forward modeling of the gravitational potential and its derivatives
using 3D model
"""
# 3rd imports
import matplotlib.pyplot as plt
# local imports
from geoist import gridder
from geoist.inversion import geometry
from geoist.pfm import prism
from geoist.vis import giplt

model = [
    geometry.Prism(-4000, -3000, -4000, -3000, 0, 2000, {'density': 1000}),
    geometry.Prism(-1000, 1000, -1000, 1000, 0, 2000, {'density': -900}),
    geometry.Prism(2000, 4000, 3000, 4000, 0, 2000, {'density': 1300})
]
shape = (100, 100)
xp, yp, zp = gridder.regular((-5000, 5000, -5000, 5000), shape, z=-150)

field0 = prism.potential(xp, yp, zp, model)

from geoist.pfm import giutils
field0 = giutils.contaminate(field0, 0.05, percent=True)

fields = [
    prism.gx(xp, yp, zp, model),
    prism.gy(xp, yp, zp, model),
    prism.gz(xp, yp, zp, model),
    prism.gxx(xp, yp, zp, model),
    prism.gxy(xp, yp, zp, model),
Exemple #3
0
"""
GravMag: Generate noise-corrupted gravity gradient tensor data
"""
# 3rd imports
import matplotlib.pyplot as plt
# local imports
from geoist import gridder
from geoist.inversion import geometry
from geoist.pfm import prism, giutils
from geoist.vis import giplt


model = [geometry.Prism(-1000, 1000, -1000, 1000, 0, 2000, {'density': 1000})]
shape = (100, 100)
xp, yp, zp = gridder.regular((-5000, 5000, -5000, 5000), shape, z=-200)
components = [prism.gxx, prism.gxy, prism.gxz,
              prism.gyy, prism.gyz, prism.gzz]
print("Calculate the tensor components and contaminate with 5 Eotvos noise")
ftg = [giutils.contaminate(comp(xp, yp, zp, model), 5.0) for comp in components]

print("Plotting...")
plt.figure(figsize=(14, 6))
plt.suptitle("Contaminated FTG data")
names = ['gxx', 'gxy', 'gxz', 'gyy', 'gyz', 'gzz']
for i, data in enumerate(ftg):
    plt.subplot(2, 3, i + 1)
    plt.title(names[i])
    plt.axis('scaled')
    levels = giplt.contourf(xp * 0.001, yp * 0.001, data, (100, 100), 12)
    plt.colorbar()
    giplt.contour(xp * 0.001, yp * 0.001, data, shape, levels, clabel=False)
"""
GravMag: Calculate the analytic signal of a total field anomaly using FFT
"""
import matplotlib.pyplot as plt
from geoist import gridder
from geoist.inversion import geometry
from geoist.pfm import prism, pftrans, giutils
from geoist.vis import giplt

model = [geometry.Prism(-100, 100, -100, 100, 0, 2000, {'magnetization': 10})]
area = (-5000, 5000, -5000, 5000)
shape = (100, 100)
z0 = -500
x, y, z = gridder.regular(area, shape, z=z0)
inc, dec = -30, 0
tf = giutils.contaminate(prism.tf(x, y, z, model, inc, dec), 0.001,
                       percent=True)

# Need to convert gz to SI units so that the result is also in SI
total_grad_amp = pftrans.tga(x, y, giutils.nt2si(tf), shape)

plt.figure()
plt.subplot(1, 2, 1)
plt.title("Original total field anomaly")
plt.axis('scaled')
giplt.contourf(y, x, tf, shape, 30, cmap=plt.cm.RdBu_r)
plt.colorbar(orientation='horizontal').set_label('nT')
giplt.m2km()
plt.subplot(1, 2, 2)
plt.title("Total Gradient Amplitude")
plt.axis('scaled')