Ellipsoid

Class modeling an Ellipsoid.

class pyplanets.core.ellipsoid.Ellipsoid(a, f, omega)[source]

Class Ellipsoid is useful to encapsulate the most important parameters of a given reference ellipsoid.

__init__(a, f, omega)[source]

Ellipsoid constructor.

Parameters
  • a (float) – Semi-major or equatorial radius, in meters

  • f (float) – Flattening

  • omega (float) – Angular velocity of the Earth, in rad/s

__repr__()[source]

Method providing the ‘official’ string representation of the object. It provides a valid expression that could be used to recreate the object.

Returns

As string with a valid expression to recreate the object

Return type

string

>>> a = Ellipsoid(6378140.0, 0.0033528132, 7.292e-5)
>>> repr(a)
'Ellipsoid(6378140.0, 0.0033528132, 7.292e-05)'
__str__()[source]

Method used when trying to print the object.

Returns

Semi-major equatorial radius, flattening and angular velocity as a string.

Return type

string

>>> a = Ellipsoid(6378140.0, 0.0033528132, 7.292e-5)
>>> print(a)
6378140.0:0.0033528132:7.292e-05
__weakref__

list of weak references to the object (if defined)

b()[source]

Method to return the semi-minor radius.

Returns

Semi-minor radius, in meters

Return type

float

>>> a = Ellipsoid(6378140.0, 0.0033528132, 7.292e-5)
>>> round(a.b(), 3)
6356755.288
distance(lon1, lat1, lon2, lat2)[source]

This method computes the distance between two points on the Earth’s surface using the method from H. Andoyer.

Note

We will consider that positions ‘East’ and ‘South’ are negative.

Parameters
  • lon1 (int, float, Angle) – Longitude of the first point, in degrees

  • lat1 (int, float, Angle) – Geodetical or geographical latitude of the first point, in degrees

  • lon2 (int, float, Angle) – Longitude of the second point, in degrees

  • lat2 (int, float, Angle) – Geodetical or geographical latitude of the second point, in degrees

Returns

Tuple with distance between the two points along Earth’s surface, and approximate error, in meters

Return type

tuple

Raises

TypeError if input values are of wrong type.

>>> e = IAU76
>>> lon1 = Angle(-2, 20, 14.0)
>>> lat1 = Angle(48, 50, 11.0)
>>> lon2 = Angle(77, 3, 56.0)
>>> lat2 = Angle(38, 55, 17.0)
>>> dist, error = e.distance(lon1, lat1, lon2, lat2)
>>> round(dist, 0)
6181628.0
>>> error
69.0
>>> lon1 = Angle(-2.09)
>>> lat1 = Angle(41.3)
>>> lon2 = Angle(73.99)
>>> lat2 = Angle(40.75)
>>> dist, error = e.distance(lon1, lat1, lon2, lat2)
>>> round(dist, 0)
6176760.0
>>> error
69.0
e()[source]

Method to return the eccentricity of the Earth’s meridian.

Returns

Eccentricity of the Earth’s meridian

Return type

float

>>> a = Ellipsoid(6378140.0, 0.0033528132, 7.292e-5)
>>> round(a.e(), 8)
0.08181922
linear_velocity(latitude)[source]

Method to compute the linear velocity of a point at latitude, due to the rotation of the Earth.

Parameters

latitude (int, float, Angle) – Geodetical or geographical latitude of the observer, in degrees

Returns

Linear velocity of a point at latitude, in meters per second

Return type

float

Raises

TypeError if input value is of wrong type.

>>> e = IAU76
>>> round(e.linear_velocity(42.0), 2)
346.16
rho(latitude)[source]

Method to compute the rho term, which is the observer distance to the center of the Earth, when the observer is at sea level. In this case, the Earth’s equatorial radius is taken as unity.

Parameters

latitude (int, float, Angle) – Geodetical or geographical latitude of the observer, in degrees

Returns

Rho: Distance to the center of the Earth from sea level. It is a ratio with respect to Earth equatorial radius.

Return type

float

Raises

TypeError if input value is of wrong type.

>>> e = IAU76
>>> round(e.rho(0.0), 1)
1.0
rho_cosphi(latitude, height)[source]

Method to compute the rho*cos(phi’) term, needed in the calculation of diurnal parallaxes, eclipses and occulatitions.

Parameters
  • latitude (int, float, Angle) – Geodetical or geographical latitude of the observer, in degrees

  • height (int, float) – Height of the observer above the sea level, in meters

Returns

rho*cos(phi’) term

Return type

float

Raises

TypeError if input value is of wrong type.

>>> lat = Angle(33, 21, 22.0)
>>> e = IAU76
>>> round(e.rho_cosphi(lat, 1706), 6)
0.836339
rho_sinphi(latitude, height)[source]

Method to compute the rho*sin(phi’) term, needed in the calculation of diurnal parallaxes, eclipses and occulatitions.

Parameters
  • latitude (int, float, Angle) – Geodetical or geographical latitude of the observer, in degrees

  • height (int, float) – Height of the observer above the sea level, in meters

Returns

rho*sin(phi’) term

Return type

float

Raises

TypeError if input value is of wrong type.

>>> lat = Angle(33, 21, 22.0)
>>> e = IAU76
>>> round(e.rho_sinphi(lat, 1706), 6)
0.546861
rm(latitude)[source]

Method to compute the radius of curvature of the Earth’s meridian at the given latitude.

Parameters

latitude (int, float, Angle) – Geodetical or geographical latitude of the observer, in degrees

Returns

Radius of curvature of the Earth’s meridian at the given latitude, in meters

Return type

float

Raises

TypeError if input value is of wrong type.

>>> e = IAU76
>>> round(e.rm(42.0), 1)
6364033.3
rp(latitude)[source]

Method to compute the radius of the parallel circle at the given latitude.

Parameters

latitude (int, float, Angle) – Geodetical or geographical latitude of the observer, in degrees

Returns

Radius of the parallel circle at given latitude, in meters

Return type

float

Raises

TypeError if input value is of wrong type.

>>> e = IAU76
>>> round(e.rp(42.0), 1)
4747001.2
pyplanets.core.ellipsoid.IAU76 = Ellipsoid(6378140.0, 0.0033528131778969143, 7.292114992e-05)

Reference ellipsoid defined by the International Astronomic Union in 1976

pyplanets.core.ellipsoid.WGS84 = Ellipsoid(6378137.0, 0.0033528106647474805, 7.292115e-05)

Reference ellipsoid World Geodetic System 1984, a modern ellipsoid used by the GPS system, and the standard in many applications