home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 774101639

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/pull/4760#issuecomment-774101639 https://api.github.com/repos/pydata/xarray/issues/4760 774101639 MDEyOklzc3VlQ29tbWVudDc3NDEwMTYzOQ== 10194086 2021-02-05T15:27:27Z 2021-02-05T15:27:27Z MEMBER

Thanks! That drove me nuts but I finally figured out the problem:

https://github.com/pydata/xarray/blob/5735e163bea43ec9bc3c2e640fbf25a1d4a9d0c0/xarray/tests/test_units.py#L29

promotes the warning to an error so diff_array_repr fails (because the units are stripped...) and that is what we see. That also fails on master - run the following in with pytest:

```python import pint import pytest import xarray as xr

pytestmark = [ pytest.mark.filterwarnings("error::pint.UnitStrippedWarning"), ]

unit_registry = pint.UnitRegistry(force_ndarray=True)

def test_y():

data_array1 = xr.DataArray(data=1 * unit_registry.m)
data_array2 = xr.DataArray(data=2 * unit_registry.m)

xr.testing.assert_allclose(data_array1, data_array2)

```

@keewis do you have an idea how to fix this? One idea is to supress warnings in diff_array_repr and diff_dataset_repr. Do we need to strip the units before sending them to these functions?

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