Skip to content

Commit

Permalink
Better fix to jday2date.
Browse files Browse the repository at this point in the history
  • Loading branch information
kshedstrom committed Dec 6, 2016
1 parent 508b6ef commit 8c4ac10
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions pycnal_toolbox/pycnal_toolbox/jday2date.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 8c4ac10

Please sign in to comment.