- edited description
netcdf4 v1.2.7 seems to break cfunits
Issue #5
closed
With the update of netcdf4 to v1.2.7, I am not longer able to import cfunits
,
>>> import cfunits
...
AttributeError: 'module' object has no attribute 'netcdftime'
Comments (9)
-
reporter -
I am also seeing this, more specifically:
Traceback (most recent call last): File "<string>", line 1, in <module> File "/usr/local/lib/python2.7/site-packages/cfunits/__init__.py", line 52, in <module> from .units import Units File "/usr/local/lib/python2.7/site-packages/cfunits/units.py", line 215, in <module> _DateFromNoLeapDay = netCDF4.netcdftime.netcdftime._DateFromNoLeapDay AttributeError: 'module' object has no attribute 'netcdftime'
I dug around in the netcdf4-python codebase and found that these functions (_DateFrom[...]) are now cython cdef and no longer callable from python. I don't see that cfunits uses them anywhere, they are just aliases. I think they can just be removed:
diff --git a/cfunits/units.py b/cfunits/units.py index f11ec76..4ae3f57 100644 --- a/cfunits/units.py +++ b/cfunits/units.py @@ -207,14 +207,6 @@ _cv_convert_array = {4: _cv_convert_floats, _netCDF4_netcdftime_utime = netCDF4.netcdftime.utime _datetime = netCDF4.netcdftime.datetime DateFromJulianDay = netCDF4.netcdftime.DateFromJulianDay -if netCDF4.__version__ <= '1.1.1': - _DateFromNoLeapDay = netCDF4.netcdftime._DateFromNoLeapDay - _DateFromAllLeap = netCDF4.netcdftime._DateFromAllLeap - _DateFrom360Day = netCDF4.netcdftime._DateFrom360Day -else: - _DateFromNoLeapDay = netCDF4.netcdftime.netcdftime._DateFromNoLeapDay - _DateFromAllLeap = netCDF4.netcdftime.netcdftime._DateFromAllLeap - _DateFrom360Day = netCDF4.netcdftime.netcdftime._DateFrom360Day
-
Any opinion on this? Also, it looks like netCDF4 changed this in v1.2.5 in case you want to conditionally keep them.
-
repo owner Hi Nathan, I'll look at this tomorrow. Thanks for diagnosing it,
David
-
repo owner I'm looking at this now .... thank you for your patience
-
repo owner New version 1.3.3 now in pypi. Should be ok.
Thanks
-
Thanks a lot, will check it out
-
reporter Works for me! Thanks!
-
repo owner - changed status to closed
- Log in to comment