コード例 #1
0
ファイル: hebrew.py プロジェクト: rob-blackbourn/PyFinance
 def new_year(cls, gregorian_year):
     """Return fixed date of Observational (classical)
     Nisan 1 occurring in Gregorian year, 'gregorian_year'."""
     jan1 = GregorianDate.new_year(gregorian_year)
     equinox = Solar.solar_longitude_after(Astro.SPRING, jan1)
     sset = JAFFA.universal_from_standard(JAFFA.sunset(ifloor(equinox)))
     return cls.phasis_on_or_after(ifloor(equinox) - (14 if (equinox < sset) else 13), JAFFA)
コード例 #2
0
ファイル: hindu.py プロジェクト: rob-blackbourn/PyFinance
def hindu_lunar_holiday(l_month, l_day, gregorian_year):
    """Return the list of fixed dates of occurrences of Hindu lunar
    month, month, day, day, in Gregorian year, 'gregorian_year'."""
    l_year = HinduLunarDate.from_fixed(GregorianDate.new_year(gregorian_year)).year
    date1  = hindu_date_occur(l_month, l_day, l_year)
    date2  = hindu_date_occur(l_month, l_day, l_year + 1)
    return list_range([date1, date2], GregorianDate.year_range(gregorian_year))
コード例 #3
0
ファイル: hindu.py プロジェクト: rob-blackbourn/PyFinance
def hindu_lunar_event(l_month, tithi, tee, gregorian_year):
    """Return the list of fixed dates of occurrences of Hindu lunar tithi
    prior to sundial time, tee, in Hindu lunar month, l_month,
    in Gregorian year, 'gregorian_year'."""
    l_year = HinduLunarDate.from_fixed(GregorianDate.new_year(gregorian_year)).year
    date1  = hindu_tithi_occur(l_month, tithi, tee, l_year)
    date2  = hindu_tithi_occur(l_month, tithi, tee, l_year + 1)
    return list_range([date1, date2], GregorianDate.year_range(gregorian_year))
コード例 #4
0
ファイル: coptic.py プロジェクト: rob-blackbourn/PyFinance
 def in_gregorian(cls, c_month, c_day, g_year):
     """Return the list of the fixed dates of Coptic month 'c_month',
     day 'c_day' that occur in Gregorian year 'g_year'."""
     jan1 = GregorianDate.new_year(g_year)
     y = cls.from_fixed(jan1).year
     date1 = CopticDate(y, c_month, c_day).to_fixed()
     date2 = CopticDate(y + 1, c_month, c_day).to_fixed()
     return list_range([date1, date2], GregorianDate.year_range(g_year))
コード例 #5
0
ファイル: chinese.py プロジェクト: rob-blackbourn/PyFinance
def vietnamese_location(tee):
    """Return the location for Vietnamese calendar is Hanoi;
    varies with moment, tee. Time zone has changed over the years."""
    if (tee < GregorianDate.new_year(1968)):
        z = 8
    else:
        z =7
    return Location(angle(21, 2, 0), angle(105, 51, 0), 12, Clock.days_from_hours(z))
コード例 #6
0
ファイル: hebrew.py プロジェクト: rob-blackbourn/PyFinance
 def yahrzeit_in_gregorian(self, gregorian_year):
     """Return the list of the fixed dates of death date death_date (yahrzeit)
     that occur in Gregorian year 'gregorian_year'."""
     jan1 = GregorianDate.new_year(gregorian_year)
     y = HebrewDate.from_fixed(jan1).year
     date1 = self.yahrzeit(y)
     date2 = self.yahrzeit(y + 1)
     return list_range([date1, date2], GregorianDate.year_range(gregorian_year))
コード例 #7
0
ファイル: hebrew.py プロジェクト: rob-blackbourn/PyFinance
 def birthday_in_gregorian(self, gregorian_year):
     """Return the list of the fixed dates of Hebrew birthday
     birthday that occur in Gregorian 'gregorian_year'."""
     jan1 = GregorianDate.new_year(gregorian_year)
     y = HebrewDate.from_fixed(jan1).year
     date1 = self.birthday(y)
     date2 = self.birthday(y + 1)
     return list_range([date1, date2], GregorianDate.year_range(gregorian_year))
