コード例 #1
0
    def calc_horizontal(self, date, longitude, latitude):
        h = GCMath.putIn360(
            GCEarthData.star_time(date) - self.rektaszension + longitude)

        self.azimuth = GCMath.rad2deg(
            math.atan2(
                GCMath.sinDeg(h),
                GCMath.cosDeg(h) * GCMath.sinDeg(latitude) -
                GCMath.tanDeg(self.declination) * GCMath.cosDeg(latitude)))

        self.elevation = GCMath.rad2deg(
            math.asin(
                GCMath.sinDeg(latitude) * GCMath.sinDeg(self.declination) +
                GCMath.cosDeg(latitude) * GCMath.cosDeg(self.declination) *
                GCMath.cosDeg(h)))
コード例 #2
0
def equatorialToHorizontalCoords(eqc, obs, date):
    hc = GCCoords.GCHorizontalCoords()

    h = GCMath.putIn360(
        star_time(date) - eqc.rightAscension + obs.longitude_deg)

    hc.azimut = GCMath.rad2deg(
        math.atan2(
            GCMath.sinDeg(h),
            GCMath.cosDeg(h) * GCMath.sinDeg(obs.latitude_deg) -
            GCMath.tanDeg(eqc.declination) * GCMath.cosDeg(obs.latitude_deg)))

    hc.elevation = GCMath.rad2deg(
        math.asin(
            GCMath.sinDeg(obs.latitude_deg) * GCMath.sinDeg(eqc.declination) +
            GCMath.cosDeg(obs.latitude_deg) * GCMath.cosDeg(eqc.declination) *
            GCMath.cosDeg(h)))

    return hc
コード例 #3
0
def eclipticalToEquatorialCoords(ecc, date):
    eqc = GCCoords.GCEquatorialCoords()
    epsilon = 0.0
    delta_phi = 0.0
    alpha = delta = 0.0

    delta_phi, epsilon = calc_epsilon_phi(date)

    ecc.longitude = GCMath.putIn360(ecc.longitude + delta_phi)

    eqc.rightAscension = GCMath.arcTan2Deg(
        GCMath.sinDeg(ecc.longitude) * GCMath.cosDeg(epsilon) -
        GCMath.tanDeg(ecc.latitude) * GCMath.sinDeg(epsilon),
        GCMath.cosDeg(ecc.longitude))

    eqc.declination = GCMath.arcSinDeg(
        GCMath.sinDeg(ecc.latitude) * GCMath.cosDeg(epsilon) +
        GCMath.cosDeg(ecc.latitude) * GCMath.sinDeg(epsilon) *
        GCMath.sinDeg(ecc.longitude))

    return eqc, ecc
コード例 #4
0
    def correct_position(self, jdate, latitude, longitude, height):
        b_a = 0.99664719

        u = GCMath.arcTanDeg(b_a * b_a * GCMath.tanDeg(latitude))
        rho_sin = b_a * GCMath.sinDeg(u) + height / 6378140.0 * GCMath.sinDeg(
            latitude)
        rho_cos = GCMath.cosDeg(
            u) + height / 6378140.0 * GCMath.cosDeg(latitude)

        self.parallax = GCMath.arcSinDeg(
            GCMath.sinDeg(8.794 / 3600) / (MoonDistance(jdate) / GCMath.AU))

        h = GCEarthData.star_time(jdate) - longitude - self.rektaszension
        delta_alpha = GCMath.arcTanDeg(
            (-rho_cos * GCMath.sinDeg(self.parallax) * GCMath.sinDeg(h)) /
            (GCMath.cosDeg(self.declination) -
             rho_cos * GCMath.sinDeg(self.parallax) * GCMath.cosDeg(h)))
        self.rektaszension = self.rektaszension + delta_alpha
        self.declination = GCMath.arcTanDeg(
            ((GCMath.sinDeg(self.declination) - rho_sin *
              GCMath.sinDeg(self.parallax)) * GCMath.cosDeg(delta_alpha)) /
            (GCMath.cosDeg(self.declination) -
             rho_cos * GCMath.sinDeg(self.parallax) * GCMath.cosDeg(h)))
