"""
Meshing: Make and plot a tesseroid mesh with topography
"""
from fatiando import gridder, utils, mesher
from fatiando.vis import myv

w, e = -2, 2
s, n = -2, 2
bounds = (w, e, s, n, 500000, 0)

x, y = gridder.regular((w, e, s, n), (50, 50))
height = (250000 +
          -100000*utils.gaussian2d(x, y, 1, 5, x0=-1, y0=-1, angle=-60) +
          250000*utils.gaussian2d(x, y, 1, 1, x0=0.8, y0=1.7))

mesh = mesher.TesseroidMesh(bounds, (20, 50, 50))
mesh.carvetopo(x, y, height)

scene = myv.figure(zdown=False)
myv.tesseroids(mesh)
myv.earth(opacity=0.3)
myv.continents()
scene.scene.camera.position = [21592740.078245595, 22628783.944262519, -28903782.916664094]
scene.scene.camera.focal_point = [5405474.2152075395, -1711034.715136874, 2155879.3486608281]
scene.scene.camera.view_angle = 1.6492674416639987
scene.scene.camera.view_up = [0.91713422625547714, -0.1284658947859818, 0.37730799740742887]
scene.scene.camera.clipping_range = [20169510.286021926, 69721043.718536735]
scene.scene.camera.compute_view_plane_normal()
scene.scene.render()
myv.show()
コード例 #2
0
depths = (30000 +
    70000*utils.gaussian2d(mlons, mlats, 10, 10, -20, -20) +
    20000*utils.gaussian2d(mlons, mlats, 5, 5, 20, 20))
densities = (2700 +
    500*utils.gaussian2d(mlons, mlats, 40, 40, -20, -20) +
    -300*utils.gaussian2d(mlons, mlats, 20, 20, 20, 20))
model = [
    Tesseroid(lon - 0.5*dlon, lon + 0.5*dlon, lat - 0.5*dlat, lat + 0.5*dlat,
              0, -depth, props={'density':density})
    for lon, lat, depth, density in zip(mlons, mlats, depths, densities)]

# Plot the tesseroid model
myv.figure(zdown=False)
myv.tesseroids(model, 'density')
myv.continents()
myv.earth(opacity=0.7)
myv.show()

# Make the computation grid
area = (-50, 50, -50, 50)
shape = (100, 100)
lons, lats, heights = gridder.regular(area, shape, z=250000)

# Divide the model into nproc slices and calculate them in parallel
def calculate(chunk):
    return gravmag.tesseroid.gz(lons, lats, heights, chunk)
