issues: 955043280
This data as json
id | node_id | number | title | user | state | locked | assignee | milestone | comments | created_at | updated_at | closed_at | author_association | active_lock_reason | draft | pull_request | body | reactions | performed_via_github_app | state_reason | repo | type |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
955043280 | MDU6SXNzdWU5NTUwNDMyODA= | 5644 | `polyfit` with weights alters the DataArray in place | 8291800 | closed | 0 | 6 | 2021-07-28T16:43:17Z | 2023-06-09T15:38:01Z | 2023-06-09T15:38:01Z | CONTRIBUTOR | What happened: After running What you expected to happen: I didn't see this documented anywhere, but I did not expect that creating a polyfit dataset would clobber the original data that I'm fitting to. The data isn't altered in the case of unweighted fitting, only weighted. Minimal Complete Verifiable Example: ```python In [2]: import xarray as xr; import numpy as np In [3]: nz, ny, nx = (10, 20, 30) In [4]: da = xr.DataArray(np.random.rand(nz, ny ,nz), dims=['z','y','x']) In [6]: da.mean(), da.max() Out[6]: (<xarray.DataArray ()> array(0.4963857), <xarray.DataArray ()> array(0.99996494)) In [7]: pf = da.polyfit("z", deg=2) # This will not alter the data In [9]: da.mean(), da.max() Out[9]: (<xarray.DataArray ()> array(0.4963857), <xarray.DataArray ()> array(0.99996494)) Non-zero
|
{ "url": "https://api.github.com/repos/pydata/xarray/issues/5644/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |