The whole concept of is based on the Hindu calendar system. The lunisolar Hindu calendar and its aspects are as old as , an ancient Sanskrit text on astronomy . Even today, this calendar is prevalent in India and it is mostly found in an Indian almanac that details information about the various festivals, rituals, and planetary combinations and has been in use since time immemorial in the Indian subcontinent. This Panchanga can be commonly found in most Indian homes .
The package aims to convert the commonly used Gregorian date-time to the Vedic date-time as per the calculations of the . Panchanga which means ‘five arms’ consists of the five most important parts - and . The or the day of the week is based on Sun alone; and are based upon Moon alone; and are based upon both Moon and Sun. This makes the Hindu calendar a true lunisolar calendar. contributes a new calendar system in R that can have huge potential to discover meaningful patterns in natural time series.
Before we get into calendar systems, we need to be clear with the concept of . The Earth revolves anti-clockwise around the Sun in an elliptical orbit. The time taken by the earth to arrive at one vernal equinox from the other vernal equinox after one revolution is called as . At the end of the tropical year if we consider the position of the Earth with respect to a fixed star in the zodiac, the Earth appears to lie 50.26 seconds of celestial longitude to the west of its original position. In order to arrive at the same position with respect to a fixed star in the zodiac, the time taken is called as . This is the result of precession of the Earth’s axis due to its wobble in clockwise direction. The precession of the equinoxes increases by 50.2 seconds every year. The distance between the Vernal equinox and the 1st point of Aries (Mesha) on the fixed zodiac is progressively increasing. The distance at any given point of time is called as .
We have two calendar systems– and . , also called as tropical calendars which means with . , also called as sidereal calendars which means without . The values can be found out by subtracting the from the values.
Each aspect (function) of the package is explained below. Each and every detail concerning each function is mentioned there and then.
can be called as a lunar day. When the moon traverses 12° in longitude relative to the sun, a tithi is completed. Fifteen tithis in the waxing phase () with end tithi as full moon day () and other fifteen tithis in the waning phase () with end tithi as new moon day (). These phases together constitute a lunar month which is of thirty tithis.
Tithi doesn’t require because it is the difference of longitudes and even if is subtracted from each longitude, it doesn’t matter .
At first, we take the as Julian’s day number and as the latitude, longitude, and time zone of the place for which the calculations are to be made as parameters of the function. The for the given date and place is found using another function which uses the to get the sunrise as a Julian day number. Tithi is found out during the sunrise as the difference between lunar and solar longitudes divided by 12. Tithi is generally obtained as a decimal number. The fractional part of the Tithi is used to find out the remaining degrees to the next Tithi which is used to find the time when that Tithi ends. The time taken to complete the remaining degrees is given by of the Tithis found by using the lunar and solar longitudes at the intervals of 0.25 days from sunrise. The obtained Tithi and its ending time are added to the output vector. Sometimes two Tithis can occur on a given date so, we check for skipped tithi by checking the Tithi of the next day and if a Tithi is skipped then, the skipped Tithi is included in the output with its ending time.
jd <- 2459778 #Julian day number
place <- c(15.34, 75.13, +5.5) #Latitude, Longitude and timezone of the location
tithi(jd, place)
#> [1] 20 20 55 37
In the above output, the first number represents the number associated with the respective Tithi. 20 represents . This tithi ends at which is represented by the rest of the numbers.
In the above output, 6 numbers are returned out of which the first 3 numbers represent the Tithi name and ending time of the first Tithi and the next 3 numbers represent the Tithi name and ending time of the second Tithi. Here, on , two Tithis had occurred - 18 which represents ending at and 19 which represents ending at on the next day .
The timings greater than 24:00 represents the time past midnight. The ending time of that Tithi in the next day can be obtained by subtracting 24 from the hours.
The Tithi number and ending date are obtained from the tithi function. The Tithi’s name associated with each Tithi number is returned with its ending time by this function.
The following are with their corresponding numbers -
#> [1] "1 - Shukla paksha prathama"
#> [1] "2 - Shukla paksha dvitiya"
#> [1] "3 - Shukla paksha trititya"
#> [1] "4 - Shukla paksha chaturthi"
#> [1] "5 - Shukla paksha panchami"
#> [1] "6 - Shukla paksha sashti"
#> [1] "7 - Shukla paksha saptami"
#> [1] "8 - Shukla paksha ashtami"
#> [1] "9 - Shukla paksha navami"
#> [1] "10 - Shukla paksha dashmi"
#> [1] "11 - Shukla paksha ekadashi"
#> [1] "12 - Shukla paksha dvadashi"
#> [1] "13 - Shukla paksha trayodashi"
#> [1] "14 - Shukla paksha chaturdashi"
#> [1] "15 - Poornima"
#> [1] "16 - Krishna paksha prathama"
#> [1] "17 - Krishna paksha dvitiya"
#> [1] "18 - Krishna paksha trititya"
#> [1] "19 - Krishna paksha chaturthi"
#> [1] "20 - Krishna paksha panchami"
#> [1] "21 - Krishna paksha sashti"
#> [1] "22 - Krishna paksha saptami"
#> [1] "23 - Krishna paksha ashtami"
#> [1] "24 - Krishna paksha navami"
#> [1] "25 - Krishna paksha dashmi"
#> [1] "26 - Krishna paksha ekadashi"
#> [1] "27 - Krishna paksha dvadashi"
#> [1] "28 - Krishna paksha trayodashi"
#> [1] "29 - Krishna paksha chaturdashi"
#> [1] "30 - Amavasya"
Get name(s) of the Tithi for given Julian day number and place.
Vaara for a given Julian day number
The above output represents 1 - Ravivara.
The following are with their corresponding numbers -
#> [1] "1 - Ravivar"
#> [1] "2 - Somvar"
#> [1] "3 - Mangalwar"
#> [1] "4 - Budhwar"
#> [1] "5 - Guruwar"
#> [1] "6 - Shukrawar"
#> [1] "7 - Shaniwar"
Get name of the Vaara for given Julian day number.
The absolute longitude of the Moon is used to calculate the Nakshatra of the day. This requires to be subtracted from the moon’s tropical () longitude to get its sidereal () longitude which can be used to find out the nakshatra.
The which is obtained from the and is set to . as Julian’s day number and the as latitude, longitude, and time zone are passed as arguments of the function. The for the given date and place is found using the sunrise function which uses the to get the sunrise as a Julian day number. The of the is obtained by subtracting the from its . The of moon is multiplied by 27 and then divided by 360 to get Nakshatra as a decimal number. The ending time of this Nakshatra is obtained by checking for the starting time of the next Nakshatra using of Nirayana lunar longitudes at 0.25 intervals of day. Nakshatra and its ending time are added to the output vector. Sometimes two Nakshatras can occur on a given date so, we check for skipped Nakshatra by checking the Nakshatra of the next day and if a Nakshatra is skipped then, the skipped Nakshatra is included in the output with its ending time.
Nakshatra for given date and place.
jd <- 2459778 #Julian day number
place <- c(15.34, 75.13, +5.5) #Latitude, Longitude and timezone of the location
nakshatra(jd, place)
#> [1] 25 24 24 3
In the above output, the first number represents the number associated with the respective Nakshatra. 25 represents . This Nakshatra ends on the next day at which is represented by the rest of the numbers.
In the above output, the first number represents the number associated with the respective Nakshatra. 21 represents . This Nakshatra ends at which is represented by the rest of the numbers.
The following are with their corresponding numbers -
#> [1] "1 - Ashwini"
#> [1] "2 - Bharani"
#> [1] "3 - Kritika"
#> [1] "4 - Rohini"
#> [1] "5 - Mrigashira"
#> [1] "6 - Ardra"
#> [1] "7 - Punarvasu"
#> [1] "8 - Pushya"
#> [1] "9 - Ashlesha"
#> [1] "10 - Magha"
#> [1] "11 - Purvaphalguni"
#> [1] "12 - Uttaraphalguni"
#> [1] "13 - Hasta"
#> [1] "14 - Chitra"
#> [1] "15 - Swati"
#> [1] "16 - Vishakha"
#> [1] "17 - Anuradha"
#> [1] "18 - Jyeshta"
#> [1] "19 - Mula"
#> [1] "20 - Purvashada"
#> [1] "21 - Uttarashada"
#> [1] "22 - Shravana"
#> [1] "23 - Dhanishta"
#> [1] "24 - Shatabhisha"
#> [1] "25 - Purvabhadrapada"
#> [1] "26 - Uttarabhadrapada"
#> [1] "27 - Revati"
Get name(s) of the Nakshatra for given Julian day number and place.
The which is obtained from the and is set to . as Julian’s day number and the as latitude, longitude, and time zone are passed as arguments of the function. The for the given date and place is found using the sunrise function which uses the to get the sunrise as a Julian day number. The longitudes of the sun and moon are obtained by subtracting from their . The sum of of and is obtained and their mod 360 is performed so that the sum does not exceed 360. The resulting sum is multiplied by 27 and then divided by 360 to get Yoga as a decimal number. The fractional part of the Yoga is used to find out the remaining degrees to the next Yoga which is used to find the time when that Yoga ends. The time taken to complete the remaining degrees is given by of the Yoga found by using the lunar and solar longitudes at the intervals of 0.25 days from sunrise. The obtained Yoga and its ending time are added to the output vector. Sometimes two Yogas can occur on a given date so, we check for skipped Yoga by checking the Yoga of the next day and if a Yoga is skipped then, the skipped Yoga is included in the output with its ending time.
Yoga for given date and place.
jd <- 2459778 #Julian day number
place <- c(15.34, 75.13, +5.5) #Latitude, Longitude and timezone of the location
yoga(jd, place)
#> [1] 5 27 26 14
In the above output, the first number represents the number associated with the respective Yoga. 5 represents . This Yoga ends on the next day at which is represented by the rest of the numbers.
In the above output, the first number represents the number associated with the respective Yoga. 26 represents . This Yoga ends at which is represented by the rest of the numbers.
The following are with their corresponding numbers -
#> [1] "1 - Vishkhamba"
#> [1] "2 - Preeti"
#> [1] "3 - Ayushmaan"
#> [1] "4 - Saubhaagya"
#> [1] "5 - Sobhana"
#> [1] "6 - Atiganda"
#> [1] "7 - Sukarman"
#> [1] "8 - Dhriti"
#> [1] "9 - Shoola"
#> [1] "10 - Ganda"
#> [1] "11 - Vriddhi"
#> [1] "12 - Dhruva"
#> [1] "13 - Vyaaghaata"
#> [1] "14 - Harshana"
#> [1] "15 - Vajra"
#> [1] "16 - Siddhi"
#> [1] "17 - Vyatipaata"
#> [1] "18 - Variyan"
#> [1] "19 - Parigha"
#> [1] "20 - Shiva"
#> [1] "21 - Siddha"
#> [1] "22 - Saadhya"
#> [1] "23 - Subha"
#> [1] "24 - Sukla"
#> [1] "25 - Brahma"
#> [1] "26 - Indra"
#> [1] "27 - Vaidhriti"
Get name(s) of the Yoga for given Julian day number and place.
A is half of a tithi or when the moon traverses 6° in longitude relative to the sun. In of a lunar month, there are 60 or half-tithis.
karana <- function(jd, place) {
tithi_ = tithi(jd, place)
answer <- c((tithi_[1] * 2) - 1, tithi_[1] * 2)
return(answer)
}
To find out Karana for a given date and place where, is given as a and as latitude, longitude and time zone. Date and place are passed to the Tithi function which finds out the Tithi(s). This Tithis are used to output corresponding Karnas.
There are that occur in a lunar month. They are the fixed Karanas and called as:
1.: assigned to the latter half of the 14th day of .
2.: assigned to the first half of the Amavasya (15th day of ).
3.: assigned to the latter half of the .
4.: assigned to the first half of the first day of the .
The remaining recur during rest of the lunar month. Their names are:
These Karanas recur in regular order starting from the second half of the first day of until the first half of the 14th day of the .
Karana for given date and place.
jd <- 2459778 #Julian day number
place <- c(15.34, 75.13, +5.5) #Latitude, Longitude and timezone of the location
karana(jd, place)
#> [1] 39 40
The above pair of numbers represent these Karanas - “Kaulava-Taitila”.
The above pair of numbers represent these Karanas - “Vanija-Visti”.
The zodiac is divided into 12 parts - Aries (), Taurus (), Gemini (), Cancer (), Leo (), Virgo (), Libra (), Scorpio (), Sagittarius (), Capricorn (), Aquarius (), and Pisces ().
(moon sign) represents the position of the moon on the zodiac at a given time.
rashi <- function(jd) {
swe_set_sid_mode(SE$SIDM_LAHIRI, 0, 0)
s = moon_longitude(jd)
lunar_nirayana = (moon_longitude(jd) - swe_get_ayanamsa_ex_ut(jd,
SE$FLG_SWIEPH + SE$FLG_NONUT)$daya)%%360
return(ceiling(lunar_nirayana/30))
}
The is set to and the lunar longitude(tropical) is obtained for the given date which is taken as the Julian day number. The sidereal () longitude of the moon is calculated by subtracting the Ayanamsa from the obtained tropical longitude then a mod of 360 is performed to ensure that it doesn’t exceed 360 and the result is divided by 30 to obtain Rashi as an integer.
Rashi(Moon-sign) for a given Julian day number -
The following are with their corresponding numbers -
#> [1] "1 - Mesha"
#> [1] "2 - Vrushabha"
#> [1] "3 - Mithuna"
#> [1] "4 - Karka"
#> [1] "5 - Sinha"
#> [1] "6 - Kanya"
#> [1] "7 - Tula"
#> [1] "8 - Vrushchik"
#> [1] "9 - Dhanu"
#> [1] "10 - Makara"
#> [1] "11 - Kumbha"
#> [1] "12 - Meena"
Gives name of the Rashi(Sun-sign) for a given Julian day number
lagna <- function(jd) {
swe_set_sid_mode(SE$SIDM_LAHIRI, 0, 0)
s = sun_longitude(jd)
solar_nirayana = (sun_longitude(jd) - swe_get_ayanamsa_ex_ut(jd,
SE$FLG_SWIEPH + SE$FLG_NONUT)$daya)%%360
return(ceiling(solar_nirayana/30))
}
The is set to and the solar longitude(tropical) is obtained for the given date which is taken as the Julian day number. The sidereal () longitude of the sun is calculated by subtracting the Ayanamsa from the obtained tropical longitude then a mod of 360 is performed to ensure that it doesn’t exceed 360 and the result is divided by 30 to obtain Lagna as an integer.
Lagna(sun-sign) for a given Julian day number -
is the lunar month in the Vedic calendar system. The year as per the Hindu calendar starts from and ends at . Every masa has a fixed number of . A Masa has ( and ) - in total.
doesn’t begin on the 1st January of the Gregorian calendar. It rather begins on ( or Hindu new year) which starts when (New moon) of the ends.
In one year, the number of Masas is not fixed as there can be 12 or 13 Masas in it. When the number of Tithis in a Masa is fixed, to compensate for the remaining days (Like in the Gregorian calendar which has 28-31 days in a month) an intercalary month is added every 32.5 months. This extra masa is called . It is usually referred by adding a suffix of its previous masa like – . It can occur between any two Masas but, it follows a regular interval of 32.5 months.
As there is the lunar year with the extra month (), so it there a lunar year with a diminished or reduced month, with only eleven months only is very rare indeed. It occurs once in 140 years or once in 190 years it is called or Lost Month.
masa <- function(jd, place) {
# Masa as -> 1 = Chaitra, 2 = Vaisakha, ..., 12 =
# Phalguna
ti = tithi(jd, place)[1]
critical = sunrise(jd, place)[1]
last_new_moon = new_moon(critical, ti, -1)
next_new_moon = new_moon(critical, ti, +1)
this_solar_month = lagna(last_new_moon)
next_solar_month = lagna(next_new_moon)
is_leap_month = (this_solar_month == next_solar_month)
maasa = this_solar_month + 1
if (maasa > 12) {
maasa = maasa%%12
}
return(c(as.integer(maasa), is_leap_month))
}
At first, the and sunrise of the given date and place is obtained then, the previous and next new moon is obtained from the given date and calculated . The sun sign() for the previous and next new moon day is obtained. If these two sun-signs are same then the Masa is . The masa number is one added to the sun sign of this month. Its mod 12 is returned so that it does not exceed 12.
Masa for a given place and time.
The following are with their corresponding numbers -
#> [1] "1 - Chaitra"
#> [1] "2 - Vaishakha"
#> [1] "3 - Jyeshtha"
#> [1] "4 - Ashada"
#> [1] "5 - Shravana"
#> [1] "6 - Bhadrapada"
#> [1] "7 - Ashvija"
#> [1] "8 - Kartika"
#> [1] "9 - Margashira"
#> [1] "10 - Pushya"
#> [1] "11 - Maagha"
#> [1] "12 - Phalguna"
Get name of the Masa for given Julian day number and place.
means . There are 6 Ritus which represent the 6 seasons. The year starts from which is the spring season and ends at which is the winter season.
The following are the Ritus , seasons they represent and their respective Masas -
Returns the number associated with Ritu from a Masa.
The following are with their corresponding numbers -
#> [1] "1 - Vasanta"
#> [1] "2 - Grishma"
#> [1] "3 - Varsha"
#> [1] "4 - Sharad"
#> [1] "5 - Hemanta"
#> [1] "6 - Sishira"
Returns Ritu’s name from a Masa.
means in . It is a cycle of 60 Samvatsaras in Hindu Panchang which is of 60 years. There are different types of Samvatsaras based on the point which is considered as their starting point. , the epoch of which corresponds to Julian year 78 and which is ahead of by 135 years are some of the commonly used calendar systems.
ahargana <- function(jd) {
return(jd - 588465.5)
}
elapsed_year <- function(jd, maasa_num) {
sidereal_year = 365.25636
ahar = ahargana(jd)
kali = as.integer((ahar + (4 - maasa_num) * 30)/sidereal_year)
saka = kali - 3179
vikrama = saka + 135
return(c(kali, saka, vikrama))
}
samvatsara <- function(jd, maasa_num) {
kali = elapsed_year(jd, maasa_num)[1]
if (kali >= 4009) {
kali = (kali - 14)%%60
}
samvat = (kali + 27 + as.integer((kali * 211 - 108)/18000))%%60
return(samvat)
}
Returns number associated with the name of the Shaka Samvatsar for a given Julian day number and maasa number.
The following are with their corresponding numbers -
#> [1] "1 - Prabhava"
#> [1] "2 - Vibhava"
#> [1] "3 - Sukla"
#> [1] "4 - Pramoda"
#> [1] "5 - Prajapati"
#> [1] "6 - Angirasa"
#> [1] "7 - Srimukha"
#> [1] "8 - Bhava"
#> [1] "9 - Yuva"
#> [1] "10 - Dhatri"
#> [1] "11 - Ishvara"
#> [1] "12 - Bahudhanya"
#> [1] "13 - Pramadhi"
#> [1] "14 - Vikrama"
#> [1] "15 - Vrushapraja"
#> [1] "16 - Citrabhanu"
#> [1] "17 - Subhanu"
#> [1] "18 - Tarana"
#> [1] "19 - Parthiva"
#> [1] "20 - Vyaya"
#> [1] "21 - Sarvajit"
#> [1] "22 - Sarvadharin"
#> [1] "23 - Virodhin"
#> [1] "24 - Vikriti"
#> [1] "25 - Khara"
#> [1] "26 - Nandana"
#> [1] "27 - Vijaya"
#> [1] "28 - Jaya"
#> [1] "29 - Manmatha"
#> [1] "30 - Durmukhi"
#> [1] "31 - Hevilambi"
#> [1] "32 - Vilambi"
#> [1] "33 - Vikari"
#> [1] "34 - Sharvari"
#> [1] "35 - Plava"
#> [1] "36 - Shubhakrit"
#> [1] "37 - Shobhakrit"
#> [1] "38 - Krodhi"
#> [1] "39 - Vishvavasu"
#> [1] "40 - Parabhava"
#> [1] "41 - Plavanga"
#> [1] "42 - Kilaka"
#> [1] "43 - Saumya"
#> [1] "44 - Sadharana"
#> [1] "45 - Virodhakruta"
#> [1] "46 - Paridhavi"
#> [1] "47 - Pramadi"
#> [1] "48 - Ananda"
#> [1] "49 - Rakshasa"
#> [1] "50 - Nala"
#> [1] "51 - Pingala"
#> [1] "52 - Kalayukta"
#> [1] "53 - Siddharti"
#> [1] "54 - Raudra"
#> [1] "55 - Durmati"
#> [1] "56 - Dundubhi"
#> [1] "57 - Rudhirodhgari"
#> [1] "58 - Raktakshi"
#> [1] "59 - Krodhana"
#> [1] "60 - Akshaya"
Returns the name of the Shaka Samvatsar for a given Julian day number and maasa number.
The following functions use the functions of to return results.
Convert Gregorian date to Julian day number at 00:00 UTC
Convert Julian day number to Gregorian date
Get Solar longitude for a given Julian day number.
Get Lunar longitude for a given Julian day number.
Sunrise for a given date and place.
Sunset for a given date and place.
Moonrise for a given date and place.