issues: 91676831
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
91676831 | MDU6SXNzdWU5MTY3NjgzMQ== | 448 | asarray Compatibility | 10137 | closed | 0 | 3 | 2015-06-29T02:45:25Z | 2015-06-30T23:02:57Z | 2015-06-30T23:02:57Z | NONE | To "numpify" a function, usually asarray is used: def db2w(arr): return 10 ** (np.asarray(arr) / 20.0) Now you could replace the divide with np.divide, but it seems much simpler to use np.asarray. Unfortunately, if you use any function that has been "vectorized," it will only return the values of the DataArray as an ndarray. This strips the object of any "xray" meta-data and severely limits the use of this class. It requires that any function that wants to work seamlessly with a DataArray explicitly check that it's an instance of DataArray This seems counter-intuitive to the numpy framework where any function, once properly vectorized, can work with python scalars (int, float) or list types (tuple, list) as well as the actual ndarray class. It would be awesome if code that worked for these cases could just work for DataArrays. |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/448/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |