issues: 37845163
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
37845163 | MDExOlB1bGxSZXF1ZXN0MTgzODUxODA= | 184 | WIP: Automatic label alignment for mathematical operations | 1217238 | closed | 0 | 1 | 2014-07-15T01:57:18Z | 2014-08-21T05:44:30Z | 2014-08-21T05:44:30Z | MEMBER | 0 | pydata/xarray/pulls/184 | This still need a bit of cleanup (note the failing test), but there is an interesting design decision that came up: How should we handle alignment for in-place operations when the operation would result in missing values that cannot be represented by the existing data type? For example, what should
If we do automatic alignment like pandas, in-place operations should not change the coordinates of the object to which the operation is being applied. Thus,
Here arises the problem:
There are several options here:
1. Don't actually do in-place operations on the underlying ndarrays: ``` In [3]: x = np.array(0) In [4]: x += np.nan /Users/shoyer/miniconda/envs/tcc-climatology/bin/ipython:1: RuntimeWarning: invalid value encountered in add #!/Users/shoyer/miniconda/envs/tcc-climatology/python.app/Contents/MacOS/python ``` Option 1 has negative performance implications for all in-place array operations (they would be no faster than the non-in-place versions), and might also complicate the hypothetical future feature of datasets linked on disk (but we might also just disallow in-place operations for such arrays). Option 2 is one principled choice, but the outcome with missing values would be pretty surprising (note that in this scenario, both I like option 3 (with the warning), but unfortunately it has most of the negative performance implications of option 1, because we could need to make a copy of Any thoughts? |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/184/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
13221727 | pull |