コード例 #1
0
ファイル: Fix.py プロジェクト: qzw0014/wbd
 def calculateApproximateLatAndLon(self):
     assLonAngle = Angle()
     assLonAngle.setDegreesAndMinutes(
         self.sigthingsList[0].get_assumedlongitude())
     assumedLatitude = self.latitudeConverter(
         self.sigthingsList[0].get_assumedLatitudeWithoutOrientation())
     assumedLongitude = assLonAngle.getDegrees()
     sumOfLat = 0.0
     sumOfLon = 0.0
     for oneSighting in self.sigthingsList:
         azimuthAngle = Angle()
         distanceAdjustment = float(oneSighting.get_distanceAdjustment())
         azimuthAngle.setDegreesAndMinutes(
             oneSighting.get_azimuthAdjustment())
         sumOfLat = sumOfLat + distanceAdjustment * cos(
             radians(azimuthAngle.getDegrees()))
         sumOfLon = sumOfLon + distanceAdjustment * sin(
             radians(azimuthAngle.getDegrees()))
     approximateLatitude = assumedLatitude + sumOfLat / 60
     approximateLongitude = assumedLongitude + sumOfLon / 60
     approximateLatitude = self.approximateLatitideConverter(
         approximateLatitude)
     approLongAngle = Angle()
     approLongAngle.setDegrees(approximateLongitude)
     return (approximateLatitude, approLongAngle.getString())
コード例 #2
0
ファイル: Fix.py プロジェクト: qzw0014/wbd
 def getLHA(self, assumedLongitude, geoPosLongitude):
     assLonAngle = Angle()
     geoPosLonAngle = Angle()
     assLonAngle.setDegreesAndMinutes(assumedLongitude)
     geoPosLonAngle.setDegreesAndMinutes(geoPosLongitude)
     LHA = geoPosLonAngle.getDegrees() + assLonAngle.getDegrees()
     return LHA
コード例 #3
0
ファイル: Fix.py プロジェクト: qzw0014/wbd
 def getGHA(self, date, time):
     GHA1 = Angle()
     GHA2 = Angle()
     GHA = Angle()
     ariesDataSet = []
     timeSplitKey = re.compile(r':')
     timeSet = timeSplitKey.split(time)
     if timeSet[0] == "23":
         nextTime = "0"
         nextDate = self.dateCalculate(date, "1")
     else:
         nextTime = str(int(timeSet[0]) + 1)
         nextDate = date
     ariesDataSplitKey = re.compile(r'\t|\n')
     s = float(timeSet[1]) * 60 + float(timeSet[2])
     keyOne = date + "\t" + str(int(timeSet[0]))
     keyTwo = nextDate + "\t" + nextTime
     for oneLine in self.ariesFile:
         if oneLine.find(keyOne) == 0:
             ariesDataSet.append(ariesDataSplitKey.split(oneLine))
         if oneLine.find(keyTwo) == 0:
             ariesDataSet.append(ariesDataSplitKey.split(oneLine))
     if len(ariesDataSet) >= 2:
         try:
             GHA1.setDegreesAndMinutes(ariesDataSet[0][2])
             GHA2.setDegreesAndMinutes(ariesDataSet[1][2])
         except:
             return False
         calculation = abs(GHA2.getDegrees() - GHA1.getDegrees()) * (
             s / 3600) + GHA1.getDegrees()
         GHA.setDegrees(calculation)
         return GHA
     else:
         return False
コード例 #4
0
ファイル: Fix.py プロジェクト: qzw0014/wbd
 def starDataCheck(self, SHA, latitude):
     SHAAngle = Angle()
     latitudeAngle = Angle()
     try:
         SHAAngle.setDegreesAndMinutes(SHA)
         latitudeAngle.setDegreesAndMinutes(latitude)
     except:
         return False
     return True
コード例 #5
0
ファイル: Fix.py プロジェクト: qzw0014/wbd
 def getCorrectedAltitude(self, geoPosLatitude, assumedLatitude, LHA):
     geoPosLatAngle = Angle()
     assLatFloat = self.latitudeConverter(assumedLatitude)
     geoPosLatAngle.setDegreesAndMinutes(geoPosLatitude)
     intermediateDistance = (sin(radians(
         geoPosLatAngle.getDegrees())) * sin(radians(assLatFloat))) + (
             cos(radians(geoPosLatAngle.getDegrees())) *
             cos(radians(assLatFloat)) * cos(radians(LHA)))
     correctedAltitude = arcsin(intermediateDistance)
     correctedAltitude = degrees(correctedAltitude)
     return (correctedAltitude, intermediateDistance)
コード例 #6
0
ファイル: Fix.py プロジェクト: qzw0014/wbd
 def getAzimuthAdjustment(self, geoPosLatitude, assumedLatitude,
                          correctedAltitude, intermediateDistance):
     geoPosLatAngle = Angle()
     assLatFloat = self.latitudeConverter(assumedLatitude)
     geoPosLatAngle.setDegreesAndMinutes(geoPosLatitude)
     mem = (sin(radians(geoPosLatAngle.getDegrees())) -
            sin(radians(assLatFloat)) * intermediateDistance)
     deno = (cos(radians(assLatFloat)) * cos(radians(correctedAltitude)))
     tem = (mem / deno)
     azimuthAdjustment = arccos(tem)
     azimuthAdjustment = degrees(azimuthAdjustment)
     return azimuthAdjustment
コード例 #7
0
ファイル: Fix.py プロジェクト: qzw0014/wbd
 def getLongitudeAndLatitude(self, sighting):
     body = sighting.get_body()
     date = self.dateFormatSwitch(sighting.get_date())
     time = sighting.get_time()
     longtitude = Angle()
     SHA = Angle()
     GHA = self.getGHA(date, time)
     starDataSet = self.getLatitudeAndSHA(body, date)
     if starDataSet == False or GHA == False:
         return False
     else:
         SHA.setDegreesAndMinutes(starDataSet[2])
         latitude = starDataSet[3]
         longtitude.add(GHA)
         longtitude.add(SHA)
         return (latitude, longtitude.getString())
コード例 #8
0
ファイル: Fix.py プロジェクト: qzw0014/wbd
 def observationFormatCheck(self, observationValue):
     anAngle = Angle()
     minimumAngle = Angle()
     minimumAngle.setDegreesAndMinutes("0d0.1")
     try:
         anAngle.setDegreesAndMinutes(observationValue)
     except:
         return False
     if self.observationMinutesCheck(observationValue):
         if anAngle.getDegrees() >= minimumAngle.getDegrees(
         ) and anAngle.getDegrees() < 90:
             return True
         else:
             return False
     else:
         return False
コード例 #9
0
ファイル: Fix.py プロジェクト: qzw0014/wbd
 def assumedLongitudeCheck(self, assumedLongitude):
     anAngle = Angle()
     try:
         anAngle.setDegreesAndMinutes(assumedLongitude)
     except:
         return False
     pattern = re.compile(r'-?\d+\.?\d?')
     try:
         result = pattern.findall(assumedLongitude)
     except:
         return False
     if float(result[1]) >= 0 and float(result[1]) < 60:
         if float(result[0]) >= 0 and float(result[0]) < 360:
             return True
         else:
             return False
     else:
         return False
コード例 #10
0
ファイル: Fix.py プロジェクト: qzw0014/wbd
 def getDistanceAdjustment(self, adjustedAltitude, correctedAltitude):
     adjAltAngle = Angle()
     adjAltAngle.setDegreesAndMinutes(adjustedAltitude)
     distanceAdjustment = correctedAltitude - adjAltAngle.getDegrees()
     distanceAdjustment = int(round(distanceAdjustment * 60))
     return distanceAdjustment
