boule.Ellipsoid¶
-
class
boule.
Ellipsoid
(name, semimajor_axis, flattening, geocentric_grav_const, angular_velocity, long_name=None, reference=None)[source]¶ Reference oblate ellipsoid.
The ellipsoid is oblate and spins around it’s minor axis. It is defined by four parameters (semi-major axis, flattening, geocentric gravitational constant, and angular velocity) and offers other derived quantities.
All attributes of this class are read-only and cannot be changed after instantiation.
All parameters are in SI units.
Note
Use
boule.Sphere
if you desire zero flattening because there are singularities for this particular case in the normal gravity calculations.- Parameters
name (str) – A short name for the ellipsoid, for example
'WGS84'
.semimajor_axis (float) – The semi-major axis of the ellipsoid (equatorial radius), usually represented by “a” [meters].
flattening (float) – The flattening of the ellipsoid (f) [adimensional].
geocentric_grav_const (float) – The geocentric gravitational constant (GM) [m^3 s^-2].
angular_velocity (float) – The angular velocity of the rotating ellipsoid (omega) [rad s^-1].
long_name (str or None) – A long name for the ellipsoid, for example
"World Geodetic System 1984"
(optional).reference (str or None) – Citation for the ellipsoid parameter values (optional).
Examples
We can define an ellipsoid by setting the 4 key numerical parameters:
>>> ellipsoid = Ellipsoid( ... name="oblate-ellipsoid", ... long_name="Oblate Ellipsoid", ... semimajor_axis=1, ... flattening=0.5, ... geocentric_grav_const=1, ... angular_velocity=0, ... ) >>> print(ellipsoid) Ellipsoid(name='oblate-ellipsoid', ...) >>> print(ellipsoid.long_name) Oblate Ellipsoid
The class defines several derived attributes based on the input parameters:
>>> print("{:.2f}".format(ellipsoid.semiminor_axis)) 0.50 >>> print("{:.2f}".format(ellipsoid.mean_radius)) 0.83 >>> print("{:.2f}".format(ellipsoid.linear_eccentricity)) 0.87 >>> print("{:.2f}".format(ellipsoid.first_eccentricity)) 0.87 >>> print("{:.2f}".format(ellipsoid.second_eccentricity)) 1.73
Methods Summary
|
Distance from the center of the ellipsoid to its surface. |
|
Convert from geodetic to geocentric spherical coordinates. |
|
Calculate normal gravity at any latitude and height. |
|
Calculate the prime vertical radius for a given geodetic latitude |
|
Convert from geocentric spherical to geodetic coordinates. |
-
Ellipsoid.
geocentric_radius
(latitude, geodetic=True)[source]¶ Distance from the center of the ellipsoid to its surface.
The geocentric radius and is a function of the geodetic latitude \(\phi\) and the semi-major and semi-minor axis, a and b:
\[R(\phi) = \sqrt{\dfrac{ (a^2\cos\phi)^2 + (b^2\sin\phi)^2}{ (a\cos\phi)^2 + (b\sin\phi)^2 } }\]See https://en.wikipedia.org/wiki/Earth_radius#Geocentric_radius
The same could be achieved with
boule.Ellipsoid.geodetic_to_spherical
by passing any value for the longitudes and heights equal to zero. This method provides a simpler and possibly faster alternative.Alternatively, the geocentric radius can also be expressed in terms of the geocentric (spherical) latitude \(\theta\):
\[R(\theta) = \sqrt{\dfrac{1}{ (\frac{\cos\theta}{a})^2 + (\frac{\sin\theta}{b})^2 } }\]This can be useful if you already have the geocentric latitudes and need the geocentric radius of the ellipsoid (for example, in spherical harmonic analysis). In these cases, the coordinate conversion route is not possible since we need the radial coordinates to do that in the first place.
Note
No elevation is taken into account (the height is zero). If you need the geocentric radius at a height other than zero, use
boule.Ellipsoid.geodetic_to_spherical
instead.- Parameters
- Returns
geocentric_radius (float or array) – The geocentric radius for the given latitude(s) in the same units as the ellipsoid axis.
-
Ellipsoid.
geodetic_to_spherical
(longitude, latitude, height)[source]¶ Convert from geodetic to geocentric spherical coordinates.
The geodetic datum is defined by this ellipsoid. The coordinates are converted following [Vermeille2002].
- Parameters
longitude (array) – Longitude coordinates on geodetic coordinate system in degrees.
latitude (array) – Latitude coordinates on geodetic coordinate system in degrees.
height (array) – Ellipsoidal heights in meters.
- Returns
longitude (array) – Longitude coordinates on geocentric spherical coordinate system in degrees. The longitude coordinates are not modified during this conversion.
spherical_latitude (array) – Converted latitude coordinates on geocentric spherical coordinate system in degrees.
radius (array) – Converted spherical radius coordinates in meters.
-
Ellipsoid.
normal_gravity
(latitude, height, si_units=False)[source]¶ Calculate normal gravity at any latitude and height.
Computes the magnitude of the gradient of the gravity potential (gravitational + centrifugal) generated by the ellipsoid at the given latitude and (geometric) height. Uses of a closed form expression of [LiGotze2001].
- Parameters
- Returns
gamma (float or array) – The normal gravity in mGal.
-
Ellipsoid.
prime_vertical_radius
(sinlat)[source]¶ Calculate the prime vertical radius for a given geodetic latitude
The prime vertical radius is defined as:
\[N(\phi) = \frac{a}{\sqrt{1 - e^2 \sin^2(\phi)}}\]Where \(a\) is the semi-major axis and \(e\) is the first eccentricity.
This function receives the sine of the latitude as input to avoid repeated computations of trigonometric functions.
- Parameters
sinlat (float or array-like) – Sine of the latitude angle.
- Returns
prime_vertical_radius (float or array-like) – Prime vertical radius given in the same units as the semi-major axis
-
Ellipsoid.
spherical_to_geodetic
(longitude, spherical_latitude, radius)[source]¶ Convert from geocentric spherical to geodetic coordinates.
The geodetic datum is defined by this ellipsoid. The coordinates are converted following [Vermeille2002].
- Parameters
longitude (array) – Longitude coordinates on geocentric spherical coordinate system in degrees.
spherical_latitude (array) – Latitude coordinates on geocentric spherical coordinate system in degrees.
radius (array) – Spherical radius coordinates in meters.
- Returns
longitude (array) – Longitude coordinates on geodetic coordinate system in degrees. The longitude coordinates are not modified during this conversion.
latitude (array) – Converted latitude coordinates on geodetic coordinate system in degrees.
height (array) – Converted ellipsoidal height coordinates in meters.