def main(): [city_name, latitude, longitude, tz] = sys.argv[1:5] year = int(sys.argv[5]) compute_lagnams = False # Default scripts = [sanscript.DEVANAGARI] # Default language is devanagari fmt = 'hh:mm' if len(sys.argv) == 9: compute_lagnams = True fmt = sys.argv[7] scripts = sys.argv[6].split(",") elif len(sys.argv) == 8: scripts = sys.argv[6].split(",") fmt = sys.argv[7] compute_lagnams = False elif len(sys.argv) == 7: scripts = sys.argv[6].split(",") compute_lagnams = False city = City(city_name, latitude, longitude, tz) panchaanga = jyotisha.panchaanga.spatio_temporal.annual.get_panchaanga_for_civil_year( city=city, year=year) emit(panchaanga, scripts=scripts)
def main(): [city_name, latitude, longitude, tz] = sys.argv[1:5] year = int(sys.argv[5]) if len(sys.argv) == 8: all_tags = False else: all_tags = True # Default assume detailed ICS with name_to_rule tags if len(sys.argv) >= 7: scripts = sys.argv[6].split(",") else: scripts = [sanscript.IAST ] # Default script is IAST for writing calendar city = City(city_name, latitude, longitude, tz) panchaanga = jyotisha.panchaanga.spatio_temporal.annual.get_panchaanga_for_civil_year( city=city, year=year) panchaanga.update_festival_details() ics_calendar = compute_calendar(panchaanga) output_file = os.path.expanduser( '%s/%s-%d-%s.ics' % ("~/Documents/jyotisha", city.name, year, scripts)) write_to_file(ics_calendar, output_file)
def main(): [city_name, latitude, longitude, tz] = sys.argv[1:5] year = int(sys.argv[5]) compute_lagnams = False # Default script = sanscript.DEVANAGARI # Default script is devanagari fmt = 'hh:mm' if len(sys.argv) == 9: compute_lagnams = True fmt = sys.argv[7] script = sys.argv[6] elif len(sys.argv) == 8: script = sys.argv[6] fmt = sys.argv[7] compute_lagnams = False elif len(sys.argv) == 7: script = sys.argv[6] compute_lagnams = False city = City(city_name, latitude, longitude, tz) panchaanga = jyotisha.panchaanga.spatio_temporal.annual.get_panchaanga_for_civil_year( city=city, year=year) panchaanga.update_festival_details() ics_calendar = writeDailyICS(panchaanga) city_name_en = jyotisha.custom_transliteration.romanise( jyotisha.custom_transliteration.tr(city.name, sanscript.IAST)).title() output_file = os.path.expanduser( '%s/%s-%d-%s-daily.ics' % ("../ics/daily", city_name_en, year, script)) write_to_file(ics_calendar, output_file) print('Output ICS written to %s' % output_file, file=sys.stderr)
def get(self, latitude, longitude, year): args = self.get_parser.parse_args() city = City("", latitude, longitude, args['timezone']) panchaanga = annual.get_panchaanga_for_civil_year(city=city, year=int(year)) return panchaanga.to_json_map()
def main(): [city_name, latitude, longitude, tz] = sys.argv[1:5] year = int(sys.argv[5]) compute_lagnams = False # Default script = sanscript.DEVANAGARI # Default script is devanagari fmt = 'hh:mm' lagnasuff = '' if len(sys.argv) == 9: compute_lagnams = True lagnasuff = '-lagna' fmt = sys.argv[7] script = sys.argv[6] elif len(sys.argv) == 8: script = sys.argv[6] fmt = sys.argv[7] compute_lagnams = False elif len(sys.argv) == 7: script = sys.argv[6] compute_lagnams = False city = City(city_name, latitude, longitude, tz) panchaanga = annual.get_panchaanga_for_civil_year(city=city, year=year) panchaanga.update_festival_details() city_name_en = jyotisha.custom_transliteration.romanise( jyotisha.custom_transliteration.tr(city.name, sanscript.IAST)).title() output_file = os.path.expanduser( '%s/%s-%d-%s-daily%s.md' % ("~/Documents/jyotisha/jyotisha/txt/daily", city_name_en, year, script, lagnasuff)) os.makedirs(os.path.dirname(output_file), exist_ok=True) writeDailyText(panchaanga, compute_lagnams, open(output_file, 'w'))
def test_jd_start_orinda_ca(): city = City('Orinda', '37:51:38', '-122:10:59', 'America/Los_Angeles') assert daily.DailyPanchaanga.from_city_and_julian_day( city=city, julian_day=2458551.8333333335).julian_day_start == 2458551.8333333335 assert daily.DailyPanchaanga.from_city_and_julian_day( city=city, julian_day=2458552.8333333335).julian_day_start == 2458552.8333333335
def get(self, latitude, longitude, year, month, day): args = self.get_parser.parse_args() city = City("", latitude, longitude, args['timezone']) panchaanga = daily.DailyPanchaanga(city=city, date=Date(year=int(year), month=int(month), day=int(day))) return panchaanga.day_length_based_periods.to_json_map()
def test_timing(caplog): # A separate function for convenient profiling. # See data/timing_snapshot* for results/ progression. caplog.set_level(logging.INFO) city = City('Chennai', "13:05:24", "80:16:12", "Asia/Calcutta") annual.get_panchaanga_for_civil_year(city=city, year=2018, allow_precomputed=False) timebudget.report(reset=True)
def test_adhika_maasa_computations_2009(): city = City('Chennai', "13:05:24", "80:16:12", "Asia/Calcutta") panchaanga_2009 = annual.get_panchaanga_for_civil_year( city=city, year=2009, allow_precomputed=False) expected_lunar_months_2009 = [7] + [8] * 29 + [9] * 30 + [10] * 15 assert expected_lunar_months_2009 == [ x.lunar_month_sunrise.index for x in panchaanga_2009.daily_panchaangas_sorted() [panchaanga_2009.duration_prior_padding + 290:panchaanga_2009.duration_prior_padding + 365] ]
def no_fest_chennai_panchaanga(year): city = City('Chennai', "13:05:24", "80:16:12", "Asia/Calcutta") computation_system = copy.deepcopy( ComputationSystem.MULTI_NEW_MOON_SIDEREAL_MONTH_ADHIKA__CHITRA_180) computation_system.festival_options.repos = [] panchaanga = annual.get_panchaanga_for_civil_year( city=city, year=year, allow_precomputed=False, computation_system=computation_system) return panchaanga
def test_adhika_maasa_computations_2018(): city = City('Chennai', "13:05:24", "80:16:12", "Asia/Calcutta") panchaanga_2018 = annual.get_panchaanga_for_civil_year( city=city, year=2018, allow_precomputed=False) expected_lunar_months_2018 = [2] + [2.5] * 29 + [3] * 30 + [4] assert expected_lunar_months_2018 == [ x.lunar_month_sunrise.index for x in panchaanga_2018.daily_panchaangas_sorted() [panchaanga_2018.duration_prior_padding + 134:panchaanga_2018.duration_prior_padding + 195] ]
def test_orinda_ca_dst_2019(): city = City('Orinda', '37:51:38', '-122:10:59', 'America/Los_Angeles') panchaanga = periodical.Panchaanga(city=city, start_date=Date(2019, 1, 1), end_date=Date(2019, 5, 1)) # March 10 is the 69th day of the year (70th in leap years) in the Gregorian calendar. # Sunrise on that day is around 7:27 AM according to Google, which is JD 2458553.14375 according to https://ssd.jpl.nasa.gov/tc.cgi#top . # We use the index 70 below as the annual panchaanga object seems to use the index d + 1. assert round( panchaanga.daily_panchaangas_sorted()[panchaanga.duration_prior_padding + 69].jd_sunrise, ndigits=4) == round(2458554.104348237, ndigits=4) # 2019-Mar-10 07:30:15.68
def main(): [city_name, latitude, longitude, tz] = sys.argv[1:5] year = int(sys.argv[5]) scripts = [sanscript.DEVANAGARI] # Default language is devanagari if len(sys.argv) == 7: scripts = sys.argv[6].split(",") # logging.debug(language) city = City(city_name, latitude, longitude, tz) panchaanga = annual.get_panchaanga_for_civil_year(city=city, year=year) panchaanga.update_festival_details() write_monthly_tex(panchaanga)
def main(): [city_name, latitude, longitude, tz] = sys.argv[1:5] year = int(sys.argv[5]) if len(sys.argv) >= 7: scripts = sys.argv[6].split(",") else: scripts = [sanscript.IAST ] # Default language is IAST for writing calendar city = City(city_name, latitude, longitude, tz) panchaanga = jyotisha.panchaanga.spatio_temporal.annual.get_panchaanga_for_civil_year( city=city, year=year) ics_calendar = compute_calendar(panchaanga) output_file = os.path.expanduser( '%s/%s-%d-%s.ics' % ("~/Documents/jyotisha", city.name, year, scripts)) write_to_file(ics_calendar, output_file)
def main(): [json_file, city_name, latitude, longitude, tz] = sys.argv[1:6] if not os.path.isfile(json_file): raise IOError('File %s not found!' % json_file) year = int(sys.argv[6]) if len(sys.argv) == 8: script = sys.argv[7] else: script = 'iast' # Default script is IAST for writing calendar city = City(city_name, latitude, longitude, tz) panchaanga = jyotisha.panchaanga.spatio_temporal.annual.get_panchaanga_for_civil_year( city=city, year=year) panchaanga.update_festival_details() cal_file_name = '%s-%s-%s' % ( city_name, year, os.path.basename(json_file).replace('.json', '.ics')) emit_ics_calendar(panchaanga, cal_file_name) print('Wrote ICS file to %s' % cal_file_name)
def test_panchaanga_orinda_19(caplog): caplog.set_level(logging.INFO) city = City('Orinda', '37:51:38', '-122:10:59', 'America/Los_Angeles') panchaanga_json_comparer(city=city, year=2019)
body.longitude_difference(jd=self.jd_next_sunrise, body1=sun, body2=graha) ] else: amauDhyas[graha_id] = [ body.longitude_difference(jd=self.jd_sunrise, body1=sun, body2=graha), body.longitude_difference(jd=self.jd_next_sunrise, body1=sun, body2=graha) ] if len(mauDhyas) > 0: self.mauDhyas = mauDhyas if len(amauDhyas) > 0: self.amauDhyas = amauDhyas # Essential for depickling to work. common.update_json_class_index(sys.modules[__name__]) # logging.debug(common.json_class_index) if __name__ == '__main__': panchaanga = DailyPanchaanga.from_city_and_julian_day( city=City('Chennai', '13:05:24', '80:16:12', 'Asia/Calcutta'), julian_day=2457023.27) panchaanga.compute_tb_muhuurtas() logging.debug(str(panchaanga))