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 inclusive argument to cftime_range and date_range and deprecate closed argument #7373

Merged
merged 9 commits into from
Feb 6, 2023

Conversation

spencerkclark
Copy link
Member

@spencerkclark spencerkclark commented Dec 10, 2022

Following pandas, this PR adds an inclusive argument to xarray.cftime_range and xarray.date_range and deprecates the closed argument. Pandas will be removing the closed argument soon in their date_range implementation, but we will continue supporting it to allow for our own deprecation cycle.

I think we may also need to update our minimum pandas version to 1.4 for this, since earlier versions of pandas do not support the inclusive argument.

xarray/coding/cftime_offsets.py Outdated Show resolved Hide resolved
xarray/coding/cftime_offsets.py Show resolved Hide resolved
@keewis keewis mentioned this pull request Jan 23, 2023
1 task
@spencerkclark spencerkclark force-pushed the inclusive branch 3 times, most recently from 7a291c6 to a366269 Compare January 29, 2023 12:23
@spencerkclark spencerkclark marked this pull request as ready for review January 29, 2023 14:04
@spencerkclark
Copy link
Member Author

Thanks for the help @keewis and @dcherian. I think this should be ready for a full review.

@dcherian
Copy link
Contributor

/home/docs/checkouts/readthedocs.org/user_builds/xray/checkouts/7373/xarray/coding/cftime_offsets.py:docstring of xarray.coding.cftime_offsets.cftime_range:33: ERROR: Unexpected indentation.
/home/docs/checkouts/readthedocs.org/user_builds/xray/checkouts/7373/xarray/coding/cftime_offsets.py:docstring of xarray.coding.cftime_offsets.cftime_range:34: WARNING: Block quote ends without a blank line; unexpected unindent.

RTD failure is still real :(

Copy link
Contributor

@dcherian dcherian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks LGTM!

@spencerkclark
Copy link
Member Author

After debugging locally it looks like the remaining doc build failure was the result of a line I inadvertently deleted further down in the cftime_range docstring. It should be good now I think.

Copy link
Member Author

@spencerkclark spencerkclark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh and I guess it's February now, though, so I'm assuming these versions should change?

xarray/coding/cftime_offsets.py Outdated Show resolved Hide resolved
xarray/coding/cftime_offsets.py Outdated Show resolved Hide resolved
xarray/coding/cftime_offsets.py Outdated Show resolved Hide resolved
xarray/coding/cftime_offsets.py Outdated Show resolved Hide resolved
dcherian and others added 2 commits February 6, 2023 10:15
Co-authored-by: Spencer Clark <spencerkclark@gmail.com>
Co-authored-by: Spencer Clark <spencerkclark@gmail.com>
@dcherian dcherian enabled auto-merge (squash) February 6, 2023 17:15
@dcherian
Copy link
Contributor

dcherian commented Feb 6, 2023

Thanks @spencerkclark . I didn't realize we had the pandas copyright notice in cftime_offsets.py!

@dcherian dcherian merged commit fb748be into pydata:main Feb 6, 2023
dcherian added a commit to bzah/xarray that referenced this pull request Feb 28, 2023
* upstream/main: (291 commits)
  Update error message when saving multiindex (pydata#7475)
  DOC: cross ref the groupby tutorial (pydata#7555)
  [pre-commit.ci] pre-commit autoupdate (pydata#7543)
  supress namespace_package deprecation warning (doctests) (pydata#7548)
  [skip-ci] Add PDF of Xarray logo (pydata#7530)
  Support complex arrays in xr.corr (pydata#7392)
  clarification for thresh arg of dataset.dropna() (pydata#7481)
  [pre-commit.ci] pre-commit autoupdate (pydata#7524)
  Require to explicitly defining optional dimensions such as hue and markersize (pydata#7277)
  Use plt.rc_context for default styles (pydata#7318)
  Update HOW_TO_RELEASE.md (pydata#7512)
  Update whats-new for dev (pydata#7511)
  Fix whats-new for 2023.02.0 (pydata#7506)
  Update apply_ufunc output_sizes error message (pydata#7509)
  Zarr: drop "source" and  "original_shape" from encoding (pydata#7500)
  [pre-commit.ci] pre-commit autoupdate (pydata#7507)
  Whats-new for 2023.03.0
  Add `inclusive` argument to `cftime_range` and `date_range` and deprecate `closed` argument (pydata#7373)
  Make text match code example (pydata#7499)
  Remove Dask single-threaded setting in tests (pydata#7489)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FutureWarning for pandas date_range
3 participants