Class to model Earth’s globe.
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.
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. |
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 |
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()
>>> s = str(e)
>>> v = s.split(':')
>>> print(v[0] + '|' + str(round(float(v[1]), 14)) + '|' + v[2] )
6378137.0|0.00335281066475|7.292115e-05
list of weak references to the object (if defined)
This method computes the apparent heliocentric position of the Earth for a given epoch, using the VSOP87 theory.
Parameters: |
|
---|---|
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 |
Raises: | TypeError if input values are of wrong type. |
>>> epoch = Epoch(1992, 10, 13.0)
>>> lon, lat, r = Earth.apparent_heliocentric_position(epoch)
>>> print(round(lon.to_positive(), 6))
19.905986
>>> print(lat.dms_str(n_dec=3))
-0.721''
>>> print(round(r, 8))
0.99760852
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: |
|
---|---|
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 = Earth(ellipsoid=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
This method computes the geometric heliocentric position of the Earth for a given epoch, using the VSOP87 theory.
Parameters: |
|
---|---|
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 |
Raises: | TypeError if input values are of wrong type. |
>>> epoch = Epoch(1992, 10, 13.0)
>>> l, b, r = Earth.geometric_heliocentric_position(epoch, tofk5=False)
>>> print(round(l.to_positive(), 6))
19.907297
>>> print(b.dms_str(n_dec=3))
-0.744''
>>> print(round(r, 8))
0.99760852
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: |
|
---|---|
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 |
Raises: | TypeError if input values are of wrong type. |
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 = Earth(ellipsoid=IAU76)
>>> round(e.linear_velocity(42.0), 2)
346.16
This method computes the orbital elements of Earth for the standard equinox J2000.0 for a given epoch.
Parameters: | epoch (Epoch) – Epoch to compute orbital elements, as an Epoch object |
---|---|
Returns: | A tuple containing the following six orbital elements: - Mean longitude of the planet (Angle) - Semimajor axis of the orbit (float, astronomical units) - eccentricity of the orbit (float) - inclination on the plane of the ecliptic (Angle) - longitude of the ascending node (Angle) - argument of the perihelion (Angle) |
Return type: | tuple |
Raises: | TypeError if input values are of wrong type. |
>>> epoch = Epoch(2065, 6, 24.0)
>>> l, a, e, i, ome, arg = Earth.orbital_elements_j2000(epoch)
>>> print(round(l, 6))
271.801199
>>> print(round(a, 8))
1.00000102
>>> print(round(e, 7))
0.0166811
>>> print(round(i, 6))
0.008544
>>> print(round(ome, 5))
174.71534
>>> print(round(arg, 6))
-71.566717
This method computes the orbital elements of Earth for the mean equinox of the date for a given epoch.
Parameters: | epoch (Epoch) – Epoch to compute orbital elements, as an Epoch object |
---|---|
Returns: | A tuple containing the following six orbital elements: - Mean longitude of the planet (Angle) - Semimajor axis of the orbit (float, astronomical units) - eccentricity of the orbit (float) - inclination on the plane of the ecliptic (Angle) - longitude of the ascending node (Angle) - argument of the perihelion (Angle) |
Return type: | tuple |
Raises: | TypeError if input values are of wrong type. |
>>> epoch = Epoch(2065, 6, 24.0)
>>> l, a, e, i, ome, arg = Earth.orbital_elements_mean_equinox(epoch)
>>> print(round(l, 6))
272.716028
>>> print(round(a, 8))
1.00000102
>>> print(round(e, 7))
0.0166811
>>> print(round(i, 6))
0.0
>>> print(round(ome, 5))
174.71534
>>> print(round(arg, 6))
-70.651889
This function computes the parallaxes in right ascension and declination in order to obtain the topocentric values.
Parameters: |
|
---|---|
Returns: | Tuple containing the topocentric right ascension and declination |
Return type: | tuple |
Raises: | TypeError if input values are of wrong type. |
>>> 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''
This function computes the topocentric coordinates of a celestial body (Moon or planet) directly from its geocentric values in ecliptical coordinates.
Parameters: |
|
---|---|
Returns: | Tuple containing the topocentric longitude, latitude and semidiameter |
Return type: | tuple |
Raises: | TypeError if input values are of wrong type. |
>>> 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''
This function computes the time of passage by the nodes (ascending or descending) of Earth, nearest to the given epoch.
Parameters: |
|
---|---|
Returns: | Tuple containing: - Time of passage through the node (Epoch) - Radius vector when passing through the node (in AU, float) |
Return type: | tuple |
Raises: | TypeError if input values are of wrong type. |
>>> epoch = Epoch(2019, 1, 1)
>>> time, r = Earth.passage_nodes(epoch)
>>> year, month, day = time.get_date()
>>> print(year)
2019
>>> print(month)
3
>>> print(round(day, 1))
15.0
>>> print(round(r, 4))
0.9945
This method computes the time of Perihelion (or Aphelion) closer to a given epoch.
Parameters: |
|
---|---|
Returns: | The epoch of the desired Perihelion (or Aphelion) |
Return type: | Epoch |
Raises: | TypeError if input values are of wrong type. |
>>> epoch = Epoch(1989, 11, 20.0)
>>> e = Earth.perihelion_aphelion(epoch)
>>> y, m, d, h, mi, s = e.get_full_date()
>>> print(y)
1990
>>> print(m)
1
>>> print(d)
4
>>> print(h)
17
>>> epoch = Epoch(2000, 4, 1.0)
>>> e = Earth.perihelion_aphelion(epoch, perihelion=False)
>>> 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(2003, 3, 10.0)
>>> e = Earth.perihelion_aphelion(epoch)
>>> 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
>>> epoch = Epoch(2009, 5, 1.0)
>>> e = Earth.perihelion_aphelion(epoch, perihelion=False)
>>> 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
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 = Earth(ellipsoid=IAU76)
>>> round(e.rho(0.0), 1)
1.0
Method to compute the rho*cos(phi’) term, needed in the calculation of diurnal parallaxes, eclipses and occulatitions.
Parameters: |
|
---|---|
Returns: | rho*cos(phi’) term |
Return type: | float |
Raises: | TypeError if input value is of wrong type. |
>>> lat = Angle(33, 21, 22.0)
>>> e = Earth(ellipsoid=IAU76)
>>> round(e.rho_cosphi(lat, 1706), 6)
0.836339
Method to compute the rho*sin(phi’) term, needed in the calculation of diurnal parallaxes, eclipses and occulatitions.
Parameters: |
|
---|---|
Returns: | rho*sin(phi’) term |
Return type: | float |
Raises: | TypeError if input value is of wrong type. |
>>> lat = Angle(33, 21, 22.0)
>>> e = Earth(ellipsoid=IAU76)
>>> round(e.rho_sinphi(lat, 1706), 6)
0.546861
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 = Earth(ellipsoid=IAU76)
>>> round(e.rm(42.0), 1)
6364033.3
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 = Earth(ellipsoid=IAU76)
>>> round(e.rp(42.0), 1)
4747001.2
Method used to define an Earth object.
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: | None |
Return type: | None |
Raises: | TypeError if input value is of wrong type. |
Class Ellipsoid is useful to encapsulate the most important parameters of a given reference ellipsoid.
Ellipsoid constructor.
Parameters: |
|
---|
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)'
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
list of weak references to the object (if defined)
Reference ellipsoid defined by the International Astronomic Union in 1976
This table contains the parameters to compute Earth’s orbital elements for the mean equinox of date. Based in Table 31.A, page 212
This table contains the parameters to compute Earth’s orbital elements for the standard equinox J2000.0. Based on Table 31.B, page 214
This table contains Earth’s periodic terms (all of them) from the planetary theory VSOP87 for the heliocentric latitude at the equinox of date (taken from the ‘D’ solution). In Meeus’ book a shortened version can be found in page 420.
This table contains Earth’s most important periodic terms from the planetary theory VSOP87 for the heliocentric latitude, referred to the equinox J2000.0. In Meeus’ book these values can be found in page 420 and page 173.
This table contains Earth’s periodic terms (all of them) from the planetary theory VSOP87 for the heliocentric longitude at the equinox of date (taken from the ‘D’ solution). In Meeus’ book a shortened version can be found in pages 418-420.
This table contains Earth’s most important periodic terms from the planetary theory VSOP87 for the heliocentric longitude, referred to the equinox J2000.0. In Meeus’ book these values can be found in pages 418-420 and page 173.
This table contains Earth’s periodic terms (all of them) from the planetary theory VSOP87 for the radius vector at the equinox of date (taken from the ‘D’ solution). In Meeus’ book a shortened version can be found in pages 420-421.
Reference ellipsoid World Geodetic System 1984, a modern ellipsoid used by the GPS system, and the standard in many applications