Skip to content

Commit 1a62f38

Browse files
committed
Explicit Int64 assignment for datetime
The datetime functions added to support numba in commit e5d64a1 required that integers input into these functions are 64bits or year information will be lost during bit manipulations. The previous implementation left integer type up to numba and in some instances could produce a in32 object. This commit causes integer conversion to be explicitly int64 so that year information is not lost.
1 parent 677adaa commit 1a62f38

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"ExpandedNodes": [
3+
""
4+
],
5+
"SelectedNode": "\\readWDM.py",
6+
"PreviewInSolutionExplorer": false
7+
}

HSP2tools/readWDM.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,10 @@ def readWDM(wdmfile, hdffile, compress_output=True):
150150

151151
@njit
152152
def _splitdate(x):
153-
year = int(x >> 14)
154-
month = int(x >> 10 & 0xF)
155-
day = int(x >> 5 & 0x1F)
156-
hour = int(x & 0x1F)
153+
year = np.int64(x >> 14)
154+
month = np.int64(x >> 10 & 0xF)
155+
day = np.int64(x >> 5 & 0x1F)
156+
hour = np.int64(x & 0x1F)
157157
return correct_date(year, month, day, hour, 0,0)
158158

159159
@njit

0 commit comments

Comments
 (0)