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

xr.polyval: return nan when evaluating a curve with nan coefficients #6619

Closed
2 of 4 tasks
FRidh opened this issue May 18, 2022 · 2 comments
Closed
2 of 4 tasks

xr.polyval: return nan when evaluating a curve with nan coefficients #6619

FRidh opened this issue May 18, 2022 · 2 comments
Labels
bug needs triage Issue that has not been reviewed by xarray team member

Comments

@FRidh
Copy link

FRidh commented May 18, 2022

What happened?

Evaluating the coefficients from a polyfit that happened to be none results in a polyval evaluation of zeros.

What did you expect to happen?

I expect the result to be nan when an input is nan as well. Note passing in skipna=True to polyfit does not make a difference.

Minimal Complete Verifiable Example

import xarray as xr
import numpy as np
arr = xr.DataArray(np.ones(100)*np.nan, dims=["time"], coords={"time": np.arange(100)})
xr.polyval(arr.time, arr.polyfit(dim="time", deg=1))

MVCE confirmation

  • Minimal example — the example is as focused as reasonably possible to demonstrate the underlying issue in xarray.
  • Complete example — the example is self-contained, including all data and the text of any traceback.
  • Verifiable example — the example copy & pastes into an IPython prompt or Binder notebook, returning the result.
  • New issue — a search of GitHub Issues suggests this is not a duplicate.

Relevant log output

No response

Anything else we need to know?

No response

Environment

: None seaborn: None numbagg: None fsspec: 2022.01.0 cupy: None pint: None sparse: None setuptools: 61.2.0.post0 pip: None conda: None pytest: 7.1.1 IPython: 8.2.0 sphinx: 4.5.0
@FRidh FRidh added bug needs triage Issue that has not been reviewed by xarray team member labels May 18, 2022
@dcherian
Copy link
Contributor

Fixed on main thanks to @headtr1ck !

image

@FRidh
Copy link
Author

FRidh commented May 18, 2022

Ohh, great, thanks! I guess then it was #6601 that fixed this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug needs triage Issue that has not been reviewed by xarray team member
Projects
None yet
Development

No branches or pull requests

2 participants