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 multi-dimensional extrapolation example and mention different behavior of kwargs in interp #3956

Merged
merged 3 commits into from
Apr 18, 2020

Conversation

matrss
Copy link
Contributor

@matrss matrss commented Apr 8, 2020

This corrects an error in the documentation of using interp to extrapolate. Apparently the argument fill_value changed at some point and now uses None instead of 'extrapolate' to indicate that extrapolation should be done.

@dcherian
Copy link
Contributor

dcherian commented Apr 8, 2020

Can you add a note explicitly mentioning that change in scipys API?

@matrss
Copy link
Contributor Author

matrss commented Apr 8, 2020

Ok, I should have looked into this some more, my bad. The problem here is that scipy's interp1d and interpn accept different values for fill_value, and I blindly assumed they would use the same. The option 'extrapolate' does work for interp1d, while interpn emits a ValueError in that case and needs None to extrapolate. On the other hand, interp1d with fill_value=None does not extrapolate.

Maybe a note on the kwargs parameter of interp mentioning that scipy's interpolation functions accept different arguments and a example of multi-dimensional extrapolation would be the way to go here?

@dcherian
Copy link
Contributor

dcherian commented Apr 8, 2020

Sure

@dcherian
Copy link
Contributor

Thanks @Risebell . It'd be nice to open a scipy issue asking them to make their API consistent.

@dcherian
Copy link
Contributor

Also please add a note to whats-new taking credit for this contribution

@matrss matrss changed the title Fix documentation for extrapolation to reflect changes in scipy Add multi-dimensional extrapolation example and mention different behavior of kwargs in interp Apr 14, 2020
@matrss
Copy link
Contributor Author

matrss commented Apr 14, 2020

Sorry for the delay. I added a note to whats-new and updated the title of the PR to reflect what's actually done with this. I also opened an issue with scipy over at scipy/scipy#11853.

@dcherian
Copy link
Contributor

Thanks @Risebell

@dcherian dcherian merged commit 6a6f2c8 into pydata:master Apr 18, 2020
@max-sixty
Copy link
Collaborator

Thanks @Risebell !

dcherian added a commit to dcherian/xarray that referenced this pull request May 1, 2020
* upstream/master: (39 commits)
  Pint support for DataArray (pydata#3643)
  Apply blackdoc to the documentation (pydata#4012)
  ensure Variable._repr_html_ works (pydata#3973)
  Fix handling of abbreviated units like msec (pydata#3998)
  full_like: error on non-scalar fill_value (pydata#3979)
  Fix some code quality and bug-risk issues (pydata#3999)
  DOC: add pandas.DataFrame.to_xarray (pydata#3994)
  Better chunking error messages for zarr backend (pydata#3983)
  Silence sphinx warnings (pydata#3990)
  Fix distributed tests on upstream-dev (pydata#3989)
  Add multi-dimensional extrapolation example and mention different behavior of kwargs in interp (pydata#3956)
  keep attrs in interpolate_na (pydata#3970)
  actually use preformatted text in the details summary (pydata#3978)
  facetgrid: Ensure that colormap params are only determined once. (pydata#3915)
  RasterioDeprecationWarning (pydata#3964)
  Empty line missing for DataArray.assign_coords doc (pydata#3963)
  New coords to existing dim (doc) (pydata#3958)
  implement a more threadsafe call to colorbar (pydata#3944)
  Fix wrong order of coordinate converted from pd.series with MultiIndex (pydata#3953)
  Updated list of core developers (pydata#3943)
  ...
dcherian added a commit to kmuehlbauer/xarray that referenced this pull request May 9, 2020
…k-issues

* upstream/master: (22 commits)
  support darkmode (pydata#4036)
  Use literal syntax instead of function calls to create the data structure (pydata#4038)
  Add template xarray object kwarg to map_blocks (pydata#3816)
  Transpose coords by default (pydata#3824)
  Remove broken test for Panel with to_pandas() (pydata#4028)
  Allow warning with cartopy in docs plotting build (pydata#4032)
  Support overriding existing variables in to_zarr() without appending (pydata#4029)
  chore: Remove unnecessary comprehension (pydata#4026)
  fix to_netcdf docstring typo (pydata#4021)
  Pint support for DataArray (pydata#3643)
  Apply blackdoc to the documentation (pydata#4012)
  ensure Variable._repr_html_ works (pydata#3973)
  Fix handling of abbreviated units like msec (pydata#3998)
  full_like: error on non-scalar fill_value (pydata#3979)
  Fix some code quality and bug-risk issues (pydata#3999)
  DOC: add pandas.DataFrame.to_xarray (pydata#3994)
  Better chunking error messages for zarr backend (pydata#3983)
  Silence sphinx warnings (pydata#3990)
  Fix distributed tests on upstream-dev (pydata#3989)
  Add multi-dimensional extrapolation example and mention different behavior of kwargs in interp (pydata#3956)
  ...
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 this pull request may close these issues.

None yet

3 participants