コード例 #8
0
ファイル: julian.py プロジェクト: rob-blackbourn/PyFinance
 def julian_in_gregorian(j_month, j_day, g_year):
     """Return the list of the fixed dates of Julian month 'j_month', day
     'j_day' that occur in Gregorian year 'g_year'."""
     jan1 = GregorianDate.new_year(g_year)
     y    = JulianDate.from_fixed(jan1).year
     y_prime = 1 if (y == -1) else (y + 1)
     date1 = JulianDate(y, j_month, j_day).to_fixed()
     date2 = JulianDate(y_prime, j_month, j_day).to_fixed()
     return list_range([date1, date2], GregorianDate.year_range(g_year))
コード例 #9
0
ファイル: islamic.py プロジェクト: rob-blackbourn/PyFinance
 def in_gregorian(cls, month, day, gregorian_year):
     """Return list of the fixed dates of Islamic month 'month', day 'day' that
     occur in Gregorian year 'gregorian_year'."""
     jan1  = GregorianDate.new_year(gregorian_year)
     y     = cls.from_fixed(jan1).year
     date1 = IslamicDate(y, month, day).to_fixed()
     date2 = IslamicDate(y + 1, month, day).to_fixed()
     date3 = IslamicDate(y + 2, month, day).to_fixed()
     return list_range([date1, date2, date3], GregorianDate.year_range(gregorian_year))
コード例 #10
0
ファイル: hindu.py プロジェクト: rob-blackbourn/PyFinance
def hindu_lunar_new_year(g_year):
    """Return the fixed date of Hindu lunisolar new year in
    Gregorian year, g_year."""
    jan1     = GregorianDate.new_year(g_year)
    mina     = hindu_solar_longitude_at_or_after(330, jan1)
    new_moon = HinduLunarDate.day_at_or_after(1, mina)
    h_day    = ifloor(new_moon)
    critical = HinduDate.sunrise(h_day)
    return (h_day +
            (0 if ((new_moon < critical) or
                   (HinduLunarDate.day_from_moment(HinduDate.sunrise(h_day + 1)) == 2))
             else 1))
コード例 #11
0
ファイル: hebrew.py プロジェクト: rob-blackbourn/PyFinance
 def tzom_tevet(cls, gregorian_year):
     """Return the list of fixed dates for Tzom Tevet (Tevet 10) that
     occur in Gregorian year 'gregorian_year'. It can occur 0, 1 or 2 times per
     Gregorian year."""
     jan1 = GregorianDate.new_year(gregorian_year)
     y = HebrewDate.from_fixed(jan1).year
     d1 = HebrewDate(y, HebrewMonth.TEVET, 10).to_fixed()
     d1 = d1 + 1 if DayOfWeek.from_fixed(d1) == DayOfWeek.Saturday else d1
     d2 = HebrewDate(y + 1, HebrewMonth.TEVET, 10).to_fixed()
     d2 = d2 + 1 if DayOfWeek.from_fixed(d2) == DayOfWeek.Saturday else d2
     dates = [d1, d2]
     return list_range(dates, GregorianDate.year_range(gregorian_year))
コード例 #12
0
ファイル: hebrew.py プロジェクト: rob-blackbourn/PyFinance
 def in_gregorian(cls, month, day, gregorian_year):
     """Return list of the fixed dates of Hebrew month, 'month', day, 'day',
     that occur in Gregorian year 'gregorian_year'."""
     jan1 = GregorianDate.new_year(gregorian_year)
     y = HebrewDate.from_fixed(jan1).year
     date1 = HebrewDate(y, month, day).to_fixed()
     date2 = HebrewDate(y + 1, month, day).to_fixed()
     # Hebrew and Gregorian calendar are aligned but certain
     # holidays, i.e. Tzom Tevet, can fall on either side of Jan 1.
     # So we can have 0, 1 or 2 occurences of that holiday.
     dates = [date1, date2]
     return list_range(dates, GregorianDate.year_range(gregorian_year))
コード例 #13
0
ファイル: hindu.py プロジェクト: rob-blackbourn/PyFinance
def mesha_samkranti(g_year):
    """Return the fixed moment of Mesha samkranti (Vernal equinox)
    in Gregorian year, g_year."""
    jan1 = GregorianDate.new_year(g_year)
    return hindu_solar_longitude_at_or_after(0, jan1)
コード例 #14
0
ファイル: iso.py プロジェクト: rob-blackbourn/PyFinance
 def is_long_year(cls, i_year):
     """Return True if ISO year 'i_year' is a long (53-week) year."""
     jan1  = DayOfWeek.from_fixed(GregorianDate.new_year(i_year))
     dec31 = DayOfWeek._from_fixed(GregorianDate.year_end(i_year))
     return jan1 == DayOfWeek.Thursday or dec31 == DayOfWeek.Thursday