Esempio n. 1
0
class OrbitDataFetcher(object):

    def __init__(self, object_catalogue):
        super(OrbitDataFetcher, self).__init__()
        self._object_catalogue = object_catalogue
        self._horizons_client = HorizonsClient()
        self._horizons_client.connect()
        self._tasc_client = TASCClient()

    def __del__(self):
        self._horizons_client.disconnect()

    def fetch(self, objects):
        vecs = []
        for obj in list(objects):
            if(obj.data_source is SpaceObject.DATASOURCE_HORIZONS):
                vecs = self._fetch_from_horizons(obj)
            elif(obj.data_source is SpaceObject.DATASOURCE_TASC):
                vecs = self._fetch_from_tasc(obj)
            else:
                print("Unsupported data source for " + obj.name)
            if(len(vecs) < 1):
                print("No data found! Skipping.")
                continue
            self._object_catalogue.add(obj, vecs[-1])

    def _fetch_from_horizons(self, space_object):
        return self._horizons_client.get_state_vectors_for_object(space_object)

    def _fetch_from_tasc(self, space_object):
        return self._tasc_client.get_state_vectors_for_object(space_object)
Esempio n. 2
0
class OrbitDataFetcher(object):
    def __init__(self, object_catalog):
        super(OrbitDataFetcher, self).__init__()
        self._object_catalog = object_catalog
        self._horizons_client = HorizonsClient()
        self._horizons_client.connect()
        self._tasc_client = TASCClient()

    def __del__(self):
        self._horizons_client.disconnect()

    def fetch(self, objects):
        vecs = []
        for obj in list(objects):
            if (obj.data_source is SpaceObject.DATASOURCE_HORIZONS):
                vecs = self._fetch_from_horizons(obj)
            elif (obj.data_source is SpaceObject.DATASOURCE_TASC):
                vecs = self._fetch_from_tasc(obj)
            else:
                print("Unsupported data source for " + obj.name)
            if (len(vecs) < 1):
                print("No data found! Skipping.")
                continue
            self._object_catalog.add(obj, vecs[-1])

    def _fetch_from_horizons(self, space_object):
        return self._horizons_client.get_state_vectors_for_object(space_object)

    def _fetch_from_tasc(self, space_object):
        return self._tasc_client.get_state_vectors_for_object(space_object)
Esempio n. 3
0
 def __init__(self, object_catalogue):
     super(OrbitDataFetcher, self).__init__()
     self._object_catalogue = object_catalogue
     self._horizons_client = HorizonsClient()
     self._horizons_client.connect()
     self._tasc_client = TASCClient()
Esempio n. 4
0
 def __init__(self, object_catalog):
     super(OrbitDataFetcher, self).__init__()
     self._object_catalog = object_catalog
     self._horizons_client = HorizonsClient()
     self._horizons_client.connect()
     self._tasc_client = TASCClient()