Package: eacal
EastAsiaCalendars provides aneacalPython module for accessing East
Asia calendar systems, originated in China, and spread to Korea,
Vietnam, and Japan. This module includes the following.solar terms(節氣,
节气, 節気, 절기, tiết khí)sexagenary cycle(六十花甲, 干支, 간지, Gānzhī)zassetsu(雑節,
Seasonal days in the Japanese calendar)Solar terms are calculated based on the planetary motion computed byPyEphem. The accuracy of solar
terms may be within one minute.Results of use of this software is not warrantied. You may use, modify,
and redistribute this software underGNU LESSER GENERAL PUBLIC LICENSE
Version 3.RequirementsPython 2.x / 3.xPyEphempytzjdcalInstallationThe required packages (PyEphem, pytz, and jdcal) are automatically
installed viapip.pipinstalleacalExample & UsageThis package supports Chinese (traditional / simplified), Japanese,
Korean, Vietnamese, and English (translation). Any timezones can be
specified using the pytz package.Calculating solar terms in a yearThe solar terms of 2015 for English (in UTC).>>>importeacal>>>fromdatetimeimportdatetime>>>c=eacal.EACal()>>>forxinc.get_annual_solar_terms(2015):...print"%2d%-25s%s"%(x[1],x[0],datetime.strftime(x[2],"%Y-%m-%d%H:%M %Z"))22minorcold2015-01-0516:20UTC23majorcold2015-01-2009:43UTC0startofspring2015-02-0403:58UTC1rainwater2015-02-1823:49UTC2awakeningofinsects2015-03-0521:55UTC3vernalequinox2015-03-2022:45UTC...20majorsnow2015-12-0710:53UTC21wintersolstice2015-12-2204:47UTCThe solar terms of 2015, for Traditional Chinese (in Hong Kong Time),
Simplified Chinese (in Chinese Standard Time), Japanese (in Japan
Standard Time), Korean (in Korea Standard Time), and Vietnamese (in
Indochina Time).>>>importeacal>>>fromdatetimeimportdatetime>>>c_t=eacal.EACal(zh_t=True)>>>forxinc_t.get_annual_solar_terms(2015):...print"%2d%s%s"%(x[1],x[0],datetime.strftime(x[2],"%Y-%m-%d%H:%M %Z"))22小寒2015-01-0600:20HKT23大寒2015-01-2017:43HKT0立春2015-02-0411:58HKT1雨水2015-02-1907:49HKT2驚蟄2015-03-0605:55HKT3春分2015-03-2106:45HKT...20大雪2015-12-0718:53HKT21冬至2015-12-2212:47HKT>>>c_s=eacal.EACal(zh_s=True)>>>forxinc_s.get_annual_solar_terms(2015):...print"%2d%s%s"%(x[1],x[0],datetime.strftime(x[2],"%Y-%m-%d%H:%M %Z"))22小寒2015-01-0600:20CST23大寒2015-01-2017:43CST0立春2015-02-0411:58CST1雨水2015-02-1907:49CST2惊蛰2015-03-0605:55CST3春分2015-03-2106:45CST小寒2015-01-0600:20CST大寒2015-01-2017:43CST立春2015-02-0411:58CST雨水2015-02-1907:49CST惊蛰2015-03-0605:55CST春分2015-03-2106:45CST...20大雪2015-12-0718:53CST21冬至2015-12-2212:47CST>>>c_j=eacal.EACal(ja=True)>>>forxinc_j.get_annual_solar_terms(2015):...print"%2d%s%s"%(x[1],x[0],datetime.strftime(x[2],"%Y-%m-%d%H:%M %Z"))22小寒2015-01-0601:20JST23大寒2015-01-2018:43JST0立春2015-02-0412:58JST1雨水2015-02-1908:49JST2啓蟄2015-03-0606:55JST3春分2015-03-2107:45JST...20大雪2015-12-0719:53JST21冬至2015-12-2213:47JST>>>c_k=eacal.EACal(ko=True)>>>forxinc_k.get_annual_solar_terms(2015):...print"%2d%s%s"%(x[1],x[0],datetime.strftime(x[2],"%Y-%m-%d%H:%M %Z"))22소한2015-01-0601:20KST23대한2015-01-2018:43KST0입춘2015-02-0412:58KST1우수2015-02-1908:49KST2경칩2015-03-0606:55KST3춘분2015-03-2107:45KST...20대설2015-12-0719:53KST21동지2015-12-2213:47KST>>>c_v=eacal.EACal(vi=True)>>>forxinc_v.get_annual_solar_terms(2015):...print"%2d%-12s%s"%(x[1],x[0],datetime.strftime(x[2],"%Y-%m-%d%H:%M %Z"))22Tiểuhàn2015-01-0523:20ICT23Đạihàn2015-01-2016:43ICT0Lậpxuân2015-02-0410:58ICT1Vũthủy2015-02-1906:49ICT2Kinhtrập2015-03-0604:55ICT3Xuânphân2015-03-2105:45ICT...20Đạituyết2015-12-0717:53ICT21Đôngchí2015-12-2211:47ICTThe solar terms of 2015 in North American Eastern Time Zone.>>>importeacal>>>importpytz>>>fromdatetimeimportdatetime>>>c=eacal.EACal(tz=pytz.timezone('America/New_York'))>>>forxinc.get_annual_solar_terms(2015):...print"%2d%-25s%s"%(x[1],x[0],datetime.strftime(x[2],"%Y-%m-%d%H:%M %Z"))22minorcold2015-01-0511:20EST23majorcold2015-01-2004:43EST0startofspring2015-02-0322:58EST1rainwater2015-02-1818:49EST2awakeningofinsects2015-03-0516:55EST3vernalequinox2015-03-2018:45EDT# in DST...20majorsnow2015-12-0705:53EST21wintersolstice2015-12-2123:47ESTCalculating sexagenary cyclesCalculating the cyclic year of 2015.>>>importeacal>>>print(eacal.EACal().get_cycle_year(2015))wood-yingoat# 乙未>>>print(eacal.EACal(zh_t=True).get_cycle_year(2015))乙未>>>print(eacal.EACal(vi=True).get_cycle_year(2015))ấtmùi# 乙未>>>print(eacal.EACal().get_cycle_year(2015,id=True))31# 31=wood-yin goatCalculating the Cyclic month of May 2015.>>>importeacal>>>print(eacal.EACal().get_cycle_month(2015,5))metal-yinsnake# 辛巳>>>print(eacal.EACal(ja=True).get_cycle_month(2015,5))辛巳>>>print(eacal.EACal(ko=True).get_cycle_month(2015,5))신사# 辛巳>>>print(eacal.EACal().get_cycle_month(2015,5,id=True))17# 17=metal-yin snakeCalculating the Cyclic day of 10th, May 2015.>>>importeacal>>>fromdatetimeimportdatetime>>>print(eacal.EACal().get_cycle_day(datetime(2015,5,10)))fire-yangdog# 丙戌>>>print(eacal.EACal(zh_s=True).get_cycle_day(datetime(2015,5,10)))丙戌>>>print(eacal.EACal(vi=True).get_cycle_day(datetime(2015,5,10)))bínhtuất# 丙戌>>>print(eacal.EACal().get_cycle_day(datetime(2015,5,10),id=True))22# 22=fire-yang dogCalculating the Cyclic year, month, and day around the start of spring
in 2015.>>>importeacal>>>fromdatetimeimportdatetime>>>c=eacal.EACal()# for English, in UTC>>>print('|'.join(c.get_cycle_ymd(datetime(2015,2,3))))wood-yanghorse|fire-yinox|metal-yangdog# 甲午年 丁丑月 庚戌日>>>print('|'.join(c.get_cycle_ymd(datetime(2015,2,4))))wood-yingoat|earth-yangtiger|metal-yinpig# 乙未年 戊寅月 辛亥日 (cyclic year and cyclic month incremented at the start of spring)>>>print('|'.join(c.get_cycle_ymd(datetime(2015,2,5))))wood-yingoat|earth-yangtiger|water-yangrat# 乙未年 戊寅月 壬子日>>>print(c.get_cycle_ymd(datetime(2015,2,3),id=True))(30,13,46)# 30=wood-yang horse, 13=fire-yin ox, 46=metal-yang dog>>>print(c.get_cycle_ymd(datetime(2015,2,4),id=True))(31,14,47)# 31=wood-yin goat, 14=earth-yang tiger, 47=metal-yin pig>>>print(c.get_cycle_ymd(datetime(2015,2,5),id=True))(31,14,48)# 48=water-yang ratCalculating Zassetsu>>>importeacal>>>importpytz>>>fromdatetimeimportdatetime,timedelta>>>c=eacal.EACal(tz=pytz.timezone('Asia/Tokyo'))# for English, in Japan Standard Time>>>forxinc.get_annual_jp_seasonal_days(2015):...iflen(x)==4:...print("%3d%s%s%s"%(x[1],datetime.strftime(x[2],"%Y-%m-%d"),datetime.strftime(x[3]-timedelta(days=1),"%Y-%m-%d"),x[0]))...else:...print("%3d%s%s"%(x[1],datetime.strftime(x[2],"%Y-%m-%d"),x[0]))12015-01-172015-02-03doyō:winter22015-04-172015-05-05doyō:spring32015-07-202015-08-07doyō:summer42015-10-212015-11-07doyō:autumn112015-03-182015-03-24higan:spring122015-09-202015-09-26higan:autumn1012015-02-03setsubun:thedaybeforethestartofspring1022015-05-02hachijū-hachi-ya:the88thnightafterthestartofspring1032015-09-01nihyaku-tōka:the210thdayafterthestartofspring1112015-06-11nyūbai:thebeginningofrainyseason1122015-07-02hangeshō:theendoffieldwork>>>c_j=eacal.EACal(ja=True)# for Japanese, in Japan Standard Time>>>forxinc_j.get_annual_jp_seasonal_days(2015):...iflen(x)==4:...print("%3d%s%s%s"%(x[1],datetime.strftime(x[2],"%Y-%m-%d"),datetime.strftime(x[3]-timedelta(days=1),"%Y-%m-%d"),x[0]))...else:...print("%3d%s%s"%(x[1],datetime.strftime(x[2],"%Y-%m-%d"),x[0]))12015-01-172015-02-03土用:冬22015-04-172015-05-05土用:春32015-07-202015-08-07土用:夏42015-10-212015-11-07土用:秋112015-03-182015-03-24彼岸:春122015-09-202015-09-26彼岸:秋1012015-02-03節分1022015-05-02八十八夜1032015-09-01二百十日1112015-06-11入梅1122015-07-02半夏生HistoryVersion 0.0.3 (2015-05-17)Add an “id” option to get_cycle_year(), get_cycle_month(), and
get_cycle_day()this option enabled the methods to return IDs (0-59) of the
sexagenary cycle.Refine implementations of solar_term_finder()Renumber IDs of solar termsbegins at “start of spring” (0=start of spring - 23=major cold)Version 0.0.2 (2015-05-13)Fixed documents (README.md, README_ja.md)Add install_requires to setup.pyrequired packages PyEphem, pytz, and jdcal are automatically
installed via pipFixed a earthly branch in EnglishVersion 0.0.1 (2015-05-12)The first release.TODOa method for finding days which have a specified sexagenary cyclelunisolar calendarsregnal yearsadapt to Chinese cycle yearswrite unit testsdocumentation for Windows environments