home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 189095110

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
189095110 MDExOlB1bGxSZXF1ZXN0OTM1NTM5OTA= 1118 Do not convert subclasses of `ndarray` unless required 1310437 closed 0     13 2016-11-14T11:59:02Z 2019-12-25T14:12:34Z 2019-12-25T14:12:34Z CONTRIBUTOR   0 pydata/xarray/pulls/1118

By changing a single np.asarray to np.asanyarray, it becomes possible to use ndarray subclasses within DataArray and Dataset. No guarantee is made at this point that their behaviour is retained under all circumstances, but for some use-cases it will work.

Particularly, this allows to store physical quantities represented using the Quantity subclass from the package python-quantities. In that sense, it is a partial fix for #525. Tests are included to highlight some of the things that do work, and some which don't. It does not work for coordinates when they are used as indexes, since pandas does not support ndarray subclasses. Most likely, it will also not work for any higher-level operation on the data such as those involving np.concatenate. Thus, any user of this feature should remain cautious. Nonetheless, for me, this change provides enough added value, such that I'd consider it worthwhile to keep, assuming it does not harm anywhere else. It does pass the tests on my machine (no dask though), let's see what travis says.

I expect that astropy's units would behave similarly, though since I never worked with them yet, I did not include any tests.

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/1118/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    13221727 pull

Links from other tables

  • 1 row from issues_id in issues_labels
  • 13 rows from issue in issue_comments
Powered by Datasette · Queries took 2.315ms · About: xarray-datasette