Example #1
0
def mean_anomaly(t=None):
    """Returns the mean anomaly (the angle through which the Sun has moved
    assuming a circular orbit) as a function of time."""
    T = julian.julian_centuries(t)
    result = 358.475830 + 35999.049750 * T - 0.0001500 * T ** 2 - 0.00000330 * T ** 3
    result = result % 360.0
    return result
Example #2
0
def apparent_longitude(t=None):
    """Returns the apparent longitude of the Sun."""
    T = julian.julian_centuries(t)
    omega = 259.18 - 1934.142*T
    true_long = true_longitude(t)        
    result = true_long - 0.00569 - 0.00479*math.sin(np.radians(omega))
    return result
Example #3
0
def mean_anomaly(t=None):
    """Returns the mean anomaly (the angle through which the Sun has moved
    assuming a circular orbit) as a function of time."""
    T = julian.julian_centuries(t)
    result = 358.475830 + 35999.049750 * T - 0.0001500 * T**2 - 0.00000330 * T**3
    result = result % 360.0
    return result
Example #4
0
def apparent_longitude(t=None):
    """Returns the apparent longitude of the Sun."""
    T = julian.julian_centuries(t)
    omega = 259.18 - 1934.142 * T
    true_long = true_longitude(t)
    result = true_long - 0.00569 - 0.00479 * math.sin(np.radians(omega))
    return result
Example #5
0
def equation_of_center(t=None):
    """Returns the Sun's equation of center (in degrees)"""
    T = julian.julian_centuries(t)
    mna = mean_anomaly(t) 
    result = ((1.9194600 - 0.0047890 * T - 0.0000140 * T
    ** 2) * np.sin(np.radians(mna) + (0.0200940 - 0.0001000 * T) *
    np.sin(np.radians(2 * mna)) + 0.0002930 * np.sin(np.radians(3 * mna))))
    return result
Example #6
0
def equation_of_center(t=None):
    """Returns the Sun's equation of center (in degrees)"""
    T = julian.julian_centuries(t)
    mna = mean_anomaly(t)
    result = ((1.9194600 - 0.0047890 * T - 0.0000140 * T**2) * np.sin(
        np.radians(mna) +
        (0.0200940 - 0.0001000 * T) * np.sin(np.radians(2 * mna)) +
        0.0002930 * np.sin(np.radians(3 * mna))))
    return result
Example #7
0
def solar_north(t=None):
    """Returns the position of the Solar north pole in degrees."""
    T = julian.julian_centuries(t)
    ob1 = true_obliquity_of_ecliptic(t)
    # in degrees
    i = 7.25
    k = 74.3646 + 1.395833 * T
    lamda = true_longitude(t) - 0.00569
    omega = apparent_longitude(t)
    lamda2 = lamda - 0.00479 * math.sin(np.radians(omega))
    diff = np.radians(lamda - k)
    x = np.degrees(math.atan(-math.cos(np.radians(lamda2)*math.tan(np.radians(ob1)))))
    y = np.degrees(math.atan(-math.cos(diff)*math.tan(np.radians(i))))
    result = x + y
    return result
Example #8
0
def solar_north(t=None):
    """Returns the position of the Solar north pole in degrees."""
    T = julian.julian_centuries(t)
    ob1 = true_obliquity_of_ecliptic(t)
    # in degrees
    i = 7.25
    k = 74.3646 + 1.395833 * T
    lamda = true_longitude(t) - 0.00569
    omega = apparent_longitude(t)
    lamda2 = lamda - 0.00479 * math.sin(np.radians(omega))
    diff = np.radians(lamda - k)
    x = np.degrees(
        math.atan(-math.cos(np.radians(lamda2) * math.tan(np.radians(ob1)))))
    y = np.degrees(math.atan(-math.cos(diff) * math.tan(np.radians(i))))
    result = x + y
    return result
