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

add dayofyear to CFTimeIndex #2597

Closed
rabernat opened this issue Dec 11, 2018 · 2 comments
Closed

add dayofyear to CFTimeIndex #2597

rabernat opened this issue Dec 11, 2018 · 2 comments

Comments

@rabernat
Copy link
Contributor

rabernat commented Dec 11, 2018

I have noticed that CFTimeIndex does not provide the .dayofyear attributes. Pandas DatetimeIndex does. Implementing these attributes would make certain grouping operations much easier on non-standard calendars.

Perhaps there are other similar attributes. I don't know if .dayofweek makes sense for non-standard calendars.

@shoyer
Copy link
Member

shoyer commented Dec 11, 2018

cftime.datetime already defines dayofwk and dayofyrattributes. We probably just need to add new aliases to CFTimeIndex:

year = _field_accessor('year', 'The year of the datetime')

@spencerkclark
Copy link
Member

Yes, the reason I neglected to add these earlier was that those attributes did not always work properly (e.g. Unidata/cftime#13). That's now been fixed upstream in cftime as of version 1.0.2 :).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants