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

Fix kwargs used for extrapolation in docs #6639

Merged
merged 7 commits into from
Jun 1, 2022

Conversation

lstngr
Copy link
Contributor

@lstngr lstngr commented May 26, 2022

The current version of xarray tries to call scipy's interp1d whenever
possible, and kwargs used in the user guide should reflect this.

Closes #6617

Louis Stenger and others added 2 commits May 26, 2022 11:47
The current version of xarray tries to call scipy's interp1d whenever
possible, and kwargs used in the user guide should reflect this.

Fixes pydata#6617
@Illviljan
Copy link
Contributor

I wonder if the docstrings can be improved or do you think the docstrings for interp are clear about this?

@lstngr
Copy link
Contributor Author

lstngr commented May 26, 2022

Right now, the docstring only suggests different interpolation may be used depending on the input, but typically refers to "1-dimensional" vs "multi-dimensional" arrays.
I would do it this way:

  1. an extended summary is added, explaining when scipy.interpolate.interp1d or scipy.interpolate.interpnd are used,
  2. modify the parameters section to refer to arguments accepted when interp1d or interpnd is used.

Does that look alright to you?

@Illviljan
Copy link
Contributor

Sounds good to me!

Louis Stenger added 4 commits May 27, 2022 14:37
The extended summaries for Dataset.interp and DataArray.interp explain
how the scipy interpolator is selected
Explains how the scipy interpolator is chosen, similarly as done in
Dataset.interp and DataArray.interp
When scipy.interpolate.interp1d is called, it is possible to interpolate
with the polynomial method if the `order` kwarg is provided.
@lstngr
Copy link
Contributor Author

lstngr commented May 27, 2022

Hopefully this looks better: it now states that interp1d may be called when preforming multivariate interpolation.
Let me know if you think the extended summaries can be improved.

@lstngr
Copy link
Contributor Author

lstngr commented May 29, 2022

@pums974 You maybe have an opinion on the accuracy of this PR, since you originally implemented this behavior?

@Illviljan
Copy link
Contributor

@DoktorScience could you merge main and fix the conflicts? I think we can merge this afterwards.

@lstngr
Copy link
Contributor Author

lstngr commented May 31, 2022

Thank you for the heads-up @Illviljan. Should be good now

@pums974
Copy link
Contributor

pums974 commented May 31, 2022

Yep this look good to me too.
Thank you

@Illviljan Illviljan added the plan to merge Final call for comments label May 31, 2022
@dcherian
Copy link
Contributor

Thanks @DoktorScience and @pums974 !

@Illviljan Illviljan merged commit 3945342 into pydata:main Jun 1, 2022
@Illviljan
Copy link
Contributor

Merged, thanks @DoktorScience !

@lstngr lstngr deleted the feature/fix-interp-docs branch June 1, 2022 06:45
dcherian added a commit to dcherian/xarray that referenced this pull request Jun 12, 2022
* main: (95 commits)
  Use `zarr` to validate attrs when writing to zarr (pydata#6636)
  Add pre-commit hook to check CITATION.cff (pydata#6658)
  Fix kwargs used for extrapolation in docs (pydata#6639)
  Fix notebooks' HTML links (pydata#6655)
  Doc index update (pydata#6530)
  CFTime support for polyval (pydata#6624)
  Support dask arrays in datetime_to_numeric (pydata#6556)
  [pre-commit.ci] pre-commit autoupdate (pydata#6654)
  0-padded month. (pydata#6653)
  [test-upstream] import `cleanup` fixture from `distributed` (pydata#6650)
  Allow all interp methods in typing (pydata#6647)
  Typing support for custom backends (pydata#6651)
  Improved DataArray typing (pydata#6637)
  Adjust code comments & types from pydata#6638 (pydata#6642)
  Typing of `str` and `dt` accessors (pydata#6641)
  Feature/to dict encoding (pydata#6635)
  fix {full,zeros,ones}_like overloads (pydata#6630)
  Mypy badge (pydata#6626)
  concatenate docs style (pydata#6621)
  Typing for open_dataset/array/mfdataset and to_netcdf/zarr (pydata#6612)
  ...
@Illviljan Illviljan mentioned this pull request Jun 14, 2022
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plan to merge Final call for comments
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multi-dimensional extrapolation doesn't work
4 participants