Exemple #1
0
def positions(dtime=None):

    """Prints information for all supported planets for a
    specified datetime.

    """

    if dtime is None:
        dtime = _get_current_utc_datetime()

    print("Current planetary data:\n")
    print("PLANET    R.ASCENSION   DECLINATION  DIST (AU)* ZODIAC ZODIAC SIGN")
    print("=======   ===========  ============= ========== ====== ===========")

    for planet in [Sun, Mercury, Venus, Mars, Jupiter,
                   Saturn, Uranus, Neptune, Pluto, Moon]:
        plnt = planet(dtime)
        print("{0:8}: {1}, {2}, {3:10.7f} {4} {5}".format(
                plnt.name().capitalize(),
                plnt.right_ascension(formatted=True),
                plnt.declination(formatted=True),
                plnt.distance(),
                plnt.right_ascension(zodiac=True),
                plnt.zodiac_sign()
        ))

    print("\n* Distance for the moon given in Earth radii.")
Exemple #2
0
    def __init__(self, dtime=None):

        """Initializer."""

        # Get current datetime if one not provided

        self._dtime = dtime
        if self._dtime is None:
            self._dtime = _get_current_utc_datetime()

        # Initialize _rhc for moon calculations

        self._rhc = 0

        # Get and store Keplerian elements

        self._oes = self._get_orbital_elements()