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

iris.coord_categorisation.add_weekday() fails with cftime v1.1.1 #3686

Closed
TheElectricFlock opened this issue Mar 16, 2020 · 1 comment · Fixed by #3687
Closed

iris.coord_categorisation.add_weekday() fails with cftime v1.1.1 #3686

TheElectricFlock opened this issue Mar 16, 2020 · 1 comment · Fixed by #3687

Comments

@TheElectricFlock
Copy link

iris.coord_categorisation.add_weekday() fails with cftime v1.1.1, the latest cftime release. Provided below is a traceback error.
>>> import iris
>>> import iris.coord_categorisation
>>> from glob import glob
>>> fnames = glob('/project/champ/data/cmip5/output1/ICHEC/EC-EARTH/historical/mon/atmos/Amon/r1i1p1/v20131231/tas/*.nc')
>>> cube = iris.load_cube(fnames[0])
>>> iris.coord_categorisation.add_weekday(cube, 'time', name='weekday')
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/h01/jbedwell/miniconda/envs/test_environment/lib/python3.6/site-packages/iris/coord_categorisation.py", line 208, in add_weekday units='no_unit') File "/home/h01/jbedwell/miniconda/envs/test_environment/lib/python3.6/site-packages/iris/coord_categorisation.py", line 79, in add_categorised_coord result = category_function(from_coord, from_coord.points.ravel()[0]) File "/home/h01/jbedwell/miniconda/envs/test_environment/lib/python3.6/site-packages/iris/coord_categorisation.py", line 207, in <lambda> lambda coord, x: calendar.day_abbr[_pt_date(coord, x).weekday()], AttributeError: 'cftime._cftime.DatetimeGregorian' object has no attribute 'weekday'

@trexfeathers
Copy link
Contributor

I can confirm this is replicable when running the test suite in Travis CI. Will investigate a fix (pinning or otherwise)

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

Successfully merging a pull request may close this issue.

2 participants