Example #9
0
def heliographic_solar_center(t=None):
    """Returns the position of the solar center in heliographic coordinates."""
    jd = julian.julian_day(t)
    T = julian.julian_centuries(t)
    # Heliographic coordinates in degrees
    theta = (jd - 2398220)*360/25.38
    i = 7.25
    k = 74.3646 + 1.395833 * T
    lamda = true_longitude(t) - 0.00569
    #omega = apparent_longitude(t)
    #lamda2 = lamda - 0.00479 * math.sin(np.radians(omega))
    diff = np.radians(lamda - k)
    # Latitude at center of disk (deg):    
    he_lat = np.degrees(math.asin(math.sin(diff)*math.sin(np.radians(i))))
    # Longitude at center of disk (deg):
    y = -math.sin(diff)*math.cos(np.radians(i))
    x = -math.cos(diff)
    rpol = cmath.polar(complex(x,y))
    he_lon = np.degrees(rpol[1]) - theta
    he_lon = he_lon % 360
    if he_lon < 0:
        he_lon = he_lon + 360.0

    return [he_lon, he_lat]
Example #10
0
def heliographic_solar_center(t=None):
    """Returns the position of the solar center in heliographic coordinates."""
    jd = julian.julian_day(t)
    T = julian.julian_centuries(t)
    # Heliographic coordinates in degrees
    theta = (jd - 2398220) * 360 / 25.38
    i = 7.25
    k = 74.3646 + 1.395833 * T
    lamda = true_longitude(t) - 0.00569
    #omega = apparent_longitude(t)
    #lamda2 = lamda - 0.00479 * math.sin(np.radians(omega))
    diff = np.radians(lamda - k)
    # Latitude at center of disk (deg):
    he_lat = np.degrees(math.asin(math.sin(diff) * math.sin(np.radians(i))))
    # Longitude at center of disk (deg):
    y = -math.sin(diff) * math.cos(np.radians(i))
    x = -math.cos(diff)
    rpol = cmath.polar(complex(x, y))
    he_lon = np.degrees(rpol[1]) - theta
    he_lon = he_lon % 360
    if he_lon < 0:
        he_lon = he_lon + 360.0

    return [he_lon, he_lat]
Example #11
0
def test_julian_centuries2():
    """should return julian century for date 2"""
    
    expected_century = 0.8489280759626815
    assert julian.julian_centuries(DATETIME_DATE_2) == expected_century
    assert julian.julian_centuries(STRING_DATE_2) == expected_century
Example #12
0
def test_julian_centuries1():
    """should return julian century for date 1"""
    
    expected_century = 0.0
    assert julian.julian_centuries(DATETIME_DATE_1) == expected_century
    assert julian.julian_centuries(STRING_DATE_1) == expected_century
Example #13
0
def test_julian_centuries1():
    """should return julian century for date 1"""

    expected_century = 0.0
    assert julian.julian_centuries(DATETIME_DATE_1) == expected_century
    assert julian.julian_centuries(STRING_DATE_1) == expected_century
Example #14
0
def mean_ecliptic_longitude(t=None):
    """Returns the mean ecliptic longitude."""
    T = julian.julian_centuries(t)
    result = 279.696680 + 36000.76892 * T + 0.0003025 * T**2
    result = result % 360.0
    return result
Example #15
0
def test_julian_centuries3():
    """should return julian century for date 3"""

    expected_century = 2.741100882196367
    assert julian.julian_centuries(DATETIME_DATE_3) == expected_century
    assert julian.julian_centuries(STRING_DATE_3) == expected_century
Example #16
0
def test_julian_centuries1():
    """should return julian century for date 1"""

    expected_century = 2.7378507871321012e-05
    assert julian.julian_centuries(DATETIME_DATE_1) == expected_century
    assert julian.julian_centuries(STRING_DATE_1) == expected_century
Example #17
0
def test_julian_centuries2():
    """should return julian century for date 2"""

    expected_century = 0.8489554544705528
    assert julian.julian_centuries(DATETIME_DATE_2) == expected_century
    assert julian.julian_centuries(STRING_DATE_2) == expected_century
Example #18
0
def test_julian_centuries4():
    """should return julian century for date 4"""

    expected_century = -10.85898699552564
    assert julian.julian_centuries(DATETIME_DATE_4) == expected_century
    assert julian.julian_centuries(STRING_DATE_4) == expected_century
Example #19
0
def test_julian_centuries2():
    """should return julian century for date 2"""

    expected_century = 0.8489280759626815
    assert julian.julian_centuries(DATETIME_DATE_2) == expected_century
    assert julian.julian_centuries(STRING_DATE_2) == expected_century