コード例 #11
0
ファイル: Sighting.py プロジェクト: qzw0014/wbd
class Sighting(object):

    
    def __init__(self):
        self.body = ""
        self.date = ""
        self.time = ""
        self.observation = Angle()
        self.height = ""
        self.temperature = ""
        self.pressure = ""
        self.horizon = ""
        self.index = ""
        self.adjustedAltitude = Angle()
        self.longitude = Angle()
        self.lattitude = ""
        self.assumedLatitude = ""
        self.assumedLongitude = ""
        self.distanceAdjustment = ""
        self.azimuthAdjustment = ""


#    Getter
    def get_body(self):
        return self.body


    def get_date(self):
        return self.date


    def get_time(self):
        return self.time


    def get_observationString(self):
        return self.observation.getString()
    
    
    def get_observation(self):
        return self.observation.getDegrees()


    def get_height(self):
        return self.height


    def get_temperature(self):
        return self.temperature


    def get_pressure(self):
        return self.pressure


    def get_horizon(self):
        return self.horizon

    
    def get_index(self):
        return self.index


    def get_adjustedAltitude(self):
        return self.adjustedAltitude.getString()
    
    
    def get_longitude(self):
        return self.longitude.getString()
    
    
    def get_latitude(self):
        return self.lattitude
    
    
    def get_assumedLatitude(self):
        return self.assumedLatitude
    
    
    def get_assumedLatitudeWithoutOrientation(self):
        latSplitKey = re.compile(r'(\d+d\d+\.?\d?$)')
        resultList = latSplitKey.split(self.assumedLatitude)
        if resultList[0] == "N":
            return resultList[1]
        elif resultList[0] == "S":
            tem = "-" + resultList[1]
            return tem
        else:
            return resultList[1]
            
    
    
    def get_assumedlongitude(self):
        return self.assumedLongitude
    
    
    def get_distanceAdjustment(self):
        return self.distanceAdjustment
    
    
    def get_azimuthAdjustment(self):
        return self.azimuthAdjustment
    
    
#    Setter
    def set_body(self, value):
        self.body = value


    def set_date(self, value):
        self.date = value


    def set_time(self, value):
        self.time = value


    def set_observation(self, value):
        self.observation.setDegreesAndMinutes(value)


    def set_height(self, value = "0"):
        if value == None:
            value = "0"
        self.height = value


    def set_temperature(self, value = "72"):
        if value == None:
            value = "72"
        self.temperature = value


    def set_pressure(self, value = "1010"):
        if value == None:
            value = "1010"
        self.pressure = value


    def set_horizon(self, value = "natural"):
        if value == None:
            value = "natural"
        self.horizon = value.lower()
       
        
    def set_index(self):
        self.index = self.date + self.time
    
    
    def set_adjustedAltitude(self, value):
        self.adjustedAltitude.setDegreesAndMinutes(value)
        
    
    def set_longitude(self, value):
        self.longitude.setDegreesAndMinutes(value)
        
        
    def set_latitude(self, value):
        self.lattitude = value
        
    
    def set_assumedLatitude(self,value):
        self.assumedLatitude = value
    
    
    def set_assumedLongitude(self, value):
        self.assumedLongitude = value
    
    
    def set_distanceAdjustment(self, value):
        self.distanceAdjustment = value
        
    
    def set_azimuthAdjustment(self, value):
        self.azimuthAdjustment = value
コード例 #12
0
myAngle1 = Angle()
myAngle2 = Angle()
myAngle3 = Angle()
'''
inputValue1 = [125, 125.5, 780, -100, -130.5, -960, "k"]

for value in inputValue1:
    try:
        myAngle1.setDegrees(value)
        print(myAngle1.getDegrees())
        print(myAngle1.getString())
    except ValueError as e:
        print(e)
    

'''
'''
inputValue2 = ["35d18", "380d62", "-180d30", "-960d30", "kki", "360", "0.1d0"]

for stringValue in inputValue2:
    try:
        myAngle2.setDegreesAndMinutes(stringValue)
        print(myAngle2.getString())
        print(myAngle2.getDegrees())
    except ValueError as e:
        print(e)
'''

myAngle1.setDegreesAndMinutes("-46d10")
myAngle2.setDegreesAndMinutes("46d10")
print myAngle1.compare(myAngle2)