model = [mesher.Sphere(x=10e3, y=10e3, z=1.5e3, radius=1.5e3,
                       props={'density': 500}),
         mesher.Sphere(x=20e3, y=20e3, z=1.5e3, radius=1.5e3,
                       props={'density': -500})]

# Create a regular grid at a constant height
shape = (300, 300)
area = [0, 30e3, 0, 30e3]
x, y, z = gridder.regular(area, shape, z=-100)

fields = [
    ['Gravity (mGal)', sphere.gz(x, y, z, model)],
    ['gxx (Eotvos)', sphere.gxx(x, y, z, model)],
    ['gyy (Eotvos)', sphere.gyy(x, y, z, model)],
    ['gzz (Eotvos)', sphere.gzz(x, y, z, model)],
    ['gxy (Eotvos)', sphere.gxy(x, y, z, model)],
    ['gxz (Eotvos)', sphere.gxz(x, y, z, model)],
    ['gyz (Eotvos)', sphere.gyz(x, y, z, model)],
]

# Make maps of all fields calculated
fig = plt.figure(figsize=(10, 8))
plt.rcParams['font.size'] = 10
X, Y = x.reshape(shape)/1000, y.reshape(shape)/1000
for i, tmp in enumerate(fields):
    ax = plt.subplot(3, 3, i + 3)
    field, data = tmp
    scale = np.abs([data.min(), data.max()]).max()
    ax.set_title(field)
    plot = ax.pcolormesh(Y, X, data.reshape(shape), cmap='RdBu_r',
                         vmin=-scale, vmax=scale)
Esempio n. 2
0
def test_gxy():
    "gravmag.sphere.gxy python vs cython implementation"
    py = _sphere_numpy.gxy(xp, yp, zp, model)
    cy = sphere.gxy(xp, yp, zp, model)
    diff = np.abs(py - cy)
    assert np.all(diff <= precision), 'max diff: %g' % (max(diff))
Esempio n. 3
0
def test_gxy():
    "gravmag.sphere.gxy python vs cython implementation"
    py = _sphere_numpy.gxy(xp, yp, zp, model)
    cy = sphere.gxy(xp, yp, zp, model)
    diff = np.abs(py - cy)
    assert np.all(diff <= precision), 'max diff: %g' % (max(diff))
Esempio n. 4
0
"""
GravMag: Forward modeling of the gravity anomaly and gravity gradient tensor
using model
"""
from fatiando import mesher, gridder
from fatiando.gravmag import sphere
from fatiando.vis import mpl

model = [mesher.Sphere(0, 0, 2000, 1000, {'density': 1000})]
area = (-5000, 5000, -5000, 5000)
shape = (100, 100)
x, y, z = gridder.regular(area, shape, z=-100)
gz = sphere.gz(x, y, z, model)
tensor = [sphere.gxx(x, y, z, model),
          sphere.gxy(x, y, z, model),
          sphere.gxz(x, y, z, model),
          sphere.gyy(x, y, z, model),
          sphere.gyz(x, y, z, model),
          sphere.gzz(x, y, z, model)]
mpl.figure()
mpl.axis('scaled')
mpl.title('gz')
mpl.contourf(y, x, gz, shape, 15)
mpl.colorbar()
mpl.m2km()
mpl.figure()
titles = ['gxx', 'gxy', 'gxz', 'gyy', 'gyz', 'gzz']
for i, field in enumerate(tensor):
    mpl.subplot(2, 3, i + 1)
    mpl.axis('scaled')
    mpl.title(titles[i])
                  z=1.5e3,
                  radius=1.5e3,
                  props={'density': -500})
]

# Create a regular grid at a constant height
shape = (300, 300)
area = [0, 30e3, 0, 30e3]
x, y, z = gridder.regular(area, shape, z=-100)

fields = [
    ['Gravity (mGal)', sphere.gz(x, y, z, model)],
    ['gxx (Eotvos)', sphere.gxx(x, y, z, model)],
    ['gyy (Eotvos)', sphere.gyy(x, y, z, model)],
    ['gzz (Eotvos)', sphere.gzz(x, y, z, model)],
    ['gxy (Eotvos)', sphere.gxy(x, y, z, model)],
    ['gxz (Eotvos)', sphere.gxz(x, y, z, model)],
    ['gyz (Eotvos)', sphere.gyz(x, y, z, model)],
]

# Make maps of all fields calculated
fig = plt.figure(figsize=(10, 8))
plt.rcParams['font.size'] = 10
X, Y = x.reshape(shape) / 1000, y.reshape(shape) / 1000
for i, tmp in enumerate(fields):
    ax = plt.subplot(3, 3, i + 3)
    field, data = tmp
    scale = np.abs([data.min(), data.max()]).max()
    ax.set_title(field)
    plot = ax.pcolormesh(Y,
                         X,
Esempio n. 6
0
"""
GravMag: Forward modeling of the gravity anomaly and gravity gradient tensor
using model
"""
from fatiando import mesher, gridder
from fatiando.gravmag import sphere
from fatiando.vis import mpl

model = [mesher.Sphere(0, 0, 2000, 1000, {'density': 1000})]
area = (-5000, 5000, -5000, 5000)
shape = (100, 100)
x, y, z = gridder.regular(area, shape, z=-100)
gz = sphere.gz(x, y, z, model)
tensor = [
    sphere.gxx(x, y, z, model),
    sphere.gxy(x, y, z, model),
    sphere.gxz(x, y, z, model),
    sphere.gyy(x, y, z, model),
    sphere.gyz(x, y, z, model),
    sphere.gzz(x, y, z, model)
]
mpl.figure()
mpl.axis('scaled')
mpl.title('gz')
mpl.contourf(y, x, gz, shape, 15)
mpl.colorbar()
mpl.m2km()
mpl.figure()
titles = ['gxx', 'gxy', 'gxz', 'gyy', 'gyz', 'gzz']
for i, field in enumerate(tensor):
    mpl.subplot(2, 3, i + 1)