From 67d46ce2ae55f9ff827f3850524f676167546711 Mon Sep 17 00:00:00 2001 From: Mark Wieczorek Date: Mon, 7 Oct 2024 12:58:02 +0200 Subject: [PATCH] Fix docstring tests for comments and reference --- boule/_ellipsoid.py | 11 ++++---- boule/_sphere.py | 55 ++++++++++++++++++++----------------- boule/_triaxialellipsoid.py | 16 ++++------- 3 files changed, 40 insertions(+), 42 deletions(-) diff --git a/boule/_ellipsoid.py b/boule/_ellipsoid.py index 621a8c81..2186f540 100644 --- a/boule/_ellipsoid.py +++ b/boule/_ellipsoid.py @@ -83,10 +83,8 @@ class Ellipsoid: ... flattening=1 / 298.257223563, ... geocentric_grav_const=3986004.418e8, ... angular_velocity=7292115e-11, - ... reference=( - ... "Hofmann-Wellenhof, B., & Moritz, H. (2006). Physical Geodesy " - ... "(2nd, corr. ed. 2006 edition ed.). Wien ; New York: Springer." - ... ), + ... reference="Hofmann-Wellenhof & Moritz (2006)", + ... comments="This is the same as the boule WGS84 ellipsoid.", ... ) >>> print(ellipsoid) # doctest: +ELLIPSIS WGS84 - World Geodetic System 1984 @@ -96,8 +94,9 @@ class Ellipsoid: GM: 398600441800000.0 m³/s² Angular velocity: 7.292115e-05 rad/s Source: - Hofmann-Wellenhof, B., & Moritz, H. (2006). Physical Geodesy (2nd, - corr. ed. 2006 edition ed.). Wien ; New York: Springer. + Hofmann-Wellenhof & Moritz (2006) + Comments: + This is the same as the boule WGS84 ellipsoid. >>> print(ellipsoid.long_name) World Geodetic System 1984 diff --git a/boule/_sphere.py b/boule/_sphere.py index 9540c089..ba9774ad 100644 --- a/boule/_sphere.py +++ b/boule/_sphere.py @@ -76,29 +76,34 @@ class Sphere: >>> sphere = Sphere( ... name="Moon", - ... long_name="That's no moon", - ... radius=1, - ... geocentric_grav_const=2, - ... angular_velocity=0.5, + ... long_name="Moon Spheroid", + ... radius=1737151, + ... geocentric_grav_const=4902800070000.0, + ... angular_velocity=2.6617073e-06, + ... reference="Wieczorek (2015)", + ... comments="This is the same as the boule Moon2015 spheroid." ... ) >>> print(sphere) # doctest: +ELLIPSIS - Moon - That's no moon + Moon - Moon Spheroid Spheroid: - Radius: 1 m - GM: 2 m³/s² - Angular velocity: 0.5 rad/s + Radius: 1737151 m + GM: 4902800070000.0 m³/s² + Angular velocity: 2.6617073e-06 rad/s + Source: + Wieczorek (2015) + Comments: + This is the same as the boule Moon2015 spheroid. >>> print(sphere.long_name) - That's no moon + Moon Spheroid - The sphere defines semi-axis, flattening, and some eccentricities similar - to :class:`~bould.Ellipsoid` for compatibility with the coordinate - conversion functions of pymap3d: + The sphere defines semi-axess, flattening, and some eccentricities similar + to :class:`~bould.Ellipsoid` for compatibility: >>> print(sphere.semiminor_axis) - 1 + 1737151 >>> print(sphere.semimajor_axis) - 1 + 1737151 >>> print(sphere.first_eccentricity) 0 >>> print(sphere.eccentricity) @@ -108,23 +113,23 @@ class Sphere: >>> print(sphere.thirdflattening) 0 >>> print(sphere.mean_radius) - 1 + 1737151 >>> print(sphere.semiaxes_mean_radius) - 1 + 1737151 >>> print(f"{sphere.volume_equivalent_radius:.1f} m") - 1.0 m - >>> print(f"{sphere.volume:.10f} m³") - 4.1887902048 m³ - >>> print(f"{sphere.area:.10f} m²") - 12.5663706144 m² + 1737151.0 m + >>> print(f"{sphere.volume:.12e} m³") + 2.195843181718e+19 m³ + >>> print(f"{sphere.area:.12e} m²") + 3.792145613798e+13 m² >>> print(sphere.area_equivalent_radius) - 1 + 1737151 >>> print(f"{sphere.mass:.12e} kg") - 2.996568928577e+10 kg + 7.345789176393e+22 kg >>> print(f"{sphere.mean_density:.0f} kg/m³") - 7153781359 kg/m³ + 3345 kg/m³ >>> print(f"{sphere.reference_normal_gravitational_potential:.3f} m²/s²") - 2.000 m²/s² + 2822322.337 m²/s² """ diff --git a/boule/_triaxialellipsoid.py b/boule/_triaxialellipsoid.py index e32afb0f..928d5381 100644 --- a/boule/_triaxialellipsoid.py +++ b/boule/_triaxialellipsoid.py @@ -93,13 +93,8 @@ class TriaxialEllipsoid: ... geocentric_grav_const=17.288e9, ... angular_velocity=3.267e-4, ... semimajor_axis_longitude=8.29, - ... reference=( - ... "Karimi, R., Azmoudeh Ardalan, A., & Vasheghani Farahani, S. " - ... "(2017). The size, shape and orientation of the asteroid " - ... "Vesta based on data from the Dawn mission. Earth and " - ... "Planetary Science Letters, 475, 71–82. " - ... "https://doi.org/10.1016/j.epsl.2017.07.033" - ... ), + ... reference="Karimi et al. (2017)", + ... comments="This is the same as the VestaTriaxial2017 ellipsoid." ... ) >>> print(ellipsoid) # doctest: +ELLIPSIS Vesta - Vesta Triaxial Ellipsoid @@ -111,10 +106,9 @@ class TriaxialEllipsoid: GM: 17288000000.0 m³/s² Angular velocity: 0.0003267 rad/s Source: - Karimi, R., Azmoudeh Ardalan, A., & Vasheghani Farahani, S. (2017). - The size, shape and orientation of the asteroid Vesta based on data - from the Dawn mission. Earth and Planetary Science Letters, 475, - 71–82. https://doi.org/10.1016/j.epsl.2017.07.033 + Karimi et al. (2017) + Comments: + This is the same as the VestaTriaxial2017 ellipsoid. >>> print(ellipsoid.long_name) Vesta Triaxial Ellipsoid