Skip to content

Commit

Permalink
revert to using total_seconds (seems to be faster)
Browse files Browse the repository at this point in the history
  • Loading branch information
jswhit committed Jul 1, 2020
1 parent a6ad9ae commit db66129
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cftime/_cftime.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,9 @@ def date2num(dates,units,calendar='standard'):
# units are microseconds, use integer division
times.append(td // timedelta(microseconds=1) )
else:
times.append( (td / timedelta(microseconds=1)) / factor )
#times.append( (td.total_seconds()*1.e6) / factor )
#times.append( (td / timedelta(microseconds=1)) / factor )
# this appears to be faster.
times.append( (td.total_seconds()*1.e6) / factor )
n += 1
if ismasked: # convert to masked array if input was masked array
times = np.array(times)
Expand Down

0 comments on commit db66129

Please sign in to comment.