コード例 #5
0
    def getTopocentricEquatorial(self, obs, jdate):
        b_a = 0.99664719
        tec = GCCoords.GCEquatorialCoords()

        altitude = 0

        #   geocentric position of observer on the earth surface
        #   10.1 - 10.3
        u = GCMath.arcTanDeg(b_a * b_a * GCMath.tanDeg(obs.latitude_deg))
        rho_sin = b_a * GCMath.sinDeg(
            u) + altitude / 6378140.0 * GCMath.sinDeg(obs.latitude_deg)
        rho_cos = GCMath.cosDeg(u) + altitude / 6378140.0 * GCMath.cosDeg(
            obs.latitude_deg)

        #   equatorial horizontal paralax
        #   39.1
        parallax = GCMath.arcSinDeg(
            GCMath.sinDeg(8.794 / 3600) / (self.radius / GCMath.AU))

        #   geocentric hour angle of the body
        h = GCEarthData.star_time(
            jdate) + obs.longitude_deg - self.rektaszension

        #   39.2
        delta_alpha = GCMath.arcTanDeg(
            (-rho_cos * GCMath.sinDeg(self.parallax) * GCMath.sinDeg(h)) /
            (GCMath.cosDeg(self.declination) -
             rho_cos * GCMath.sinDeg(self.parallax) * GCMath.cosDeg(h)))
        tec.rightAscension = self.rektaszension + delta_alpha
        tec.declination = GCMath.arcTanDeg(
            ((GCMath.sinDeg(self.declination) - rho_sin *
              GCMath.sinDeg(self.parallax)) * GCMath.cosDeg(delta_alpha)) /
            (GCMath.cosDeg(self.declination) -
             rho_cos * GCMath.sinDeg(self.parallax) * GCMath.cosDeg(h)))

        return tec
