Skip to content

Commit

Permalink
Before Matplotlib 3.3, the epoch was 0000-12-31, later it changes to …
Browse files Browse the repository at this point in the history
…1970-01-01 UTC
  • Loading branch information
LiangHuLiu committed Nov 7, 2024
1 parent 2109cdd commit 0898230
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Evaluate/interpolateTracks.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import numpy as np

from datetime import datetime, timedelta
from matplotlib.dates import num2date
from matplotlib.dates import num2date, date2num
from scipy.interpolate import interp1d, splev, splrep

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

newtime = np.arange(timestep[0], timestep[-1] + .01, delta)
newtime[-1] = timestep[-1]
_newtime = (newtime / 24.) + time_[0]
_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
newdates = num2date(_newtime)
newdates = np.array([n.replace(tzinfo=None) for n in newdates])

Expand Down

0 comments on commit 0898230

Please sign in to comment.