start = time.time()
nproc = 8 # Model size must be divisible by nproc
chunksize = len(model)/nproc
pool = Pool(processes=nproc)
gz = sum(pool.map(calculate,
コード例 #3
0
using tesseroids
"""
import time
from fatiando import gravmag, gridder, utils
from fatiando.mesher import Tesseroid
from fatiando.vis import mpl, myv

model = [
    Tesseroid(-60, -55, -30, -27, 0, -500000, props={'density': 200}),
    Tesseroid(-66, -62, -18, -12, 0, -300000, props={'density': -500})
]
# Show the model before calculating
scene = myv.figure(zdown=False)
myv.tesseroids(model, 'density')
myv.continents(linewidth=2)
myv.earth(opacity=0.8)
myv.meridians(range(0, 360, 45), opacity=0.2)
myv.parallels(range(-90, 90, 45), opacity=0.2)
scene.scene.camera.position = [
    23175275.131412581, -16937347.013663091, -4924328.2822419703
]
scene.scene.camera.focal_point = [0.0, 0.0, 0.0]
scene.scene.camera.view_angle = 30.0
scene.scene.camera.view_up = [
    0.083030001958377356, -0.17178720527713925, 0.98162883763562181
]
scene.scene.camera.clipping_range = [9229054.5133903362, 54238225.321054712]
scene.scene.camera.compute_view_plane_normal()
scene.scene.render()
myv.show()
コード例 #4
0
GravMag: Forward modeling of the gravitational potential and its derivatives
using tesseroids
"""
import time
from fatiando import gridder, utils
from fatiando.gravmag import tesseroid
from fatiando.mesher import Tesseroid
from fatiando.vis import mpl, myv

model = [Tesseroid(-60, -55, -30, -27, 0, -500000, props={'density': 200}),
         Tesseroid(-66, -62, -18, -12, 0, -300000, props={'density': -500})]
# Show the model before calculating
scene = myv.figure(zdown=False)
myv.tesseroids(model, 'density')
myv.continents(linewidth=2)
myv.earth(opacity=0.8)
myv.meridians(range(0, 360, 45), opacity=0.2)
myv.parallels(range(-90, 90, 45), opacity=0.2)
scene.scene.camera.position = [23175275.131412581, -16937347.013663091,
                               -4924328.2822419703]
scene.scene.camera.focal_point = [0.0, 0.0, 0.0]
scene.scene.camera.view_angle = 30.0
scene.scene.camera.view_up = [0.083030001958377356, -0.17178720527713925,
                              0.98162883763562181]
scene.scene.camera.clipping_range = [9229054.5133903362, 54238225.321054712]
scene.scene.camera.compute_view_plane_normal()
scene.scene.render()
myv.show()

# Create the computation grid
area = (-80, -30, -40, 10)
コード例 #5
0
tesseroid = Tesseroid(10, 20, 50, 60, 10**6, 0)

red, green, blue = (1, 0, 0), (0, 1, 0), (0, 0, 1)
white, black = (1, 1, 1), (0, 0, 0),

myv.figure()
# Make the prism red with blue edges, despite its density
myv.prisms([prism], 'density', color=red, edgecolor=blue)
# and the polyprism green with blue edges
myv.title('Body + edge colors')

myv.figure()
# For wireframes, color is usually set by the density.
# Overwrite this by setting *color*
# *edgecolor* is ignored
myv.polyprisms([polyprism],
               'density',
               style='wireframe',
               color=green,
               edgecolor=red,
               linewidth=2)
myv.title('Wireframe colors')

# Black background, white lines, green tesseroid
myv.figure(zdown=False, color=black)
myv.earth()
myv.continents(color=white)
myv.tesseroids([tesseroid], color=green, edgecolor=white)
myv.title('Black background', color=white)
myv.show()
コード例 #6
0
"""
Meshing: Make and plot a tesseroid mesh
"""
from fatiando import mesher
from fatiando.vis import myv

mesh = mesher.TesseroidMesh((-60, 60, -30, 30, 100000, -500000), (10, 10, 10))

myv.figure(zdown=False)
myv.tesseroids(mesh)
myv.earth(opacity=0.3)
myv.continents()
myv.meridians(range(-180, 180, 30))
myv.parallels(range(-90, 90, 30))
myv.show()
コード例 #7
0
ファイル: vis_myv_earth.py プロジェクト: Claudiadtx/Pelotas
"""
Vis: Plot the Earth, continents, inner and outer core in 3D with Mayavi2
"""
from fatiando.vis import myv

myv.figure(zdown=False)
myv.continents(linewidth=2)
myv.earth(opacity=0.5)
myv.core(opacity=0.7)
myv.core(inner=True)
myv.show()
コード例 #8
0
"""
Meshing: Make and plot a tesseroid with the Earth
"""
from fatiando import mesher
from fatiando.vis import myv

model = mesher.Tesseroid(-10, 10, 50, 60, 500000, 0)
myv.figure(zdown=False)
myv.tesseroids([model])
myv.earth()
myv.continents()
myv.meridians(range(-180, 180, 10))
myv.parallels(range(-90, 90, 10))
myv.show()
コード例 #9
0
model = [
    Tesseroid(lon - 0.5 * dlon,
              lon + 0.5 * dlon,
              lat - 0.5 * dlat,
              lat + 0.5 * dlat,
              0,
              -depth,
              props={'density': density})
    for lon, lat, depth, density in zip(mlons, mlats, depths, densities)
]

# Plot the tesseroid model
myv.figure(zdown=False)
myv.tesseroids(model, 'density')
myv.continents()
myv.earth(opacity=0.7)
myv.show()

# Make the computation grid
area = (-50, 50, -50, 50)
shape = (100, 100)
lons, lats, heights = gridder.regular(area, shape, z=250000)


# Divide the model into nproc slices and calculate them in parallel
def calculate(chunk):
    return gravmag.tesseroid.gz(lons, lats, heights, chunk)


start = time.time()
nproc = 8  # Model size must be divisible by nproc