def from_jd(jd):
start = <NUM_LIT><EOL>jd = trunc(jd) + <NUM_LIT:0.5><EOL>greg = gregorian.from_jd(jd)  <EOL>leap = isleap(greg[<NUM_LIT:0>])  <EOL>year = greg[<NUM_LIT:0>] - SAKA_EPOCH<EOL>greg0 = gregorian.to_jd(greg[<NUM_LIT:0>], <NUM_LIT:1>, <NUM_LIT:1>)<EOL>yday = jd - greg0  <EOL>if leap:<EOL><INDENT>Caitra = <NUM_LIT>  <EOL><DEDENT>else:<EOL><INDENT>Caitra = <NUM_LIT:30><EOL><DEDENT>if yday < start:<EOL><INDENT>year -= <NUM_LIT:1><EOL>yday += Caitra + (<NUM_LIT> * <NUM_LIT:5>) + (<NUM_LIT:30> * <NUM_LIT:3>) + <NUM_LIT:10> + start<EOL><DEDENT>yday -= start<EOL>if yday < Caitra:<EOL><INDENT>month = <NUM_LIT:1><EOL>day = yday + <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>mday = yday - Caitra<EOL>if (mday < (<NUM_LIT> * <NUM_LIT:5>)):<EOL><INDENT>month = trunc(mday / <NUM_LIT>) + <NUM_LIT:2><EOL>day = (mday % <NUM_LIT>) + <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>mday -= <NUM_LIT> * <NUM_LIT:5><EOL>month = trunc(mday / <NUM_LIT:30>) + <NUM_LIT:7><EOL>day = (mday % <NUM_LIT:30>) + <NUM_LIT:1><EOL><DEDENT><DEDENT>return (year, month, int(day))<EOL>
Calculate Indian Civil date from Julian day
    Offset in years from Saka era to Gregorian epoch