Beispiel #1
0
def GetAltitude(latitude_deg,
                longitude_deg,
                utc_datetime,
                elevation=0,
                temperature_celsius=25,
                pressure_millibars=1013.25):
    '''See also the faster, but less accurate, GetAltitudeFast()'''
    # location-dependent calculations
    projected_radial_distance = GetProjectedRadialDistance(
        elevation, latitude_deg)
    projected_axial_distance = GetProjectedAxialDistance(
        elevation, latitude_deg)

    # time-dependent calculations
    jd = julian.GetJulianDay(utc_datetime)
    jde = julian.GetJulianEphemerisDay(jd, 65)
    jce = julian.GetJulianEphemerisCentury(jde)
    jme = julian.GetJulianEphemerisMillenium(jce)
    geocentric_latitude = GetGeocentricLatitude(jme)
    geocentric_longitude = GetGeocentricLongitude(jme)
    radius_vector = GetRadiusVector(jme)
    aberration_correction = GetAberrationCorrection(radius_vector)
    equatorial_horizontal_parallax = GetEquatorialHorizontalParallax(
        radius_vector)
    nutation = GetNutation(jde)
    apparent_sidereal_time = GetApparentSiderealTime(jd, jme, nutation)
    true_ecliptic_obliquity = GetTrueEclipticObliquity(jme, nutation)

    # calculations dependent on location and time
    apparent_sun_longitude = GetApparentSunLongitude(geocentric_longitude,
                                                     nutation,
                                                     aberration_correction)
    geocentric_sun_right_ascension = GetGeocentricSunRightAscension(
        apparent_sun_longitude, true_ecliptic_obliquity, geocentric_latitude)
    geocentric_sun_declination = GetGeocentricSunDeclination(
        apparent_sun_longitude, true_ecliptic_obliquity, geocentric_latitude)
    local_hour_angle = GetLocalHourAngle(apparent_sidereal_time, longitude_deg,
                                         geocentric_sun_right_ascension)
    parallax_sun_right_ascension = GetParallaxSunRightAscension(
        projected_radial_distance, equatorial_horizontal_parallax,
        local_hour_angle, geocentric_sun_declination)
    topocentric_local_hour_angle = GetTopocentricLocalHourAngle(
        local_hour_angle, parallax_sun_right_ascension)
    topocentric_sun_declination = GetTopocentricSunDeclination(
        geocentric_sun_declination, projected_axial_distance,
        equatorial_horizontal_parallax, parallax_sun_right_ascension,
        local_hour_angle)
    topocentric_elevation_angle = GetTopocentricElevationAngle(
        latitude_deg, topocentric_sun_declination,
        topocentric_local_hour_angle)
    refraction_correction = GetRefractionCorrection(
        pressure_millibars, temperature_celsius, topocentric_elevation_angle)
    return topocentric_elevation_angle + refraction_correction
Beispiel #2
0
def GetAzimuth(latitude_deg, longitude_deg, utc_datetime, elevation=0):

    # location-dependent calculations
    projected_radial_distance = GetProjectedRadialDistance(
        elevation, latitude_deg)
    projected_axial_distance = GetProjectedAxialDistance(
        elevation, latitude_deg)

    # time-dependent calculations
    jd = julian.GetJulianDay(utc_datetime)
    jde = julian.GetJulianEphemerisDay(jd, 65)
    jce = julian.GetJulianEphemerisCentury(jde)
    jme = julian.GetJulianEphemerisMillenium(jce)
    geocentric_latitude = GetGeocentricLatitude(jme)
    geocentric_longitude = GetGeocentricLongitude(jme)
    radius_vector = GetRadiusVector(jme)
    aberration_correction = GetAberrationCorrection(radius_vector)
    equatorial_horizontal_parallax = GetEquatorialHorizontalParallax(
        radius_vector)
    nutation = GetNutation(jde)
    apparent_sidereal_time = GetApparentSiderealTime(jd, jme, nutation)
    true_ecliptic_obliquity = GetTrueEclipticObliquity(jme, nutation)

    # calculations dependent on location and time
    apparent_sun_longitude = GetApparentSunLongitude(geocentric_longitude,
                                                     nutation,
                                                     aberration_correction)
    geocentric_sun_right_ascension = GetGeocentricSunRightAscension(
        apparent_sun_longitude, true_ecliptic_obliquity, geocentric_latitude)
    geocentric_sun_declination = GetGeocentricSunDeclination(
        apparent_sun_longitude, true_ecliptic_obliquity, geocentric_latitude)
    local_hour_angle = GetLocalHourAngle(apparent_sidereal_time, longitude_deg,
                                         geocentric_sun_right_ascension)
    parallax_sun_right_ascension = GetParallaxSunRightAscension(
        projected_radial_distance, equatorial_horizontal_parallax,
        local_hour_angle, geocentric_sun_declination)
    topocentric_local_hour_angle = GetTopocentricLocalHourAngle(
        local_hour_angle, parallax_sun_right_ascension)
    topocentric_sun_declination = GetTopocentricSunDeclination(
        geocentric_sun_declination, projected_axial_distance,
        equatorial_horizontal_parallax, parallax_sun_right_ascension,
        local_hour_angle)
    return 180 - GetTopocentricAzimuthAngle(topocentric_local_hour_angle,
                                            latitude_deg,
                                            topocentric_sun_declination)
