示例#1
0
 def _parseCoordTime(self, coordn):
     coordTime = TimeAltAz()
     for xml_node in coordn:
         if xml_node.tag == "time":
             coordTime.tm = utils.parseIsoDateTime(xml_node.text)
         elif xml_node.tag == "alt":
             coordTime.alt = xml_node.text
         elif xml_node.tag == "az":
             coordTime.az = xml_node.text
     return coordTime
示例#2
0
    def parseFromXml(self, xml_passes):

        rootn = etree.fromstring(xml_passes)

        if rootn is None:
            return 'Empty response.'

        self._observer = ephem.Observer()

        for xml_node in rootn:
            if xml_node.tag == 'location':
                self._observer.lat, self._observer.long = utils.xmlNodeValue(xml_node, 'lat'), utils.xmlNodeValue(xml_node, 'lng')
            elif xml_node.tag == 'altitude':
                self._observer.elevation = int(float(xml_node.text))
            elif xml_node.tag == 'from':
                self._from = utils.parseIsoDateTime(xml_node.text)
            elif xml_node.tag == 'to':
                self._to = utils.parseIsoDateTime(xml_node.text)
            elif xml_node.tag == 'flare':
                self._flares += (self._parseOneFlare(xml_node),)
示例#3
0
 def _parseOneFlare(self, passn):
     flare = IridiumFlare()
     for xml_node in passn:
         if xml_node.tag == 'magnitude':
             flare.mag = xml_node.text
         elif xml_node.tag == 'time':
             flare.tm = utils.parseIsoDateTime(xml_node.text)
         elif xml_node.tag == 'alt':
             flare.alt = xml_node.text
         elif xml_node.tag == 'az':
             flare.az = xml_node.text
     return flare
示例#4
0
    def parseFromXml(self, xml_passes):

        rootn = etree.fromstring(xml_passes)

        if rootn is None:
            return "Empty response."

        self._observer = ephem.Observer()

        for xml_node in rootn:
            if xml_node.tag == "location":
                self._observer.lat, self._observer.long = (
                    utils.xmlNodeValue(xml_node, "lat"),
                    utils.xmlNodeValue(xml_node, "lng"),
                )
            elif xml_node.tag == "altitude":
                self._observer.elevation = int(float(xml_node.text))
            elif xml_node.tag == "from":
                self._from = utils.parseIsoDateTime(xml_node.text)
            elif xml_node.tag == "to":
                self._to = utils.parseIsoDateTime(xml_node.text)
            elif xml_node.tag == "pass":
                self._passInfos += (self._parseOnePass(xml_node),)