How to use the jplephem.spk.S_PER_DAY 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 galactics / beyond / beyond / env / jpl.py View on Github external
].compute_and_differentiate(date.jd)
            sign = 1
        else:
            # When we wish to get a segment that is not available in the files (such as
            # EarthBarycenter with respect to the Moon, for example), we take the segment
            # representing the inverse vector if available and reverse it
            pos, vel = self.segments[
                target.index, center.index
            ].compute_and_differentiate(date.jd)
            sign = -1

        # In some cases, the pos vector contains both position and velocity
        if len(pos) == 3:
            # The velocity is given in km/days, so we convert to km/s
            # see: https://github.com/brandon-rhodes/python-jplephem/issues/19 for clarifications
            pv = np.concatenate((pos, vel / S_PER_DAY))
        elif len(pos) == 6:
            pv = np.array(pos)
        else:
            raise JplError("Unknown state vector format")

        return sign * pv * 1000