Esempio n. 1
0
def test_earth_geometric_heliocentric_position():
    """Tests the geometric_heliocentric_position() method of Earth class"""

    epoch = Epoch(1992, 10, 13.0)
    lon, lat, r = Earth.geometric_heliocentric_position(epoch)

    assert abs(round(lon.to_positive(), 6) - 19.907272) < TOL, \
        "ERROR: 1st geometric_heliocentric_position() test doesn't match"

    assert lat.dms_str(n_dec=3) == "-0.721''", \
        "ERROR: 2nd geometric_heliocentric_position() test doesn't match"

    assert abs(round(r, 8) - 0.99760852) < TOL, \
        "ERROR: 3rd geometric_heliocentric_position() test doesn't match"
Esempio n. 2
0
    def geometric_geocentric_position(epoch, tofk5=True):
        """This method computes the geometric geocentric position of the Sun
        for a given epoch, using the VSOP87 theory.

        :param epoch: Epoch to compute Sun position, as an Epoch object
        :type epoch: :py:class:`Epoch`
        :param tofk5: Whether or not the small correction to convert to the FK5
            system will be applied or not
        :type tofk5: bool

        :returns: A tuple with the geocentric longitude and latitude (as
            :py:class:`Angle` objects), and the radius vector (as a float,
            in astronomical units), in that order
        :rtype: tuple
        :raises: TypeError if input values are of wrong type.

        >>> epoch = Epoch(1992, 10, 13.0)
        >>> l, b, r = Sun.geometric_geocentric_position(epoch, tofk5=False)
        >>> print(round(l.to_positive(), 6))
        199.907297
        >>> print(b.dms_str(n_dec=3))
        0.744''
        >>> print(round(r, 8))
        0.99760852
        """

        # NOTE: In page 169, Meeus gives a different value for the LONGITUDE
        # (199.907372 degrees) as the one presented above (199.907297 degrees).
        # After many checks and tests, I came to the conclusion that the result
        # above is the right one, and Meeus' result is wrong.
        # On the other hand, the difference in LATITUDE may be due to the fact
        # that this software uses the complete set of VSOP87C terms, instead of
        # the abridged version in Meeus' book.

        # First check that input values are of correct types
        if not isinstance(epoch, Epoch) and not isinstance(tofk5, bool):
            raise TypeError("Invalid input types")
        # Use Earth heliocentric position to compute Sun's geocentric position
        lon, lat, r = Earth.geometric_heliocentric_position(epoch, tofk5)
        lon = lon.to_positive() + 180.0
        lat = -lat
        return lon, lat, r