Skip to content

Commit

Permalink
Merge pull request #2 from fatiando/master
Browse files Browse the repository at this point in the history
Replace gravity with gravitational in docstrings (fatiando#117)
  • Loading branch information
birocoles authored Nov 1, 2019
2 parents 116c3aa + b25b9b9 commit 01a4f91
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 27 deletions.
32 changes: 16 additions & 16 deletions harmonica/forward/point_mass.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def point_mass_gravity(
It can compute the gravitational fields of point masses on a set of computation
points defined either in Cartesian or geocentric spherical coordinates.
The potential gravity field generated by a point mass with mass :math:`m` located at
The gravitational potential field generated by a point mass with mass :math:`m` located at
a point :math:`Q` on a computation point :math:`P` can be computed as:
.. math::
Expand All @@ -42,7 +42,7 @@ def point_mass_gravity(
l = \sqrt{ (x - x_p)^2 + (y - y_p)^2 + (z - z_p)^2 }.
The gradient of the potential, also known as the gravity acceleration vector
The gradient of the potential, also known as the gravitational acceleration vector
:math:`\vec{g}`, is defined as:
.. math::
Expand All @@ -56,7 +56,7 @@ def point_mass_gravity(
g_{up}(P) = - \frac{G m}{l^3} (z - z_p).
We define the downward component of the gravity acceleration as the opposite of
We define the downward component of the gravitational acceleration as the opposite of
:math:`g_{up}`:
.. math::
Expand Down Expand Up @@ -88,7 +88,7 @@ def point_mass_gravity(
g_r(P) = - \frac{G m}{l^3} (r - r_p \cos \Psi).
We define the downward component of the gravity acceleration :math:`g_z` as the
We define the downward component of the gravitational acceleration :math:`g_z` as the
opposite of the radial component:
.. math::
Expand All @@ -100,12 +100,12 @@ def point_mass_gravity(
When working in Cartesian coordinates, the **z direction points upwards**, i.e.
positive and negative values of ``upward`` represent points above and below the
surface, respectively. But remember that the ``g_z`` field returns the downward
component of the gravity acceleration.
component of the gravitational acceleration.
.. warning::
When working in geocentric spherical coordinates, remember that the ``g_z``
field returns the downward component of the gravity acceleration on the local
field returns the downward component of the gravitational acceleration on the local
North oriented coordinate system. It is equivalent to the opposite of the radial
component, therefore it's positive if the acceleration vector points inside the
spheroid.
Expand Down Expand Up @@ -172,7 +172,7 @@ def point_mass_gravity(
# Sanity checks for coordinate_system and field
check_coordinate_system(coordinate_system)
if field not in kernels[coordinate_system]:
raise ValueError("Gravity field {} not recognized".format(field))
raise ValueError("Gravitational field {} not recognized".format(field))
# Figure out the shape and size of the output array
cast = np.broadcast(*coordinates[:3])
result = np.zeros(cast.size, dtype=dtype)
Expand Down Expand Up @@ -202,7 +202,7 @@ def jit_point_mass_cartesian(
easting, northing, upward, easting_p, northing_p, upward_p, masses, out, kernel
): # pylint: disable=invalid-name
"""
Compute gravity field of point masses on computation points in Cartesian coordinates
Compute gravitational field of point masses on computation points in Cartesian coordinates
Parameters
----------
Expand All @@ -216,7 +216,7 @@ def jit_point_mass_cartesian(
Array where the gravitational field on each computation point will be appended.
It must have the same size of ``easting``, ``northing`` and ``upward``.
kernel : func
Kernel function that will be used to compute the gravity field on the
Kernel function that will be used to compute the gravitational field on the
computation points.
"""
for l in range(easting.size):
Expand All @@ -236,7 +236,7 @@ def kernel_potential_cartesian(
easting, northing, upward, easting_p, northing_p, upward_p
):
"""
Kernel function for potential gravity field in Cartesian coordinates
Kernel function for gravitational potential field in Cartesian coordinates
"""
return 1 / distance_spherical(
(easting, northing, upward), (easting_p, northing_p, upward_p)
Expand All @@ -246,7 +246,7 @@ def kernel_potential_cartesian(
@jit(nopython=True)
def kernel_g_z_cartesian(easting, northing, upward, easting_p, northing_p, upward_p):
"""
Kernel function for downward component of gravity gradient in Cartesian coordinates
Kernel function for downward component of gravitational gradient in Cartesian coordinates
"""
distance = distance_cartesian(
[easting, northing, upward], [easting_p, northing_p, upward_p]
Expand All @@ -259,7 +259,7 @@ def jit_point_mass_spherical(
longitude, latitude, radius, longitude_p, latitude_p, radius_p, masses, out, kernel
): # pylint: disable=invalid-name
"""
Compute gravity field of point masses on computation points in spherical coordinates
Compute gravitational field of point masses on computation points in spherical coordinates
Parameters
----------
Expand All @@ -273,7 +273,7 @@ def jit_point_mass_spherical(
Array where the gravitational field on each computation point will be appended.
It must have the same size of ``longitude``, ``latitude`` and ``radius``.
kernel : func
Kernel function that will be used to compute the gravity field on the
Kernel function that will be used to compute the gravitational field on the
computation points.
"""
# Compute quantities related to computation point
Expand All @@ -286,7 +286,7 @@ def jit_point_mass_spherical(
latitude_p = np.radians(latitude_p)
cosphi_p = np.cos(latitude_p)
sinphi_p = np.sin(latitude_p)
# Compute gravity field
# Compute gravitational field
for l in range(longitude.size):
for m in range(longitude_p.size):
out[l] += masses[m] * kernel(
Expand All @@ -306,7 +306,7 @@ def kernel_potential_spherical(
longitude, cosphi, sinphi, radius, longitude_p, cosphi_p, sinphi_p, radius_p
):
"""
Kernel function for potential gravity field in spherical coordinates
Kernel function for potential gravitational field in spherical coordinates
"""
distance, _, _ = distance_spherical_core(
longitude, cosphi, sinphi, radius, longitude_p, cosphi_p, sinphi_p, radius_p
Expand All @@ -319,7 +319,7 @@ def kernel_g_z_spherical(
longitude, cosphi, sinphi, radius, longitude_p, cosphi_p, sinphi_p, radius_p
):
"""
Kernel function for downward component of gravity gradient in spherical coordinates
Kernel function for downward component of gravitational gradient in spherical coordinates
"""
distance, cospsi, _ = distance_spherical_core(
longitude, cosphi, sinphi, radius, longitude_p, cosphi_p, sinphi_p, radius_p
Expand Down
10 changes: 5 additions & 5 deletions harmonica/forward/prism.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def prism_gravity(
.. warning::
The **z direction points upwards**, i.e. positive and negative values of
``upward`` represent points above and below the surface, respectively. But
remember that the ``g_z`` field returns the downward component of the gravity
remember that the ``g_z`` field returns the downward component of the gravitational
acceleration so that positive density contrasts produce positive anomalies.
Parameters
Expand Down Expand Up @@ -74,7 +74,7 @@ def prism_gravity(
>>> coordinates = (130, 75, 30)
>>> # Define three computation points along the easting axe at 30m above the surface
>>> coordinates = ([-40, 0, 40], [0, 0, 0], [30, 30, 30])
>>> # Compute the downward component of the gravity acceleration that the prism
>>> # Compute the downward component of the gravitational acceleration that the prism
>>> # generates on the computation points
>>> gz = prism_gravity(coordinates, prism, density, field="g_z")
>>> print("({:.5f}, {:.5f}, {:.5f})".format(*gz))
Expand All @@ -92,7 +92,7 @@ def prism_gravity(
"""
kernels = {"potential": kernel_potential, "g_z": kernel_g_z}
if field not in kernels:
raise ValueError("Gravity field {} not recognized".format(field))
raise ValueError("Gravitational field {} not recognized".format(field))
# Figure out the shape and size of the output array
cast = np.broadcast(*coordinates[:3])
result = np.zeros(cast.size, dtype=dtype)
Expand Down Expand Up @@ -205,7 +205,7 @@ def jit_prism_gravity(
@jit(nopython=True)
def kernel_potential(easting, northing, upward):
"""
Kernel function for potential gravity field generated by a prism
Kernel function for potential gravitational field generated by a prism
"""
radius = np.sqrt(easting ** 2 + northing ** 2 + upward ** 2)
kernel = (
Expand All @@ -222,7 +222,7 @@ def kernel_potential(easting, northing, upward):
@jit(nopython=True)
def kernel_g_z(easting, northing, upward):
"""
Kernel function for downward component of gravity acceleration generated by a prism
Kernel function for downward component of gravitational acceleration generated by a prism
"""
radius = np.sqrt(easting ** 2 + northing ** 2 + upward ** 2)
kernel = (
Expand Down
12 changes: 6 additions & 6 deletions harmonica/forward/tesseroid.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def tesseroid_gravity(
.. warning::
The ``g_z`` field returns the downward component of the gravity acceleration on
The ``g_z`` field returns the downward component of the gravitational acceleration on
the local North oriented coordinate system. It is equivalent to the opposite of
the radial component, therefore it's positive if the acceleration vector points
inside the spheroid.
Expand Down Expand Up @@ -65,7 +65,7 @@ def tesseroid_gravity(
- Downward acceleration: ``g_z``
distance_size_ratio : dict or None (optional)
Dictionary containing distance-size ratii for each gravity field used on the
Dictionary containing distance-size ratii for each gravitational field used on the
adaptive discretization algorithm.
Values must be the available fields and keys should be the desired distance-size
ratio.
Expand Down Expand Up @@ -129,7 +129,7 @@ def tesseroid_gravity(
"""
kernels = {"potential": kernel_potential_spherical, "g_z": kernel_g_z_spherical}
if field not in kernels:
raise ValueError("Gravity field {} not recognized".format(field))
raise ValueError("Gravitational field {} not recognized".format(field))
# Figure out the shape and size of the output array
cast = np.broadcast(*coordinates[:3])
result = np.zeros(cast.size, dtype=dtype)
Expand All @@ -151,7 +151,7 @@ def tesseroid_gravity(
distance_size_ratii = DISTANCE_SIZE_RATII
if field not in distance_size_ratii:
raise ValueError(
'Gravity field "{}" not found on distance_size_ratii dictionary'.format(
'Gravitational field "{}" not found on distance_size_ratii dictionary'.format(
field
)
)
Expand All @@ -163,7 +163,7 @@ def tesseroid_gravity(
small_tesseroids = np.empty((max_discretizations, 6), dtype=dtype)
point_masses = np.empty((3, n_nodes * max_discretizations), dtype=dtype)
weights = np.empty(n_nodes * max_discretizations, dtype=dtype)
# Compute gravity field
# Compute gravitational field
jit_tesseroid_gravity(
coordinates,
tesseroids,
Expand Down Expand Up @@ -276,7 +276,7 @@ def jit_tesseroid_gravity(
point_masses,
weights,
)
# Compute gravity fields
# Compute gravitational fields
jit_point_mass_spherical(
coordinates[0][m : m + 1], # slice lon to pass a single element array
coordinates[1][m : m + 1], # slice lat to pass a single element array
Expand Down

0 comments on commit 01a4f91

Please sign in to comment.