Skip to content

Commit

Permalink
more reliable conversion of time from xarray
Browse files Browse the repository at this point in the history
  • Loading branch information
scivision committed Jun 4, 2017
1 parent c30a0e0 commit e8caf46
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion sciencedates/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def timeticks(tdiff):
NOTE do NOT use "interval" or ticks are misaligned! use "bysecond" only!
"""
if isinstance(tdiff,xarray.DataArray): #len==1
tdiff = timedelta(microseconds=tdiff.item()/1e3)
tdiff = timedelta(seconds=tdiff.values/np.timedelta64(1,'s'))

assert isinstance(tdiff,timedelta),'expecting datetime.timedelta'

Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
try:
import conda.cli
conda.cli.main('install',*req)
except ImportError:
except ImportError:
pip.main(['install'] + req)
# %%
from setuptools import setup

setup(name='sciencedates',
packages=['sciencedates'],
version = '1.2.6',
version = '1.2.7',
description='Date conversions used in the sciences.',
author = 'Michael Hirsch, Ph.D.',
url = 'https://github.com/scivision/sciencedates',
Expand Down

0 comments on commit e8caf46

Please sign in to comment.