def get(self, offset, year, month, day, hour, minute, second, body): from jyotisha import zodiac (utc_year, utc_month, utc_day, utc_hour, utc_minute, utc_second) = swe.utc_time_zone(year=year, month=month, day=day, hour=hour, minutes=minute, seconds=second, offset=float(offset)) julday = swe.utc_to_jd(year=utc_year, month=utc_month, day=utc_day, hour=utc_hour, minutes=utc_minute, seconds=utc_second, flag=swe.GREG_CAL)[0] body_id = get_body_id(body_name=body) from jyotisha.panchangam import temporal transits = temporal.get_planet_next_transit(jd_start=julday, jd_end=julday + 100, planet=body_id) # logging.debug(transits) transits_utc = [(swe.jdut1_to_utc(ut=transit[0], flag=swe.GREG_CAL), transit[1], transit[2]) for transit in transits] transits_local = [(swe.utc_time_zone(year=transit[0][0], month=transit[0][1], day=transit[0][2], hour=transit[0][3], minutes=transit[0][4], seconds=int(transit[0][5]), offset=-float(offset)), transit[1], transit[2]) for transit in transits_utc] return str(transits_local)
def get(self, offset, year, month, day, hour, minute, second): (utc_year, utc_month, utc_day, utc_hour, utc_minute, utc_second) = swe.utc_time_zone(year, month, day, hour, minute, second, float(offset)) julday = swe.utc_to_jd(year=utc_year, month=utc_month, day=utc_day, hour=utc_hour, minutes=utc_minute, seconds=utc_second, flag=swe.GREG_CAL)[0] from jyotisha.panchangam import temporal raashi = temporal.get_solar_rashi(jd=julday) logging.info(raashi) return str(raashi)
def get(self, body, offset, year, month, day, hour, minute, second): from jyotisha import zodiac (utc_year, utc_month, utc_day, utc_hour, utc_minute, utc_second) = swe.utc_time_zone(year, month, day, hour, minute, second, float(offset)) julday = swe.utc_to_jd(year=utc_year, month=utc_month, day=utc_day, hour=utc_hour, minutes=utc_minute, seconds=utc_second, flag=swe.GREG_CAL)[0] lahiri_nakshatra_division = zodiac.NakshatraDivision(julday=julday) body_id = get_body_id(body_name=body) if body == "moon": from jyotisha.panchangam import temporal logging.debug(temporal.get_nakshatram(julday)) nakshatra = lahiri_nakshatra_division.get_nakshatra(body_id=body_id) logging.info(nakshatra) return str(nakshatra)
def julian_day_to_local_time(self, julian_day, round_seconds=False): [y, m, dt, time_in_hours] = swe.revjul(julian_day) (hours, minutes, seconds) = decypher_fractional_hours(time_in_hours=time_in_hours) local_time = swe.utc_time_zone( y, m, dt, hours, minutes, seconds, -self.get_timezone_offset_hours_from_date( y, m, dt, hours, minutes, seconds)) if round_seconds: (y, m, dt, hours, minutes, seconds) = local_time local_time = (y, m, dt, hours, minutes, int(round(seconds))) local_time = temporal.sanitize_time(*local_time) return local_time
def local_time_to_jdut1(year, month, day, hour=0, minutes=0, seconds=0, timezone=0.0): """Converts local time to JD(UT1)""" y, m, d, h, mnt, s = swe.utc_time_zone(year, month, day, hour, minutes, seconds, timezone) # BUG in pyswisseph: replace 0 by s jd_et, jd_ut1 = swe.utc_to_jd(y, m, d, h, mnt, 0, flag=swe.GREG_CAL) return jd_ut1
def local_time_to_julian_day(self, year, month, day, hours, minutes, seconds): offset_hours = self.get_timezone_offset_hours_from_date( year=year, month=month, day=day, hour=hours, minute=minutes, seconds=seconds) (year_utc, month_utc, day_utc, hours_utc, minutes_utc, seconds_utc) = swe.utc_time_zone(year, month, day, hours, minutes, seconds, offset_hours) julian_dates = swe.utc_to_jd(year_utc, month_utc, day_utc, hours_utc, minutes_utc, seconds_utc, 1) return julian_dates[1]
def julian_day_to_local_time(self, julian_day): [y, m, dt, time_in_hours] = swe.revjul(julian_day) (hours, minutes, seconds) = decypher_fractional_hours(time_in_hours=time_in_hours) local_time = swe.utc_time_zone(y, m, dt, hours, minutes, seconds, -self.get_timezone_offset_hours_from_jd(julian_day)) return local_time
def local_time_to_jdut1(year, month, day, hour = 0, minutes = 0, seconds = 0, timezone = 0.0): """Converts local time to JD(UT1)""" y, m, d, h, mnt, s = swe.utc_time_zone(year, month, day, hour, minutes, seconds, timezone) # BUG in pyswisseph: replace 0 by s jd_et, jd_ut1 = swe.utc_to_jd(y, m, d, h, mnt, 0, flag = swe.GREG_CAL) return jd_ut1