Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'module' object has no attribute 'date2num' #14

Closed
ocefpaf opened this issue Mar 17, 2015 · 2 comments
Closed

AttributeError: 'module' object has no attribute 'date2num' #14

ocefpaf opened this issue Mar 17, 2015 · 2 comments

Comments

@ocefpaf
Copy link
Member

ocefpaf commented Mar 17, 2015

While testing the docstrings I thing I found a bug here:

https://github.com/SciTools/cf_units/blob/master/units/unit.py#L637

date2num is in netcdftime.utime.date2num now, see Unidata/netcdf4-python@4d48266

@rhattersley should I fix this or pin a netcdftime version?

@pelson
Copy link
Member

pelson commented Mar 17, 2015

I think we need to manage the two for a period. I'm afraid it is going to have to look something like:

try:
    import netcdftime.utime.date2num as date2num
except ImportError:
    import netcdftime.date2num as date2num

Unless a more elegant solution can be found.

@ocefpaf
Copy link
Member Author

ocefpaf commented Mar 17, 2015

The utime class exists in all version. So I think we are good if we change the calls to netcdftime.date2num for

t = netcdftime.utime('hours since 0001-01-01 00:00:00', calendar='standard')
t.date2num(datetime.strptime('3/14/15 9:26:53', '%m/%d/%y %H:%M:%S'))

I will test that as soon as #13 gets merged.

@ocefpaf ocefpaf mentioned this issue Mar 18, 2015
pelson added a commit that referenced this issue Mar 31, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants