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 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 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())
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())
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