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 CFTimeIndex enabled date_range function #2142

Closed
jhamman opened this issue May 16, 2018 · 1 comment · Fixed by #2301
Closed

add CFTimeIndex enabled date_range function #2142

jhamman opened this issue May 16, 2018 · 1 comment · Fixed by #2301

Comments

@jhamman
Copy link
Member

jhamman commented May 16, 2018

Pandas' date_range function is a fast and flexible way to create DateTimeIndex objects. Now that we have a functioning CFTimeIndex, it would be great to add a version of the date_range function that supports other calendars and dates out of range for Pandas.

Code Sampl and expected output

In [1]: import xarray as xr

In [2]: xr.date_range('2000-02-26', '2000-03-02')
Out[2]:
DatetimeIndex(['2000-02-26', '2000-02-27', '2000-02-28', '2000-02-29',
               '2000-03-01', '2000-03-02'],
              dtype='datetime64[ns]', freq='D')

In [3]: xr.date_range('2000-02-26', '2000-03-02', calendar='noleap')
Out[3]:
CFTimeIndex(['2000-02-26', '2000-02-27', '2000-02-28', '2000-03-01',
               '2000-03-02'],
              dtype='cftime.datetime', freq='D')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant