From 8c4ac10fe8b95330506523c7e19bd0ae2797bdd7 Mon Sep 17 00:00:00 2001 From: Kate Hedstrom Date: Mon, 5 Dec 2016 16:58:38 -0900 Subject: [PATCH] Better fix to jday2date. --- pycnal_toolbox/pycnal_toolbox/jday2date.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pycnal_toolbox/pycnal_toolbox/jday2date.py b/pycnal_toolbox/pycnal_toolbox/jday2date.py index 019dae8..1b16630 100644 --- a/pycnal_toolbox/pycnal_toolbox/jday2date.py +++ b/pycnal_toolbox/pycnal_toolbox/jday2date.py @@ -22,18 +22,18 @@ def jday2date(jday): for t in range(nt): j = int(np.floor(jday[t])) + 32044 + jd0 - g = int(j / 146097) + g = j // 146097 dg = j % 146097 - c = int((dg / 36524 + 1) * 3 / 4) + c = (dg // 36524 + 1) * 3 // 4 dc = dg - c * 36524 - b = int(dc / 1461) + b = dc // 1461 db = dc % 1461 - a = int((db / 365 + 1) * 3 / 4) + a = (db // 365 + 1) * 3 // 4 da = db - a * 365 y = g * 400 + c * 100 + b * 4 + a - m = int((da * 5 + 308) / 153 - 2) - d = int(da - (m + 4) * 153 / 5 + 122) - Y = int(y - 4800 + (m + 2) / 12) + m = (da * 5 + 308) // 153 - 2 + d = da - (m + 4) * 153 // 5 + 122 + Y = y - 4800 + (m + 2) // 12 M = (m + 2) % 12 + 1 D = d + 1