-
Notifications
You must be signed in to change notification settings - Fork 90
Expand file tree
/
Copy pathtesseroid.py
More file actions
68 lines (54 loc) · 2 KB
/
tesseroid.py
File metadata and controls
68 lines (54 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# Copyright (c) 2018 The Harmonica Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
#
# This code is part of the Fatiando a Terra project (https://www.fatiando.org)
#
"""
Tesseroids (spherical prisms)
=============================
Computing the gravitational fields generated by regional or global scale
structures require to take into account the curvature of the Earth. One common
approach is to use spherical prisms also known as tesseroids. We will compute
the downward component of the gravitational acceleration generated by a single
tesseroid on a computation grid through the :func:`harmonica.tesseroid_gravity`
function.
"""
import boule as bl
import pygmt
import verde as vd
import harmonica as hm
# Use the WGS84 ellipsoid to obtain the mean Earth radius which we'll use to
# reference the tesseroid
ellipsoid = bl.WGS84
# Define tesseroid with top surface at the mean Earth radius, thickness of 10km
# (bottom = top - thickness) and density of 2670kg/m^3
tesseroid = [-70, -50, -40, -20, ellipsoid.mean_radius - 10e3, ellipsoid.mean_radius]
density = 2670
# Define computation points on a regular grid at 100km above the mean Earth
# radius
coordinates = vd.grid_coordinates(
region=[-80, -40, -50, -10],
shape=(80, 80),
extra_coords=100e3 + ellipsoid.mean_radius,
)
# Compute the radial component of the acceleration
gravity = hm.tesseroid_gravity(coordinates, tesseroid, density, field="g_z")
print(gravity)
grid = vd.make_xarray_grid(
coordinates, gravity, data_names="gravity", extra_coords_names="extra"
)
# Plot the gravitational field
fig = pygmt.Figure()
title = "Gravitational acceleration of a tesseroid"
with pygmt.config(FONT_TITLE="16p"):
fig.grdimage(
region=[-80, -40, -50, -10],
projection="M-60/-30/10c",
grid=grid.gravity,
frame=["a", f"+t{title}"],
cmap="viridis",
)
fig.colorbar(cmap=True, position="JMR", frame=["a200f50", "x+lmGal"])
fig.coast(shorelines="1p,black")
fig.show()