Closed karthikraman closed 3 years ago
Why not just print panchaanga.festival_id_to_days
? What does this have to do with the deleted file? If ICS is needed, could use ics.compute_calendar
This would be a custom set of TOML files, not in the repo. I don't seem to find how to supply a custom set of TOML files to the festivalAPplier... The deleted file would take as input a json file with (arbitrary) festivals and generate an ICS.
This would be a custom set of TOML files, not in the repo. I don't seem to find how to supply a custom set of TOML files to the festivalAPplier... The deleted file would take as input a json file with (arbitrary) festivals and generate an ICS.
Consider this code snippet from jyotisha/panchaanga/writer/generation_project/common_ics.py :
computation_system = ComputationSystem.SOLSTICE_POST_DARK_10_ADHIKA__CHITRA_180
computation_system.options.fest_repos = [RulesRepo(name="gRhya/general")]
tropical_panchaanga = annual.get_panchaanga_for_shaka_year(city=city, year=year, computation_system=computation_system, allow_precomputed=False)
See how I am generating the panchaanga using ONLY "gRhya/general" repo. You will do something analogous with the following changes:
Second part above is untested - but should work.
import os
import jyotisha
from jyotisha.panchaanga import spatio_temporal
from jyotisha.panchaanga.spatio_temporal import annual
from jyotisha.panchaanga.temporal import ComputationSystem
from jyotisha.panchaanga.temporal.festival.rules import RulesRepo
from jyotisha.panchaanga.writer import ics
def dump_common(year, city):
elim_tags = ["AdiShankaraHistory", "AmavasyaDays", "AndhraTempleFestivals", "AzhwarJayanti", "BengalFestivals", "ChandraDarshanam", "Combinations", "CommonFestivals", "CommonFestivalsTamilnadu", "DanamDays", "Dashamahavidya", "Dashavataram", "DevataPuja", "DeviPuja", "Eclipses", "EkadashiVratam", "KalpadiDays", "KanchiAradhanaDays", "KeralaTempleFestivals", "LessCommonFestivals", "MahapurushaEvents", "ManvadiDays", "MonthWeekdayFestivals", "MonthlyFestivals", "MonthlyShraddhaDays", "MonthlyVratam", "Navaratri", "NayanarGurupujai", "NorthIndiaTempleFestivals", "OdishaTempleFestivals", "OtherAvataram", "OtherAvatarams", "OtherJayantis", "PradoshaVratam", "PuranaEvents", "PurnimaDays", "Pushkara", "RareDays", "SankataharaChaturthiVratam", "Sankranti", "ShannavatiTarpanaDays", "ShashthiVratam", "ShraddhaDays", "SpecialDays", "SpecialPeriodEnd", "SpecialPeriodStart", "SpecialPuja", "SpecialSnanam", "SpecialVratam", "SringeriAradhanaDays", "SringeriFestivals", "SunSankranti", "TamilFestivals", "TamilnaduTempleFestivals", "UttarPradeshTempleFestivals", "VratamEnd", "VratamStart", "Yugadi", "YugadiDays"]
computation_system = ComputationSystem.DEFAULT
computation_system.options.fest_tags_excluded = elim_tags
# computation_system.options.fest_tags_included = None
computation_system.options.fest_repos = [RulesRepo(name="private/")]
panchaanga = annual.get_panchaanga_for_civil_year(city=city, year=year, computation_system=computation_system)
ics_calendar = ics.compute_calendar(panchaanga)
output_file = os.path.join(city.name, '%d.ics' % (year))
ics.write_to_file(ics_calendar, output_file)
if __name__ == '__main__':
Chennai = spatio_temporal.City.get_city_from_db("Chennai")
dump_common(year=2021, city=Chennai)
This generates a file with several events, even though I have eliminated every possible tag.
It also doesn't seem to pick up the files inside "private/"
It also doesn't seem to pick up the files inside
"private/"
That's because you haven't passed the path parameter - please look at the constructor definition.
This generates a file with several events, even though I have eliminated every possible tag.
Filtering based on computation_system.options.fest_tags_excluded is not implemented. (I'm hoping it will be mostly obviated due to repo-list-passing functionality.) Further, non-rule-based (ie dynamic) festival assignment is yet to be eliminated/ filtered out (or turned into rule-based computations) - hence the junk (which bothers me as well).
Filtering based on computation_system.options.fest_tags_excluded is not implemented. (I'm hoping it will be mostly obviated due to repo-list-passing functionality.) Further, non-rule-based (ie dynamic) festival assignment is yet to be eliminated/ filtered out (or turned into rule-based computations) - hence the junk (which bothers me as well).
This should be fixed now.
Got this to work finally. However, festivals get saved with the JSON. If I have to just create an ICS for newly added rules, without re-computing the panchaanga, is it possible as of now?
Got this to work finally. However, festivals get saved with the JSON. If I have to just create an ICS for newly added rules, without re-computing the panchaanga, is it possible as of now?
No. The current idea is that festivals ought to be recomputed every time the panchaanga is loaded (because rule-set may have changed in the meantime). They're just stored in JSON for reference, debugging and other ancillary (client side) use
Perhaps I can use _reset_festivals()
, change fest repos and then update_festivals()
?
update_festivals
First statement of update_festival_details
is self._reset_festivals()
:-)
Give
write_events_ics.py
has been (rightly) phased out, what is the recommended way to get a list of festivals for a calendar year for a specified list of toml files? (these are not necessary festivals, so not on adyatithi, but could be birthdays/wedding days etc. specified by a festival rule)Please share your thoughts @vvasuki ...