Skip to content

Commit

Permalink
Fix docstring tests for comments and reference
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Wieczorek committed Oct 7, 2024
1 parent 2983012 commit 67d46ce
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 42 deletions.
11 changes: 5 additions & 6 deletions boule/_ellipsoid.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
55 changes: 30 additions & 25 deletions boule/_sphere.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
>>> print(f"{sphere.area:.10f} m²")
12.5663706144
1737151.0 m
>>> print(f"{sphere.volume:.12e} m³")
2.195843181718e+19
>>> print(f"{sphere.area:.12e} m²")
3.792145613798e+13
>>> 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²
"""

Expand Down
16 changes: 5 additions & 11 deletions boule/_triaxialellipsoid.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 67d46ce

Please sign in to comment.