home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 763119626

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/issues/525#issuecomment-763119626 https://api.github.com/repos/pydata/xarray/issues/525 763119626 MDEyOklzc3VlQ29tbWVudDc2MzExOTYyNg== 14808389 2021-01-19T20:33:47Z 2021-01-26T00:16:46Z MEMBER

I would expect astropy quantities to work just fine as long as they are duck arrays

actually, that turns out to be wrong. Since isinstance(data, np.ndarray) returns true for astropy.units.Quantity, it is cast to ndarray using np.asarray: https://github.com/pydata/xarray/blob/7dbbdcafed7f796ab77039ff797bcd31d9185903/xarray/core/variable.py#L231-L245

Adding ~or issubclass(type(data), np.ndarray)~ or type(data) != np.ndarray does allow wrapping a astropy.units quantity in Dataset / DataArray objects ~but it breaks a few tests~. Also, unless we modify the testsuite in xarray/tests/test_units.py to run with astropy.units instead of pint I can't really tell which features of xarray strip the units (in addition to the ones documented for pint). For that, we probably need to somehow create a generalization of the tests for duck arrays.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  100295585
Powered by Datasette · Queries took 0.606ms · About: xarray-datasette