示例#1
0
文件: sun.py 项目: JordanBallew/sunpy
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
示例#2
0
文件: sun.py 项目: JordanBallew/sunpy
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
示例#3
0
文件: sun.py 项目: astrofrog/sunpy
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
示例#4
0
文件: sun.py 项目: astrofrog/sunpy
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
示例#5
0
文件: sun.py 项目: JordanBallew/sunpy
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
示例#6
0
文件: sun.py 项目: astrofrog/sunpy
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
示例#7
0
文件: sun.py 项目: JordanBallew/sunpy
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
示例#8
0
文件: sun.py 项目: astrofrog/sunpy
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
示例#9
0
文件: sun.py 项目: JordanBallew/sunpy
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]
示例#10
0
文件: sun.py 项目: astrofrog/sunpy
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]
示例#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
示例#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
示例#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
示例#14
0
文件: sun.py 项目: astrofrog/sunpy
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
示例#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
示例#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
示例#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
示例#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
示例#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
示例#20
0
文件: sun.py 项目: astrofrog/sunpy
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
示例#21
0
文件: sun.py 项目: JordanBallew/sunpy
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
示例#22
0
文件: sun.py 项目: JordanBallew/sunpy
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
示例#23
0
文件: sun.py 项目: JordanBallew/sunpy
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
示例#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
示例#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
示例#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
示例#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
示例#28
0
文件: sun.py 项目: astrofrog/sunpy
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
示例#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
示例#30
0
文件: sun.py 项目: JordanBallew/sunpy
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
示例#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
示例#32
0
文件: sun.py 项目: astrofrog/sunpy
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
示例#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
示例#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