From b25b9b9ef32cd7a2e34bb68038f3732ae9b676f2 Mon Sep 17 00:00:00 2001 From: Vanderlei C Oliveira Jr Date: Fri, 25 Oct 2019 05:55:17 -0300 Subject: [PATCH] Replace gravity with gravitational in docstrings (#117) Gravity refers to the gravitational + centrifugal accelerations. Our forward modeling only computes the gravitational part so use the right term in the docstrings. --- harmonica/forward/point_mass.py | 32 ++++++++++++++++---------------- harmonica/forward/prism.py | 10 +++++----- harmonica/forward/tesseroid.py | 12 ++++++------ 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/harmonica/forward/point_mass.py b/harmonica/forward/point_mass.py index 2e78f5211..6c03833e7 100644 --- a/harmonica/forward/point_mass.py +++ b/harmonica/forward/point_mass.py @@ -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:: @@ -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:: @@ -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:: @@ -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:: @@ -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. @@ -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) @@ -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 ---------- @@ -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): @@ -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) @@ -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] @@ -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 ---------- @@ -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 @@ -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( @@ -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 @@ -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 diff --git a/harmonica/forward/prism.py b/harmonica/forward/prism.py index 5240745bb..dc629cb2c 100644 --- a/harmonica/forward/prism.py +++ b/harmonica/forward/prism.py @@ -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 @@ -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)) @@ -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) @@ -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 = ( @@ -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 = ( diff --git a/harmonica/forward/tesseroid.py b/harmonica/forward/tesseroid.py index 2da0537cc..72db56d36 100644 --- a/harmonica/forward/tesseroid.py +++ b/harmonica/forward/tesseroid.py @@ -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. @@ -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. @@ -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) @@ -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 ) ) @@ -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, @@ -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