karthikraman / panchangam Goto Github PK
View Code? Open in Web Editor NEWComputing the Indian calendar/panchangam and festivals using Swiss ephemeris
Computing the Indian calendar/panchangam and festivals using Swiss ephemeris
आमोदो ममामितो दृष्ट्वेमं यत्नम्। निवारयति स्वीयारम्भम् इव https://github.com/sanskrit-coders/jyotisha इत्यत्र। आस्ताम्। अधुना कार्यं किञ्चिद् उपयोक्तृसौकर्याय। pip इत्यत्र प्रकाशनीयम्। तदन्व् अस्य परीक्षणे वर्धने चान्येषां मादृशानाम् अपि भविष्यति योगदानम्।
एतदर्थं ननु https://github.com/sanskrit-coders/jyotisha इत्यत्र दृश्यमानम् अस्थिपिञ्जरम् प्रयुज्यताम्। सरलं हि तत्। सर्वमपि module-शः व्यवस्थापनीयम्।
I was thinking of doing it in js, and before doing I found this library. I wanted to make a pwa, and since the logic/pseudo-code is sort of lost in the python lines, I could not figure it out. Could someone please point out the exact parts I need to write the code in js.
Hi... Good repo. Can you please help on why this error may be coming.
Using the following docker :
FROM python:3.7
RUN apt-get -y update && apt-get -y install texlive-xetex texlive-latex-extra texlive-fonts-extra nano mlocate
WORKDIR /src
RUN git clone https://github.com/karthikraman/panchangam.git
RUN cd panchangam/bin && pip install git+https://github.com/sanskrit-coders/jyotisha@master -U && pip install git+https://github.com/astrorigin/pyswisseph@master -U
WORKDIR /src/panchangam/bin
ENTRYPOINT ["bash"]
Ran :
./gen_monthly_cal.sh Chennai 13:05:24 80:16:12 'Asia/Calcutta' 2020 devanagari
Get error
ERROR: 2020-11-28 04:20:03,580 {__init__.py:39}: Relative festival (bhAdrapada) mahAlaya amAvAsyA not in festival_id_to_days!
ERROR: 2020-11-28 04:20:03,582 {__init__.py:39}: Relative festival zayana-EkAdazI not in festival_id_to_days!
Traceback (most recent call last):
File "/usr/local/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/local/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.7/site-packages/jyotisha/panchaanga/writer/tex/write_monthly_panchaanga_tex.py", line 350, in <module>
main()
File "/usr/local/lib/python3.7/site-packages/jyotisha/panchaanga/writer/tex/write_monthly_panchaanga_tex.py", line 345, in main
write_monthly_tex(panchaanga)
TypeError: write_monthly_tex() missing 1 required positional argument: 'template_file'
error!
Ls of some important directories
root@1eb682b46761:/src/panchangam/bin# ls -al /usr/local/lib/python3.7/site-packages/jyotisha/panchaanga/temporal/festival/
total 36
drwxr-sr-x 6 root staff 4096 Nov 28 01:40 .
drwxr-sr-x 7 root staff 4096 Nov 28 01:40 ..
-rw-r--r-- 1 root staff 3982 Nov 28 01:40 __init__.py
drwxr-sr-x 2 root staff 4096 Nov 28 01:40 __pycache__
drwxr-sr-x 4 root staff 4096 Nov 28 01:40 applier
drwxr-sr-x 9 root staff 4096 Nov 28 01:40 data
-rw-r--r-- 1 root staff 6642 Nov 28 01:40 priority_decision.py
drwxr-sr-x 3 root staff 4096 Nov 28 01:40 rules
AND : ls -al /usr/local/lib/python3.7/site-packages/jyotisha/panchaanga/temporal/festival/data/
root@22771e1a4179:/src/panchangam/bin# ls -al /usr/local/lib/python3.7/site-packages/jyotisha/panchaanga/temporal/festival/data/
total 56
drwxr-sr-x 9 root staff 4096 Nov 28 04:33 .
drwxr-sr-x 6 root staff 4096 Nov 28 04:33 ..
-rw-r--r-- 1 root staff 79 Nov 28 04:33 .git
-rw-r--r-- 1 root staff 1203 Nov 28 04:33 .gitignore
-rw-r--r-- 1 root staff 1089 Nov 28 04:33 LICENSE
-rw-r--r-- 1 root staff 2249 Nov 28 04:33 README.md
drwxr-sr-x 14 root staff 4096 Nov 28 04:33 devatA
-rw-r--r-- 1 root staff 645 Nov 28 04:33 festivals_to_be_verified.json
drwxr-sr-x 3 root staff 4096 Nov 28 04:33 gRhya
drwxr-sr-x 5 root staff 4096 Nov 28 04:33 general
drwxr-sr-x 12 root staff 4096 Nov 28 04:33 mahApuruSha
drwxr-sr-x 5 root staff 4096 Nov 28 04:33 tamil
drwxr-sr-x 8 root staff 4096 Nov 28 04:33 temples
drwxr-sr-x 10 root staff 4096 Nov 28 04:33 time_focus
Hello,
I was trying to generate ical for Dehradun to use in our Gurukulam website but the command
./gen_ics.sh Dehradun 30:19:24 78:04:12 'Asia/Calcutta' 2018 devanagari
is giving following error.
Loaded pre-computed panchangam from /home/xxxxx/Documents/Dehradun-2018.json.
Traceback (most recent call last):
File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/xxxxx/django-apps/venv/lib/python3.5/site-packages/jyotisha/panchangam/scripts/ics.py", line 268, in <module>
main()
File "/home/xxxxx/django-apps/venv/lib/python3.5/site-packages/jyotisha/panchangam/scripts/ics.py", line 263, in main
ics_calendar = compute_calendar(panchangam)
File "/home/xxxxx/django-apps/venv/lib/python3.5/site-packages/jyotisha/panchangam/scripts/ics.py", line 201, in compute_calendar
jyotisha.custom_transliteration.tr(festival_rules[stext].get('shlokas'), panchangam.script, False) + '\n\n'
File "/home/xxxxx/django-apps/venv/lib/python3.5/site-packages/jyotisha/custom_transliteration.py", line 39, in tr
text = text.replace('~', '##~##') # Simple fix to prevent transliteration of ~
AttributeError: 'NoneType' object has no attribute 'replace'
error!
I am sure that I have installed all the needed packages and dependencies as I am able to generate daily and monthly view as PDF successfully. Although I had to do some minor changes in tex file before it could generate PDF.
Thanks for the helpful package.
Hi Karthik,
I tried to install the script and tried to run your code. I get this error:
/usr/bin/python3: No module named jyotisha.panchaanga.writer.tex.write_daily_panchaanga_tex
I am running this in centos 7. I installed a virtualBox with centos 7 machine. Now after installing packages like latex, python, other packages, I tried to install panchangam and jyothisha.
when I run:
./gen_daily_cal.sh Chennai 13:05:24 80:16:12 'Asia/Calcutta' 2017 devanagri lagna
I get the above mentioned error.
Would you be able to help me out here ?
Many thanks,
Balavelan
{'DataSource': <class 'sanskrit_data.schema.common.DataSource'>, 'JsonObject': <class 'sanskrit_data.schema.common.JsonObject'>, 'JsonObjectNode': <class 'sanskrit_data.schema.common.JsonObjectNode'>, 'NamedEntity': <class 'sanskrit_data.schema.common.NamedEntity'>, 'SchemaError': <class 'jsonschema.exceptions.SchemaError'>, 'ScriptRendering': <class 'sanskrit_data.schema.common.ScriptRendering'>, 'Target': <class 'sanskrit_data.schema.common.Target'>, 'TargetValidationError': <class 'sanskrit_data.schema.common.TargetValidationError'>, 'Text': <class 'sanskrit_data.schema.common.Text'>, 'UllekhanamJsonObject': <class 'sanskrit_data.schema.common.UllekhanamJsonObject'>, 'ValidationError': <class 'jsonschema.exceptions.ValidationError'>}
No precomputed data available. Computing panchangam...
Traceback (most recent call last):
File "/usr/local/Cellar/[email protected]/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/local/Cellar/[email protected]/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.8/site-packages/jyotisha/panchangam/scripts/write_daily_panchangam_tex.py", line 295, in <module>
main()
File "/usr/local/lib/python3.8/site-packages/jyotisha/panchangam/scripts/write_daily_panchangam_tex.py", line 283, in main
panchangam = jyotisha.panchangam.spatio_temporal.annual.get_panchangam(city=city, year=year, script=script, fmt=fmt, compute_lagnams=compute_lagnams, ayanamsha_id=swe.SIDM_TRUE_CITRA)
File "/usr/local/lib/python3.8/site-packages/jyotisha/panchangam/spatio_temporal/annual.py", line 31, in get_panchangam
panchangam = periodical.Panchangam(city=city, start_date='%d-01-01' % year, end_date='%d-12-31' % year, script=script, fmt=fmt, compute_lagnams=compute_lagnams, ayanamsha_id=ayanamsha_id)
File "/usr/local/lib/python3.8/site-packages/jyotisha/panchangam/spatio_temporal/periodical.py", line 54, in __init__
self.add_details(compute_lagnams=compute_lagnams)
File "/usr/local/lib/python3.8/site-packages/jyotisha/panchangam/spatio_temporal/periodical.py", line 1945, in add_details
self.compute_angams(compute_lagnams=compute_lagnams)
File "/usr/local/lib/python3.8/site-packages/jyotisha/panchangam/spatio_temporal/periodical.py", line 98, in compute_angams
daily_panchangam_start = daily.DailyPanchanga(city=self.city, year=prev_day_yy, month=prev_day_mm, day=prev_day_dd, ayanamsha_id=self.ayanamsha_id)
File "/usr/local/lib/python3.8/site-packages/jyotisha/panchangam/spatio_temporal/daily.py", line 48, in __init__
self.compute_sun_moon_transitions(previous_day_panchangam=previous_day_panchangam)
File "/usr/local/lib/python3.8/site-packages/jyotisha/panchangam/spatio_temporal/daily.py", line 120, in compute_sun_moon_transitions
self.tithi_data = temporal.get_angam_data(self.jd_sunrise, self.jd_next_sunrise, temporal.TITHI, ayanamsha_id=self.ayanamsha_id)
File "/usr/local/lib/python3.8/site-packages/jyotisha/panchangam/temporal/__init__.py", line 471, in get_angam_data
angam_now = get_angam(jd_sunrise, angam_type, ayanamsha_id=ayanamsha_id)
File "/usr/local/lib/python3.8/site-packages/jyotisha/panchangam/temporal/__init__.py", line 327, in get_angam
return int(1 + floor(get_angam_float(jd, angam_type, ayanamsha_id=ayanamsha_id)))
File "/usr/local/lib/python3.8/site-packages/jyotisha/panchangam/temporal/__init__.py", line 219, in get_angam_float
lmoon = (swe.calc_ut(jd, swe.MOON)[0] - swe.get_ayanamsa(jd)) % 360
TypeError: unsupported operand type(s) for -: 'tuple' and 'float'
How to create pdf with tamil font
incude bin i found .sh files
but not
write_daily_panchangam_tex.py
write_monthly_panchangam_tex.py
write_panchangam_ics.py
I am trying the following command and getting the error. Can you please help with what could be missing?
./gen_daily_txt.sh Ujjain 23:17:65 75:78:85 'Asia/Calcutta' 2020 devanagari 'hh:mm' lagna
Computing 2020 daily panchangam for Ujjain (23:17:65,75:78:85) - Asia/Calcutta in devanagari script...
DEBUG: 2019-09-14 13:40:37,055 {common.py:868}: {'DataSource': <class 'sanskrit_data.schema.common.DataSource'>, 'JsonObject': <class 'sanskrit_data.schema.common.JsonObject'>, 'JsonObjectNode': <class 'sanskrit_data.schema.common.JsonObjectNode'>, 'NamedEntity': <class 'sanskrit_data.schema.common.NamedEntity'>, 'SchemaError': <class 'jsonschema.exceptions.SchemaError'>, 'ScriptRendering': <class 'sanskrit_data.schema.common.ScriptRendering'>, 'Target': <class 'sanskrit_data.schema.common.Target'>, 'TargetValidationError': <class 'sanskrit_data.schema.common.TargetValidationError'>, 'Text': <class 'sanskrit_data.schema.common.Text'>, 'UllekhanamJsonObject': <class 'sanskrit_data.schema.common.UllekhanamJsonObject'>, 'ValidationError': <class 'jsonschema.exceptions.ValidationError'>}
No precomputed data available. Computing panchangam...
Writing computed panchangam to /Users/mohit/Documents/Ujjain-2020.json...
Traceback (most recent call last):
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.7/site-packages/jyotisha/panchangam/scripts/write_daily_panchangam_txt.py", line 395, in
main()
File "/usr/local/lib/python3.7/site-packages/jyotisha/panchangam/scripts/write_daily_panchangam_txt.py", line 383, in main
panchangam = jyotisha.panchangam.spatio_temporal.annual.get_panchangam(city=city, year=year, script=script, fmt=fmt, compute_lagnams=compute_lagnams)
File "/usr/local/lib/python3.7/site-packages/jyotisha/panchangam/spatio_temporal/annual.py", line 1672, in get_panchangam
panchangam.update_festival_details()
File "/usr/local/lib/python3.7/site-packages/jyotisha/panchangam/spatio_temporal/annual.py", line 1625, in update_festival_details
self.compute_festivals()
File "/usr/local/lib/python3.7/site-packages/jyotisha/panchangam/spatio_temporal/annual.py", line 1073, in compute_festivals
festival_rules = read_old_festival_rules_dict(os.path.join(CODE_ROOT, 'panchangam/temporal/festival/legacy/festival_rules.json'))
File "/usr/local/lib/python3.7/site-packages/jyotisha/panchangam/temporal/festival/init.py", line 581, in read_old_festival_rules_dict
with open(file_name, encoding="utf-8") as festivals_data:
FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.7/site-packages/jyotisha/panchangam/temporal/festival/legacy/festival_rules.json'
error!
I tried looking at the docs but couldn't find.
I want to calculate tithi etc from calendar date. is it possible using this repo?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.