コード例 #6
0
    def CalculateEcliptical(self, jdate):
        arg_lr = [[0, 0, 1, 0], [2, 0, -1, 0], [2, 0, 0, 0], [0, 0, 2, 0],
                  [0, 1, 0, 0], [0, 0, 0, 2], [2, 0, -2, 0], [2, -1, -1, 0],
                  [2, 0, 1, 0], [2, -1, 0, 0], [0, 1, -1, 0], [1, 0, 0, 0],
                  [0, 1, 1, 0], [2, 0, 0, -2], [0, 0, 1, 2], [0, 0, 1, -2],
                  [4, 0, -1, 0], [0, 0, 3, 0], [4, 0, -2, 0], [2, 1, -1, 0],
                  [2, 1, 0, 0], [1, 0, -1, 0], [1, 1, 0, 0], [2, -1, 1, 0],
                  [2, 0, 2, 0], [4, 0, 0, 0], [2, 0, -3, 0], [0, 1, -2, 0],
                  [2, 0, -1, 2], [2, -1, -2, 0], [1, 0, 1, 0], [2, -2, 0, 0],
                  [0, 1, 2, 0], [0, 2, 0, 0], [2, -2, -1, 0], [2, 0, 1, -2],
                  [2, 0, 0, 2], [4, -1, -1, 0], [0, 0, 2, 2], [3, 0, -1, 0],
                  [2, 1, 1, 0], [4, -1, -2, 0], [0, 2, -1, 0], [2, 2, -1, 0],
                  [2, 1, -2, 0], [2, -1, 0, -2], [4, 0, 1, 0], [0, 0, 4, 0],
                  [4, -1, 0, 0], [1, 0, -2, 0], [2, 1, 0, -2], [0, 0, 2, -2],
                  [1, 1, 1, 0], [3, 0, -2, 0], [4, 0, -3, 0], [2, -1, 2, 0],
                  [0, 2, 1, 0], [1, 1, -1, 0], [2, 0, 3, 0], [2, 0, -1, -2]]

        arg_b = [[0, 0, 0, 1], [0, 0, 1, 1], [0, 0, 1, -1], [2, 0, 0, -1],
                 [2, 0, -1, 1], [2, 0, -1, -1], [2, 0, 0, 1], [0, 0, 2, 1],
                 [2, 0, 1, -1], [0, 0, 2, -1], [2, -1, 0, -1], [2, 0, -2, -1],
                 [2, 0, 1, 1], [2, 1, 0, -1], [2, -1, -1, 1], [2, -1, 0, 1],
                 [2, -1, -1, -1], [0, 1, -1, -1], [4, 0, -1, -1], [0, 1, 0, 1],
                 [0, 0, 0, 3], [0, 1, -1, 1], [1, 0, 0, 1], [0, 1, 1, 1],
                 [0, 1, 1, -1], [0, 1, 0, -1], [1, 0, 0, -1], [0, 0, 3, 1],
                 [4, 0, 0, -1], [4, 0, -1, 1], [0, 0, 1, -3], [4, 0, -2, 1],
                 [2, 0, 0, -3], [2, 0, 2, -1], [2, -1, 1, -1], [2, 0, -2, 1],
                 [0, 0, 3, -1], [2, 0, 2, 1], [2, 0, -3, -1], [2, 1, -1, 1],
                 [2, 1, 0, 1], [4, 0, 0, 1], [2, -1, 1, 1], [2, -2, 0, -1],
                 [0, 0, 1, 3], [2, 1, 1, -1], [1, 1, 0, -1], [1, 1, 0, 1],
                 [0, 1, -2, -1], [2, 1, -1, -1], [1, 0, 1, 1], [2, -1, -2, -1],
                 [0, 1, 2, 1], [4, 0, -2, -1], [4, -1, -1, -1], [1, 0, 1, -1],
                 [4, 0, 1, -1], [1, 0, -1, -1], [4, -1, 0, -1], [2, -2, 0, 1]]
        sigma_r = [
            -20905355, -3699111, -2955968, -569925, 48888, -3149, 246158,
            -152138, -170733, -204586, -129620, 108743, 104755, 10321, 0,
            79661, -34782, -23210, -21636, 24208, 30824, -8379, -16675, -12831,
            -10445, -11650, 14403, -7003, 0, 10056, 6322, -9884, 5751, 0,
            -4950, 4130, 0, -3958, 0, 3258, 2616, -1897, -2117, 2354, 0, 0,
            -1423, -1117, -1571, -1739, 0, -4421, 0, 0, 0, 0, 1165, 0, 0, 8752
        ]

        sigma_l = [
            6288774, 1274027, 658314, 213618, -185116, -114332, 58793, 57066,
            53322, 45758, -40923, -34720, -30383, 15327, -12528, 10980, 10675,
            10034, 8548, -7888, -6766, -5163, 4987, 4036, 3994, 3861, 3665,
            -2689, -2602, 2390, -2348, 2236, -2120, -2069, 2048, -1773, -1595,
            1215, -1110, -892, -810, 759, -713, -700, 691, 596, 549, 537, 520,
            -487, -399, -381, 351, -340, 330, 327, -323, 299, 294, 0
        ]

        sigma_b = [
            5128122, 280602, 277693, 173237, 55413, 46271, 32573, 17198, 9266,
            8822, 8216, 4324, 4200, -3359, 2463, 2211, 2065, -1870, 1828,
            -1794, -1749, -1565, -1491, -1475, -1410, -1344, -1335, 1107, 1021,
            833, 777, 671, 607, 596, 491, -451, 439, 422, 421, -366, -351, 331,
            315, 302, -283, -229, 223, 223, -220, -220, -185, 181, -177, 176,
            166, -164, 132, -119, 115, 107
        ]

        t = (jdate - 2451545.0) / 36525.0

        #  (* mean elongation of the moon
        d = 297.8502042 + (445267.1115168 +
                           (-0.0016300 +
                            (1.0 / 545868 - 1.0 / 113065000 * t) * t) * t) * t

        #  (* mean anomaly of the sun
        m = 357.5291092 + (35999.0502909 +
                           (-0.0001536 + 1.0 / 24490000 * t) * t) * t

        #  (* mean anomaly of the moon
        ms = 134.9634114 + (477198.8676313 +
                            (0.0089970 +
                             (1.0 / 69699 - 1.0 / 1471200 * t) * t) * t) * t

        #  (* argument of the longitude of the moon
        f = 93.2720993 + (483202.0175273 +
                          (-0.0034029 +
                           (-1.0 / 3526000 + 1.0 / 863310000 * t) * t) * t) * t

        #  (* correction term due to excentricity of the earth orbit
        e = 1.0 + (-0.002516 - 0.0000074 * t) * t

        #  (* mean longitude of the moon
        ls = 218.3164591 + (481267.88134236 +
                            (-0.0013268 +
                             (1.0 / 538841 - 1.0 / 65194000 * t) * t) * t) * t

        #  (* arguments of correction terms
        a1 = 119.75 + 131.849 * t
        a2 = 53.09 + 479264.290 * t
        a3 = 313.45 + 481266.484 * t

        sr = 0
        for i in range(60):
            temp = sigma_r[i] * GCMath.cosDeg(arg_lr[i][0] * d + arg_lr[i][1] *
                                              m + arg_lr[i][2] * ms +
                                              arg_lr[i][3] * f)
            if math.fabs(arg_lr[i][1]) == 1: temp = temp * e
            if math.fabs(arg_lr[i][1]) == 2: temp = temp * e * e
            sr = sr + temp

        sl = 0
        for i in range(60):
            temp = sigma_l[i] * GCMath.sinDeg(arg_lr[i][0] * d + arg_lr[i][1] *
                                              m + arg_lr[i][2] * ms +
                                              arg_lr[i][3] * f)
            if math.fabs(arg_lr[i][1]) == 1: temp = temp * e
            if math.fabs(arg_lr[i][1]) == 2: temp = temp * e * e
            sl = sl + temp

        #  (* correction terms
        sl =sl +3958*GCMath.sinDeg(a1) \
            +1962*GCMath.sinDeg(ls-f) \
            +318*GCMath.sinDeg(a2)
        sb = 0
        for i in range(60):
            temp = sigma_b[i] * GCMath.sinDeg(arg_b[i][0] * d + arg_b[i][1] *
                                              m + arg_b[i][2] * ms +
                                              arg_b[i][3] * f)
            if math.fabs(arg_b[i][1]) == 1: temp = temp * e
            if math.fabs(arg_b[i][1]) == 2: temp = temp * e * e
            sb = sb + temp

        #  (* correction terms
        sb = sb - 2235 * GCMath.sinDeg(ls) + 382 * GCMath.sinDeg(
            a3) + 175 * GCMath.sinDeg(a1 - f) + 175 * GCMath.sinDeg(
                a1 + f) + 127 * GCMath.sinDeg(ls - ms) - 115 * GCMath.sinDeg(
                    ls + ms)

        coords = GCCoords.GCEclipticalCoords()

        coords.longitude = ls + sl / 1000000
        coords.latitude = sb / 1000000
        coords.distance = 385000.56 + sr / 1000

        return coords
