home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 1133833687

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/issues/6617#issuecomment-1133833687 https://api.github.com/repos/pydata/xarray/issues/6617 1133833687 IC_kwDOAMm_X85DlO3X 40182387 2022-05-22T07:09:33Z 2022-05-22T07:09:33Z CONTRIBUTOR

You're right, thanks for the help. It seems that orthogonal dimensions are now interpolated independently by calling SciPy's interp1d multiple times, which explains why passing 'extrapolate' works. This behaviour has been introduced in #4155, in particular 7daad4fce3bf8ad9b9bc8e7baa104c476437e68d.

The documentation should be adapted to use @keewis's approach. I'd suggest including an example combining "advanced interpolation" and extrapolation, such as the one below:

python da = xr.DataArray( np.sin(0.3 * np.arange(20).reshape(5, 4)), [("x", np.arange(5)), ("y", [0.1, 0.2, 0.3, 0.4])], ) x = xr.DataArray([0.5, 1.5, 2.5, 3.5], dims="z") y = xr.DataArray([0.15, 0.25, 0.35, 0.45], dims="z")

Without extrapolation: python da.interp(x=x, y=y) <xarray.DataArray (z: 4)> array([ 0.55626357, 0.63496063, -0.46643289, nan]) Coordinates: x (z) float64 0.5 1.5 2.5 3.5 y (z) float64 0.15 0.25 0.35 0.45 Dimensions without coordinates: z

With extrapolation: python da.interp(x=x, y=y, kwargs={'fill_value': None}) <xarray.DataArray (z: 4)> array([ 0.55626357, 0.63496063, -0.46643289, -0.73507668]) Coordinates: x (z) float64 0.5 1.5 2.5 3.5 y (z) float64 0.15 0.25 0.35 0.45 Dimensions without coordinates: z

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  1238838588
Powered by Datasette · Queries took 0.589ms · About: xarray-datasette