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
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())
def approximateLatitideConverter(self, approximateLatitide): if approximateLatitide > 0: tempAngle = Angle() tempAngle.setDegrees(approximateLatitide) result = "N" + tempAngle.getString() return result elif approximateLatitide == 0: return "0d00" else: approximateLatitide = approximateLatitide * (-1) tempAngle = Angle() tempAngle.setDegrees(approximateLatitide) result = "S" + tempAngle.getString() return result
def calculateAdjustedAltitude(self, sighting): horizon = sighting.get_horizon() altitude = sighting.get_observation() pressure = int(sighting.get_pressure()) temperature = float(sighting.get_temperature()) height = float(sighting.get_height()) arcAngle = Angle() arcAngle.setDegrees(altitude) if horizon == "natural": dip = (-0.97 * sqrt(height)) / 60 elif horizon == "artificial": dip = 0 celsiusTemperature = (temperature - 32) / 1.8 refraction = (-0.00452 * pressure) / (273 + celsiusTemperature) / tan( radians(altitude)) adjustedAltitude = altitude + dip + refraction resultAngle = Angle() resultAngle.setDegrees(adjustedAltitude) return resultAngle.getString()
def calculateDistanceAndAzimuthAdjustment(self, sighting): aziAngle = Angle() assumedLongitude = sighting.get_assumedlongitude() assumedLatitude = sighting.get_assumedLatitudeWithoutOrientation() geoPosLongitude = sighting.get_longitude() geoPosLatitude = sighting.get_latitude() adjustedAltitude = sighting.get_adjustedAltitude() LHA = self.getLHA(assumedLongitude, geoPosLongitude) corAltAndInterDis = self.getCorrectedAltitude(geoPosLatitude, assumedLatitude, LHA) correctedAltitude = corAltAndInterDis[0] intermediateDistance = corAltAndInterDis[1] distanceAdjustment = self.getDistanceAdjustment( adjustedAltitude, correctedAltitude) azimuthAdjustment = self.getAzimuthAdjustment(geoPosLatitude, assumedLatitude, correctedAltitude, intermediateDistance) aziAngle.setDegrees(azimuthAdjustment) return (str(distanceAdjustment), aziAngle.getString())