Earth

Class to model Earth’s globe.

Earth examples

Earth - VSOP87-Parameters

class pyplanets.planets.earth.Earth(epoch: pyplanets.core.epoch.Epoch, ellipsoid=Ellipsoid(6378137.0, 0.0033528106647474805, 7.292115e-05))[source]

Class Earth models the figure of the Earth surface and, with the help of a configurable reference ellipsoid, provides a set of handy method to compute different parameters, like the distance between two points on the surface.

Please note that here we depart a little bit from Meeus’ book because the Earth class uses the World Geodetic System 1984 (WGS84) as the default reference ellipsoid, instead of the International Astronomical Union 1974, which Meeus uses. This change is done because WGS84 is regarded as more modern.

__init__(epoch: pyplanets.core.epoch.Epoch, ellipsoid=Ellipsoid(6378137.0, 0.0033528106647474805, 7.292115e-05))[source]

Earth constructor.

It takes a reference ellipsoid as input. If not provided, the ellipsoid used is the WGS84 by default.

Parameters

ellipsoid – Reference ellipsoid to be used. WGS84 by default.

Returns

Earth object.

Return type

Earth

Raises

TypeError if input value is of wrong type.

__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

__str__()[source]

Method used when trying to print the Earth object. It essentially returns the corresponting ‘__str__()’ method from the reference ellipsoid being used.

Returns

Semi-major equatorial radius, flattening and angular velocity of the current reference ellipsoid, as a string.

Return type

string

>>> e = Earth(Epoch(2020, 12, 30))
>>> s = str(e)
>>> v = s.split(':')
>>> print(v[0] + '|' + str(round(float(v[1]), 14)) + '|' + v[2] )
6378137.0|0.00335281066475|7.292115e-05
aphelion()pyplanets.core.epoch.Epoch[source]

This method computes the time of Aphelion closer to a given epoch.

Returns

The epoch of the desired Aphelion

Return type

Epoch

>>> epoch = Epoch(2000, 4, 1.0)
>>> e = Earth(epoch).aphelion()
>>> y, m, d, h, mi, s = e.get_full_date()
>>> print(y)
2000
>>> print(m)
7
>>> print(d)
3
>>> print(h)
23
>>> print(mi)
51
>>> epoch = Epoch(2009, 5, 1.0)
>>> e = Earth(epoch).aphelion()
>>> y, m, d, h, mi, s = e.get_full_date()
>>> print(y)
2009
>>> print(m)
7
>>> print(d)
4
>>> print(h)
1
>>> print(mi)
41
geometric_heliocentric_position_j2000(tofk5=True)[source]

This method computes the geometric heliocentric position of the Earth for a given epoch, using the VSOP87 theory, referred to the equinox J2000.0.

Parameters

tofk5 (bool) – Whether or not the small correction to convert to the FK5 system will be applied or not

Returns

A tuple with the heliocentric longitude and latitude (as Angle objects), and the radius vector (as a float, in astronomical units), in that order

Return type

tuple

static parallax_correction(right_ascension: pyplanets.core.angle.Angle, declination: pyplanets.core.angle.Angle, latitude: pyplanets.core.angle.Angle, distance: float, hour_angle: pyplanets.core.angle.Angle, height: float = 0.0) -> (<class 'pyplanets.core.angle.Angle'>, <class 'pyplanets.core.angle.Angle'>)[source]

This function computes the parallaxes in right ascension and declination in order to obtain the topocentric values.

Parameters
  • right_ascension (Angle) – Geocentric right ascension, as an Angle object

  • declination (Angle) – Geocentric declination, as an Angle object

  • latitude (Angle) – Latitude of the observation point

  • distance (float) – Distance from the celestial object to the Earth, in Astronomical Units

  • hour_angle (Angle) – Geocentric hour angle of the celestial object, as an Angle

  • height (float) – Height of observation point above sea level, in meters

Returns

Tuple containing the topocentric right ascension and declination

Return type

tuple

>>> right_ascension = Angle(22, 38, 7.25, ra=True)
>>> declination = Angle(-15, 46, 15.9)
>>> latitude = Angle(33, 21, 22)
>>> distance = 0.37276
>>> hour_angle = Angle(288.7958)
>>> topo_ra, topo_dec = Earth.parallax_correction(right_ascension,                                                           declination,                                                           latitude, distance,                                                           hour_angle)
>>> print(topo_ra.ra_str(n_dec=2))
22h 38' 8.54''
>>> print(topo_dec.dms_str(n_dec=1))
-15d 46' 30.0''
static parallax_ecliptical(longitude: pyplanets.core.angle.Angle, latitude: pyplanets.core.angle.Angle, semidiameter: pyplanets.core.angle.Angle, obs_lat: pyplanets.core.angle.Angle, obliquity: pyplanets.core.angle.Angle, sidereal_time: pyplanets.core.angle.Angle, distance: float, height: float = 0.0) -> (<class 'pyplanets.core.angle.Angle'>, <class 'pyplanets.core.angle.Angle'>, <class 'pyplanets.core.angle.Angle'>)[source]

This function computes the topocentric coordinates of a celestial body (Moon or planet) directly from its geocentric values in ecliptical coordinates.

Parameters
  • longitude (Angle) – Geocentric ecliptical longitude as an Angle

  • latitude (Angle) – Geocentric ecliptical latitude as an Angle

  • semidiameter (Angle) – Geocentric semidiameter as an Angle

  • obs_lat (Angle) – Latitude of the observation point

  • obliquity (Angle) – Obliquity of the eliptic, as an Angle

  • sidereal_time (Angle) – Local sidereal time, as an Angle

  • distance (float) – Distance from the celestial object to the Earth, in Astronomical Units

  • height (float) – Height of observation point above sea level, in meters

Returns

Tuple containing the topocentric longitude, latitude and semidiameter

Return type

tuple

>>> longitude = Angle(181, 46, 22.5)
>>> latitude = Angle(2, 17, 26.2)
>>> semidiameter = Angle(0, 16, 15.5)
>>> obs_lat = Angle(50, 5, 7.8)
>>> obliquity = Angle(23, 28, 0.8)
>>> sidereal_time = Angle(209, 46, 7.9)
>>> distance = 0.0024650163
>>> topo_lon, topo_lat, topo_diam =                 Earth.parallax_ecliptical(longitude, latitude, semidiameter,                                           obs_lat, obliquity, sidereal_time,                                           distance)
>>> print(topo_lon.dms_str(n_dec=1))
181d 48' 5.0''
>>> print(topo_lat.dms_str(n_dec=1))
1d 29' 7.1''
>>> print(topo_diam.dms_str(n_dec=1))
16' 25.5''
perihelion()pyplanets.core.epoch.Epoch[source]

This method computes the time of Perihelion closer to a given epoch.

Returns

The epoch of the desired Perihelion

Return type

Epoch

>>> epoch = Epoch(1989, 11, 20.0)
>>> e = Earth(epoch).perihelion()
>>> y, m, d, h, mi, s = e.get_full_date()
>>> print(y)
1990
>>> print(m)
1
>>> print(d)
4
>>> print(h)
17
>>> epoch = Epoch(2003, 3, 10.0)
>>> e = Earth(epoch).perihelion()
>>> y, m, d, h, mi, s = e.get_full_date()
>>> print(y)
2003
>>> print(m)
1
>>> print(d)
4
>>> print(h)
5
>>> print(mi)
1