How to use the jplephem.Ephemeris function in jplephem

To help you get started, we’ve selected a few jplephem examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github brandon-rhodes / pyephem / ephem / planets.py View on Github external
def __init__(self, module=None):

        if module is None:
            try:
                import de421
            except ImportError:
                raise ValueError(
                    'if you want to instantiate Ephemeris() without '
                    'providing an argument, then you must install the '
                    'default ephemeris DE421 with the command: '
                    '"pip install de421"')
            else:
                module = de421

        self.jplephemeris = e = jplephem.Ephemeris(module)
        self.moon_share = 1.0 / (1.0 + e.EMRAT)
        self.earth_share = e.EMRAT / (1.0 + e.EMRAT)

        self.sun = Planet(self, self.jplephemeris, 'sun')
        self.mercury = Planet(self, self.jplephemeris, 'mercury')
        self.venus = Planet(self, self.jplephemeris, 'venus')
        self.mars = Planet(self, self.jplephemeris, 'mars')
        self.jupiter = Planet(self, self.jplephemeris, 'jupiter')
        self.saturn = Planet(self, self.jplephemeris, 'saturn')
        self.uranus = Planet(self, self.jplephemeris, 'uranus')
        self.neptune = Planet(self, self.jplephemeris, 'neptune')
        self.pluto = Planet(self, self.jplephemeris, 'pluto')