Beispiel #3
0
	def setUp(self):
		self.d = datetime.datetime(2003, 10, 17, 19, 30, 30)
		self.longitude = -105.1786
		self.latitude = 39.742476
		self.pressure = 820.0 # millibars
		self.elevation = 1830.14 # meters
		self.temperature = 11.0 # degrees Celsius
		self.slope = 30.0 # degrees
		self.slope_orientation = -10.0 # degrees east from south
		self.jd = julian.GetJulianDay(self.d)
		self.jc = julian.GetJulianCentury(self.jd)
		self.jde = julian.GetJulianEphemerisDay(self.jd, 67.0)
		self.jce = julian.GetJulianEphemerisCentury(self.jde)
		self.jme = julian.GetJulianEphemerisMillenium(self.jce)
		self.geocentric_longitude = solar.GetGeocentricLongitude(self.jme)
		self.geocentric_latitude = solar.GetGeocentricLatitude(self.jme)
		self.nutation = solar.GetNutation(self.jde)
		self.radius_vector = solar.GetRadiusVector(self.jme)
		self.true_ecliptic_obliquity = solar.GetTrueEclipticObliquity(self.jme, self.nutation)
		self.aberration_correction = solar.GetAberrationCorrection(self.radius_vector)
		self.apparent_sun_longitude = solar.GetApparentSunLongitude(self.geocentric_longitude, self.nutation, self.aberration_correction)
		self.apparent_sidereal_time = solar.GetApparentSiderealTime(self.jd, self.jme, self.nutation)
		self.geocentric_sun_right_ascension = solar.GetGeocentricSunRightAscension(self.apparent_sun_longitude, self.true_ecliptic_obliquity, self.geocentric_latitude)
		self.geocentric_sun_declination = solar.GetGeocentricSunDeclination(self.apparent_sun_longitude, self.true_ecliptic_obliquity, self.geocentric_latitude)
		self.local_hour_angle = solar.GetLocalHourAngle(318.5119, self.longitude, self.geocentric_sun_right_ascension) #self.apparent_sidereal_time only correct to 5 sig figs, so override
		self.equatorial_horizontal_parallax = solar.GetEquatorialHorizontalParallax(self.radius_vector)
		self.projected_radial_distance = solar.GetProjectedRadialDistance(self.elevation, self.latitude)
		self.projected_axial_distance = solar.GetProjectedAxialDistance(self.elevation, self.latitude)
		self.topocentric_sun_right_ascension = solar.GetTopocentricSunRightAscension(self.projected_radial_distance,
		    self.equatorial_horizontal_parallax, self.local_hour_angle, self.apparent_sun_longitude, self.true_ecliptic_obliquity, self.geocentric_latitude)
		self.parallax_sun_right_ascension = solar.GetParallaxSunRightAscension(self.projected_radial_distance, self.equatorial_horizontal_parallax, self.local_hour_angle, self.geocentric_sun_declination)
		self.topocentric_sun_declination = solar.GetTopocentricSunDeclination(self.geocentric_sun_declination, self.projected_axial_distance, self.equatorial_horizontal_parallax, self.parallax_sun_right_ascension, self.local_hour_angle)
		self.topocentric_local_hour_angle = solar.GetTopocentricLocalHourAngle(self.local_hour_angle, self.parallax_sun_right_ascension)
		self.topocentric_zenith_angle = solar.GetTopocentricZenithAngle(self.latitude, self.topocentric_sun_declination, self.topocentric_local_hour_angle, self.pressure, self.temperature)
		self.topocentric_azimuth_angle = solar.GetTopocentricAzimuthAngle(self.topocentric_local_hour_angle, self.latitude, self.topocentric_sun_declination)
		self.incidence_angle = solar.GetIncidenceAngle(self.topocentric_zenith_angle, self.slope, self.slope_orientation, self.topocentric_azimuth_angle)