def setup_orbital_elements(acquisition, tle_path): """ Given an ephemeral object and a datetime object, calculate the satellite orbital paramaters used for calculating the angle grids. :param acquisition: An `Acquisition` object. :param tle_path: A `str` to the directory containing the Two Line Element data. :return: A floating point np array of 3 elements containing the satellite ephemeral bodies orbital paramaters. * Index 0 contains the obrital inclination in degrees. * Index 1 contains the semi major raidus in metres. * Index 2 contains the angular velocity in radians/sec^1. Also a np dataset of the following datatype: * dtype = [('orbital_inclination', 'float64'), ('semi_major_radius', 'float64'), ('angular_velocity', 'float64')] """ dtype = np.dtype([('orbital_inclination', 'float64'), ('semi_major_radius', 'float64'), ('angular_velocity', 'float64')]) dset = np.zeros(1, dtype=dtype) ephemeral = load_tle(acquisition, tle_path) # If we have None, then no suitable TLE was found, so use values gathered # by the acquisition object if ephemeral is None: # orbital inclination (degrees) dset['orbital_inclination'] = math.degrees(acquisition.inclination) # semi_major radius (m) dset['semi_major_radius'] = acquisition.semi_major_axis # angular velocity (rad sec-1) dset['angular_velocity'] = acquisition.omega else: ephemeral.compute(acquisition.acquisition_datetime) pi = np.pi n = ephemeral._n # number or orbits per day s = 24 * 60 * 60 # Seconds in a day mu = 398600441800000.0 # Earth Gravitational parameter m^3s^-2 # orbital inclination (degrees) dset['orbital_inclination'] = np.rad2deg(ephemeral._inc) # semi_major radius (m) # http://smallsats.org/2012/12/06/two-line-element-set-tle/ dset['semi_major_radius'] = (mu / (2 * pi * n / s)**2)**(1 / 3) # angular velocity (rad sec-1) dset['angular_velocity'] = (2 * pi * n) / s return np.array(dset.tolist()).squeeze(), dset
def test_load_tle_l8_mtl1(self): acq = acquisitions(LS8_SCENE1).get_acquisitions(group='RES-GROUP-1')[0] data = load_tle(acq, TLE_DIR) self.assertIsInstance(data, ephem.EarthSatellite)
def test_load_tle_l5_mtl1(self): acq = acquisitions(LS5_SCENE1).get_acquisitions()[0] data = load_tle(acq, TLE_DIR) self.assertIsInstance(data, ephem.EarthSatellite)