def from_jd(jd):
jd += <NUM_LIT:0.5><EOL>z = trunc(jd)<EOL>a = z<EOL>b = a + <NUM_LIT><EOL>c = trunc((b - <NUM_LIT>) / <NUM_LIT>)<EOL>d = trunc(<NUM_LIT> * c)<EOL>e = trunc((b - d) / <NUM_LIT>)<EOL>if trunc(e < <NUM_LIT>):<EOL><INDENT>month = e - <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>month = e - <NUM_LIT><EOL><DEDENT>if trunc(month > <NUM_LIT:2>):<EOL><INDENT>year = c - <NUM_LIT><EOL><DEDENT>else:<EOL><INDENT>year = c - <NUM_LIT><EOL><DEDENT>day = b - d - trunc(<NUM_LIT> * e)<EOL>return (year, month, day)<EOL>
Calculate Julian calendar date from Julian day