コード例 #7
0
def calc_epsilon_phi(date):
    arg_mul = [[0, 0, 0, 0, 1], [-2, 0, 0, 2, 2], [0, 0, 0, 2, 2],
               [0, 0, 0, 0, 2], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0],
               [-2, 1, 0, 2, 2], [0, 0, 0, 2, 1], [0, 0, 1, 2, 2],
               [-2, -1, 0, 2, 2], [-2, 0, 1, 0, 0], [-2, 0, 0, 2, 1],
               [0, 0, -1, 2, 2], [2, 0, 0, 0, 0], [0, 0, 1, 0, 1],
               [2, 0, -1, 2, 2], [0, 0, -1, 0, 1], [0, 0, 1, 2, 1],
               [-2, 0, 2, 0, 0], [0, 0, -2, 2, 1], [2, 0, 0, 2, 2],
               [0, 0, 2, 2, 2], [0, 0, 2, 0, 0], [-2, 0, 1, 2, 2],
               [0, 0, 0, 2, 0], [-2, 0, 0, 2, 0], [0, 0, -1, 2, 1],
               [0, 2, 0, 0, 0], [2, 0, -1, 0, 1], [-2, 2, 0, 2, 2],
               [0, 1, 0, 0, 1]]
    arg_phi = [[-171996, -1742], [-13187, -16], [-2274, -2], [2062, 2],
               [1426, -34], [712, 1], [-517, 12], [-386, -4], [-301, 0],
               [217, -5], [-158, 0], [129, 1], [123, 0], [63, 0], [63, 1],
               [-59, 0], [-58, -1], [-51, 0], [48, 0], [46, 0], [-38, 0],
               [-31, 0], [29, 0], [29, 0], [26, 0], [-22, 0], [21, 0],
               [17, -1], [16, 0], [-16, 1], [-15, 0]]
    arg_eps = [[92025, 89], [5736, -31], [977, -5], [-895, 5], [54, -1],
               [-7, 0], [224, -6], [200, 0], [129, -1], [-95, 3], [0, 0],
               [-70, 0], [-53, 0], [0, 0], [-33, 0], [26, 0], [32, 0], [27, 0],
               [0, 0], [-24, 0], [16, 0], [13, 0], [0, 0], [-12, 0], [0, 0],
               [0, 0], [-10, 0], [0, 0], [-8, 0], [7, 0], [9, 0]]

    t = (date - 2451545.0) / 36525
    delta_phi = 0.0

    # longitude of rising knot
    omega = GCMath.putIn360(125.04452 +
                            (-1934.136261 +
                             (0.0020708 + 1.0 / 450000 * t) * t) * t)

    if True:
        l = 280.4665 + 36000.7698 * t
        ls = 218.3165 + 481267.8813 * t

        delta_epsilon = 9.20 * GCMath.cosDeg(omega) + 0.57 * GCMath.cosDeg(
            2 * l) + 0.10 * GCMath.cosDeg(2 * ls) - 0.09 * GCMath.cosDeg(
                2 * omega)

        delta_phi = (-17.20 * GCMath.sinDeg(omega) -
                     1.32 * GCMath.sinDeg(2 * l) - 0.23 * GCMath.sinDeg(2 * ls)
                     + 0.21 * GCMath.sinDeg(2 * omega)) / 3600
    else:
        # mean elongation of moon to sun
        d = GCMath.putIn360(297.85036 + (445267.111480 +
                                         (-0.0019142 + t / 189474) * t) * t)

        # mean anomaly of the sun
        m = GCMath.putIn360(357.52772 + (35999.050340 +
                                         (-0.0001603 - t / 300000) * t) * t)

        # mean anomaly of the moon
        ms = GCMath.putIn360(134.96298 + (477198.867398 +
                                          (0.0086972 + t / 56250) * t) * t)

        # argument of the latitude of the moon
        f = GCMath.putIn360(93.27191 + (483202.017538 +
                                        (-0.0036825 + t / 327270) * t) * t)

        delta_phi = 0
        delta_epsilon = 0

        for i in range(31):
            s = arg_mul[i][0] * d + arg_mul[i][1] * m + arg_mul[i][
                2] * ms + arg_mul[i][3] * f + arg_mul[i][4] * omega
            delta_phi = delta_phi + (
                arg_phi[i][0] + arg_phi[i][1] * t * 0.1) * GCMath.sinDeg(s)
            delta_epsilon = delta_epsilon + (
                arg_eps[i][0] + arg_eps[i][1] * t * 0.1) * GCMath.cosDeg(s)

        delta_phi = delta_phi * 0.0001 / 3600
        delta_epsilon = delta_epsilon * 0.0001 / 3600

    # angle of ecliptic
    epsilon_0 = 84381.448 + (-46.8150 + (-0.00059 + 0.001813 * t) * t) * t

    epsilon = (epsilon_0 + delta_epsilon) / 3600

    return delta_phi, epsilon