Skip to content

Commit

Permalink
Improve docstrings of prism gravity functions (#429)
Browse files Browse the repository at this point in the history
Add new fields to prism layer gravity method. Replace mgal for mGal in
all docstrings and comments.
  • Loading branch information
santisoler authored Sep 8, 2023
1 parent 001be9a commit 49d1c1c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
4 changes: 2 additions & 2 deletions harmonica/_forward/prism.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def prism_gravity(
- The gravitational potential is returned in
:math:`\text{J}/\text{kg}`.
- The gravity acceleration components are returned in mgal
- The gravity acceleration components are returned in mGal
(:math:`\text{m}/\text{s}^2`).
- The tensor components are returned in Eotvos (:math:`\text{s}^{-2}`).
Expand Down Expand Up @@ -133,7 +133,7 @@ def prism_gravity(
result : array
Gravitational field generated by the prisms on the computation points.
Gravitational potential is returned in :math:`\text{J}/\text{kg}`,
acceleration components in mgal, and tensor components in Eotvos.
acceleration components in mGal, and tensor components in Eotvos.
Notes
-----
Expand Down
8 changes: 6 additions & 2 deletions harmonica/_forward/prism_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,11 @@ def gravity(
Gravitational field that wants to be computed.
The available fields are:
- Gravitational potential: ``potential``
- Eastward acceleration: ``g_e``
- Northward acceleration: ``g_n``
- Downward acceleration: ``g_z``
- Diagonal tensor components: ``g_ee``, ``g_nn``, ``g_zz``
- Non-diagonal tensor components: ``g_en``, ``g_ez``, ``g_nz``
density_name : str (optional)
Name of the property layer (or ``data_var`` of the
:class:`xarray.Dataset`) that will be used for the density of each
Expand All @@ -350,8 +354,8 @@ def gravity(
Returns
-------
result : array
Gravitational field generated by the prisms on the computation
points in mGal.
Gravitational potential is returned in :math:`\text{J}/\text{kg}`,
acceleration components in mGal, and tensor components in Eotvos.
See also
--------
Expand Down
4 changes: 2 additions & 2 deletions harmonica/_forward/tesseroid.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def tesseroid_gravity(
- The gravitational potential is returned in
:math:`\text{J}/\text{kg}`.
- The gravity acceleration components are returned in mgal
- The gravity acceleration components are returned in mGal
(:math:`\text{m}/\text{s}^2`).
Parameters
Expand Down Expand Up @@ -110,7 +110,7 @@ def tesseroid_gravity(
result : array
Gravitational field generated by the tesseroids on the computation
points. Gravitational potential is returned in
:math:`\text{J}/\text{kg}` and acceleration components in mgal.
:math:`\text{J}/\text{kg}` and acceleration components in mGal.
References
----------
Expand Down
8 changes: 4 additions & 4 deletions harmonica/tests/test_point_gravity.py
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ def test_point_mass_on_origin():
longitude = np.linspace(-180, 180, 37)
latitude = np.linspace(-90, 90, 19)
longitude, latitude, radius = np.meshgrid(longitude, latitude, radius)
# Analytical solutions (accelerations are in mgal and tensor components in
# Analytical solutions (accelerations are in mGal and tensor components in
# eotvos)
analytical = {
"potential": GRAVITATIONAL_CONST * mass / radius,
Expand Down Expand Up @@ -662,7 +662,7 @@ def test_point_mass_same_radial_direction(field):
np.array(height + sphere_radius),
]
# Analytical solutions
# (accelerations are in mgal and tensor components in eotvos)
# (accelerations are in mGal and tensor components in eotvos)
analytical = {
"potential": GRAVITATIONAL_CONST * mass / height,
"g_z": GRAVITATIONAL_CONST * mass / height**2 * 1e5,
Expand Down Expand Up @@ -690,7 +690,7 @@ def test_point_mass_potential_on_equator():
np.array(radius),
]
# Analytical solutions
# (accelerations are in mgal and tensor components in eotvos)
# (accelerations are in mGal and tensor components in eotvos)
distance = (
2 * radius * np.sin(0.5 * np.radians(abs(longitude - longitude_p)))
)
Expand Down Expand Up @@ -720,7 +720,7 @@ def test_point_mass_potential_on_same_meridian():
np.array(radius),
]
# Analytical solutions
# (accelerations are in mgal and tensor components in eotvos)
# (accelerations are in mGal and tensor components in eotvos)
distance = (
2 * radius * np.sin(0.5 * np.radians(abs(latitude - latitude_p)))
)
Expand Down

0 comments on commit 49d1c1c

Please sign in to comment.