Example #20
0
def geometric_mean_longitude(t=None):
    """Returns the geometric mean longitude (in degrees)"""
    T = julian.julian_centuries(t)
    result = 279.696680 + 36000.76892 * T + 0.0003025 * T**2
    result = result % 360.0
    return result
Example #21
0
def geometric_mean_longitude(t=None):
    """Returns the geometric mean longitude (in degrees)"""   
    T = julian.julian_centuries(t)
    result = 279.696680 + 36000.76892 * T + 0.0003025 * T ** 2
    result = result % 360.0
    return result
Example #22
0
def mean_ecliptic_longitude(t=None):
    """Returns the mean ecliptic longitude."""
    T = julian.julian_centuries(t)
    result = 279.696680 + 36000.76892 * T + 0.0003025 * T ** 2
    result = result % 360.0
    return result
Example #23
0
def eccentricity_SunEarth_orbit(t=None):
    """Returns the eccentricity of the Sun Earth Orbit."""
    T = julian.julian_centuries(t)
    result = 0.016751040 - 0.00004180 * T - 0.0000001260 * T ** 2
    return result
Example #24
0
def test_julian_centuries3():
    """should return julian century for date 3"""
    
    expected_century = 2.7410735036884954
    assert julian.julian_centuries(DATETIME_DATE_3) == expected_century
    assert julian.julian_centuries(STRING_DATE_3) == expected_century
Example #25
0
def test_julian_centuries4():
    """should return julian century for date 4"""
    
    expected_century = -10.859014374033512
    assert julian.julian_centuries(DATETIME_DATE_4) == expected_century
    assert julian.julian_centuries(STRING_DATE_4) == expected_century
Example #26
0
def test_julian_centuries4():
    """should return julian century for date 4"""

    expected_century = -10.859014374033512
    assert julian.julian_centuries(DATETIME_DATE_4) == expected_century
    assert julian.julian_centuries(STRING_DATE_4) == expected_century
Example #27
0
def test_julian_centuries2():
    """should return julian century for date 2"""

    expected_century = 0.8489554544705528
    assert julian.julian_centuries(DATETIME_DATE_2) == expected_century
    assert julian.julian_centuries(STRING_DATE_2) == expected_century
Example #28
0
def eccentricity_SunEarth_orbit(t=None):
    """Returns the eccentricity of the Sun Earth Orbit."""
    T = julian.julian_centuries(t)
    result = 0.016751040 - 0.00004180 * T - 0.0000001260 * T**2
    return result
Example #29
0
def test_julian_centuries4():
    """should return julian century for date 4"""

    expected_century = -10.85898699552564
    assert julian.julian_centuries(DATETIME_DATE_4) == expected_century
    assert julian.julian_centuries(STRING_DATE_4) == expected_century
Example #30
0
def true_obliquity_of_ecliptic(t=None):
    T = julian.julian_centuries(t)
    result = 23.452294 - 0.0130125 * T - 0.00000164 * T ** 2 + 0.000000503 * T ** 3
    return result
Example #31
0
def test_julian_centuries1():
    """should return julian century for date 1"""

    expected_century = 2.7378507871321012e-05
    assert julian.julian_centuries(DATETIME_DATE_1) == expected_century
    assert julian.julian_centuries(STRING_DATE_1) == expected_century
Example #32
0
def true_obliquity_of_ecliptic(t=None):
    T = julian.julian_centuries(t)
    result = 23.452294 - 0.0130125 * T - 0.00000164 * T**2 + 0.000000503 * T**3
    return result
Example #33
0
def test_julian_centuries3():
    """should return julian century for date 3"""

    expected_century = 2.741100882196367
    assert julian.julian_centuries(DATETIME_DATE_3) == expected_century
    assert julian.julian_centuries(STRING_DATE_3) == expected_century
Example #34
0
def test_julian_centuries3():
    """should return julian century for date 3"""

    expected_century = 2.7410735036884954
    assert julian.julian_centuries(DATETIME_DATE_3) == expected_century
    assert julian.julian_centuries(STRING_DATE_3) == expected_century