# Path: skyfield/constants.py
# AU_M = 149597870700             # per IAU 2012 Resolution B2
# AU_KM = 149597870.700
# ASEC360 = 1296000.0
# DAY_S = 86400.0
# ASEC2RAD = 4.848136811095359935899141e-6
# DEG2RAD = 0.017453292519943296
# RAD2DEG = 57.295779513082321
# C = 299792458.0                            # m/s
# ANGVEL = 7.2921150e-5           # radians/s
# ERAD = 6378136.6                # meters
# IERS_2010_INVERSE_EARTH_FLATTENING = 298.25642
# GS = 1.32712440017987e+20
# T0 = 2451545.0
# B1950 = 2433282.4235
# C_AUDAY = C * DAY_S / AU_M
# 
# Path: skyfield/nutationlib.py
# def iau2000b_radians(t):
#     """Return the IAU 2000B angles delta-psi and delta-epsilon in radians."""
#     d_psi, d_eps = iau2000b(t.tt)
#     d_psi *= _TENTH_USEC_2_RAD
#     d_eps *= _TENTH_USEC_2_RAD
#     return d_psi, d_eps


from skyfield.constants import tau
from skyfield.nutationlib import iau2000b_radians
    'Đại hàn',
    'Lập xuân',
    'Vũ thủy',
    'Kinh trập',
]

def solar_terms(ephemeris):
    """Build a function of time that returns the solar terms of the year.

    The function that this returns will expect a single argument that is
    a :class:`~skyfield.timelib.Time` and will return 0 through 23 for
    the solar terms.

    The name of the solar terms may vary in different cultures, so we
    have table of names in Simplified Chinese, Traditional Chinese,
    Japanese and Vietnamese

    Reference:

    https://en.wikipedia.org/wiki/Solar_term

    """
    earth = ephemeris['earth']
    sun = ephemeris['sun']

    def solar_term_at(t):
        """Return season 0 through 23 at time `t`."""
        t._nutation_angles_radians = iau2000b_radians(t)
        e = earth.at(t)
        _, slon, _ = e.observe(sun).apparent().ecliptic_latlon('date')

# Path: skyfield/constants.py
# AU_M = 149597870700             # per IAU 2012 Resolution B2
# AU_KM = 149597870.700
# ASEC360 = 1296000.0
# DAY_S = 86400.0
# ASEC2RAD = 4.848136811095359935899141e-6
# DEG2RAD = 0.017453292519943296
# RAD2DEG = 57.295779513082321
# C = 299792458.0                            # m/s
# ANGVEL = 7.2921150e-5           # radians/s
# ERAD = 6378136.6                # meters
# IERS_2010_INVERSE_EARTH_FLATTENING = 298.25642
# GS = 1.32712440017987e+20
# T0 = 2451545.0
# B1950 = 2433282.4235
# C_AUDAY = C * DAY_S / AU_M
# 
# Path: skyfield/nutationlib.py
# def iau2000b_radians(t):
#     """Return the IAU 2000B angles delta-psi and delta-epsilon in radians."""
#     d_psi, d_eps = iau2000b(t.tt)
#     d_psi *= _TENTH_USEC_2_RAD
#     d_eps *= _TENTH_USEC_2_RAD
#     return d_psi, d_eps


# Path: skyfield/almanac_east_asia.py
from skyfield.constants import tau
from skyfield.nutationlib import iau2000b_radians

    'Đại hàn',
    'Lập xuân',
    'Vũ thủy',
    'Kinh trập',
]

def solar_terms(ephemeris):
    """Build a function of time that returns the solar terms of the year.

    The function that this returns will expect a single argument that is
    a :class:`~skyfield.timelib.Time` and will return 0 through 23 for
    the solar terms.

    The name of the solar terms may vary in different cultures, so we
    have table of names in Simplified Chinese, Traditional Chinese,
    Japanese and Vietnamese

    Reference:

    https://en.wikipedia.org/wiki/Solar_term

    """
    earth = ephemeris['earth']
    sun = ephemeris['sun']

    def solar_term_at(t):
        """Return season 0 through 23 at time `t`."""
        t._nutation_angles_radians = iau2000b_radians(t)
        e = earth.at(t)
        _, slon, _ = e.observe(sun).apparent().ecliptic_latlon('date')

        return (slon.radians // (tau / 24) % 24).astype(int)