Skip to content

Commit 0898230

Browse files
author
LiangHuLiu
committed
Before Matplotlib 3.3, the epoch was 0000-12-31, later it changes to 1970-01-01 UTC
1 parent 2109cdd commit 0898230

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Evaluate/interpolateTracks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import numpy as np
44

55
from datetime import datetime, timedelta
6-
from matplotlib.dates import num2date
6+
from matplotlib.dates import num2date, date2num
77
from scipy.interpolate import interp1d, splev, splrep
88

99
from Utilities.maputils import latLon2Azi
@@ -95,7 +95,7 @@ def interpolate(track, delta, interpolation_type=None):
9595

9696
newtime = np.arange(timestep[0], timestep[-1] + .01, delta)
9797
newtime[-1] = timestep[-1]
98-
_newtime = (newtime / 24.) + time_[0]
98+
_newtime = (newtime / 24.) + time_[0] + date2num(np.datetime64('0000-12-31')) # Before Matplotlib 3.3, the epoch was 0000-12-31, later it changes to 1970-01-01 UTC
9999
newdates = num2date(_newtime)
100100
newdates = np.array([n.replace(tzinfo=None) for n in newdates])
101101

0 commit comments

Comments
 (0)