Beispiel #1
0
    def _get_satpos_cart(self):
        """Determine satellite position in earth-centered cartesion coordinates.

        The coordinates as a function of time are encoded in the coefficients of an 8th-order Chebyshev polynomial.
        In the prologue there is one set of coefficients for each coordinate (x, y, z). The coordinates are obtained by
        evalutaing the polynomials at the start time of the scan.

        Returns: x, y, z [m]
        """
        orbit_polynomial = self.prologue['SatelliteStatus']['Orbit']['OrbitPolynomial']

        # Find Chebyshev coefficients for the start time of the scan
        coef_idx = self._find_orbit_coefs()
        tstart = orbit_polynomial['StartTime'][0, coef_idx]
        tend = orbit_polynomial['EndTime'][0, coef_idx]

        # Obtain cartesian coordinates (x, y, z) of the satellite by evaluating the Chebyshev polynomial at the
        # start time of the scan. Express timestamps in microseconds since 1970-01-01 00:00.
        time = self.prologue['ImageAcquisition']['PlannedAcquisitionTime']['TrueRepeatCycleStart']
        time64 = np.datetime64(time).astype('int64')
        domain = [np.datetime64(tstart).astype('int64'),
                  np.datetime64(tend).astype('int64')]
        x = chebyshev(coefs=orbit_polynomial['X'][coef_idx], time=time64, domain=domain)
        y = chebyshev(coefs=orbit_polynomial['Y'][coef_idx], time=time64, domain=domain)
        z = chebyshev(coefs=orbit_polynomial['Z'][coef_idx], time=time64, domain=domain)

        return x*1000, y*1000, z*1000  # km -> m
 def test_chebyshev(self):
     coefs = [1, 2, 3, 4]
     time = 123
     domain = [120, 130]
     res = chebyshev(coefs=[1, 2, 3, 4], time=time, domain=domain)
     exp = chebyshev4(coefs, time, domain)
     self.assertTrue(np.allclose(res, exp))
 def test_chebyshev(self):
     """Test the chebyshev function."""
     coefs = [1, 2, 3, 4]
     time = 123
     domain = [120, 130]
     res = chebyshev(coefs=[1, 2, 3, 4], time=time, domain=domain)
     exp = chebyshev4(coefs, time, domain)
     np.testing.assert_allclose(res, exp)