issue_comments: 938906859
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/5734#issuecomment-938906859 | https://api.github.com/repos/pydata/xarray/issues/5734 | 938906859 | IC_kwDOAMm_X8439pTr | 14371165 | 2021-10-08T17:20:48Z | 2021-10-08T17:20:48Z | MEMBER | Looking at those unit errors it appears
```python
____________________ TestDataset.test_resample[int32-data] ____________________
[gw1] win32 -- Python 3.9.7 C:\Miniconda\envs\xarray-tests\python.exe
self = <xarray.tests.test_units.TestDataset object at 0x0000028489DCFC70>
variant = 'data', dtype = dtype('int32')
@pytest.mark.parametrize(
"variant",
(
"data",
pytest.param(
"dims", marks=pytest.mark.skip(reason="indexes don't support units")
),
"coords",
),
)
def test_resample(self, variant, dtype):
# TODO: move this to test_computation_objects
variants = {
"data": ((unit_registry.degK, unit_registry.Pa), 1, 1),
"dims": ((1, 1), unit_registry.m, 1),
"coords": ((1, 1), 1, unit_registry.m),
}
(unit1, unit2), dim_unit, coord_unit = variants.get(variant)
array1 = np.linspace(-5, 5, 10 * 5).reshape(10, 5).astype(dtype) * unit1
array2 = np.linspace(10, 20, 10 * 8).reshape(10, 8).astype(dtype) * unit2
t = pd.date_range("10-09-2010", periods=array1.shape[0], freq="1y")
y = np.arange(5) * dim_unit
z = np.arange(8) * dim_unit
u = np.linspace(-1, 0, 5) * coord_unit
ds = xr.Dataset(
data_vars={"a": (("time", "y"), array1), "b": (("time", "z"), array2)},
coords={"time": t, "y": y, "z": z, "u": ("y", u)},
)
units = extract_units(ds)
func = method("resample", time="6m")
expected = attach_units(func(strip_units(ds)).mean(), units)
> actual = func(ds).mean()
D:\a\xarray\xarray\xarray\tests\test_units.py:5366:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
D:\a\xarray\xarray\xarray\core\groupby.py:602: in wrapped_func
result = xarray_reduce(
C:\Miniconda\envs\xarray-tests\lib\site-packages\dask_groupby\xarray.py:259: in xarray_reduce
actual = xr.apply_ufunc(
D:\a\xarray\xarray\xarray\core\computation.py:1153: in apply_ufunc
return apply_dataset_vfunc(
D:\a\xarray\xarray\xarray\core\computation.py:447: in apply_dataset_vfunc
result_vars = apply_dict_of_variables_vfunc(
D:\a\xarray\xarray\xarray\core\computation.py:391: in apply_dict_of_variables_vfunc
result_vars[name] = func(*variable_args)
D:\a\xarray\xarray\xarray\core\computation.py:733: in apply_variable_ufunc
result_data = func(*input_data)
C:\Miniconda\envs\xarray-tests\lib\site-packages\dask_groupby\xarray.py:232: in wrapper
result, groups = groupby_reduce(*args, **kwargs)
C:\Miniconda\envs\xarray-tests\lib\site-packages\dask_groupby\core.py:1119: in groupby_reduce
results = chunk_reduce(
C:\Miniconda\envs\xarray-tests\lib\site-packages\dask_groupby\core.py:521: in chunk_reduce
result = _get_aggregate(backend)(
C:\Miniconda\envs\xarray-tests\lib\site-packages\numpy_groupies\aggregate_numpy.py:291: in aggregate
return _aggregate_base(group_idx, a, size=size, fill_value=fill_value,
C:\Miniconda\envs\xarray-tests\lib\site-packages\numpy_groupies\aggregate_numpy.py:256: in _aggregate_base
group_idx, a, flat_size, ndim_idx, size = input_validation(group_idx, a,
C:\Miniconda\envs\xarray-tests\lib\site-packages\numpy_groupies\utils_numpy.py:199: in input_validation
a = np.asanyarray(a)
C:\Miniconda\envs\xarray-tests\lib\site-packages\numpy\core\_asarray.py:171: in asanyarray
return array(a, dtype, copy=False, order=order, subok=True)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Quantity([[-5 -3 -2 -1 0 0 1 2 3 4]
[-4 -3 -2 -1 0 0 1 2 3 4]
[-4 -3 -2 -1 0 0 1 2 3 4]
[-4 -3 -2 -1 0 0 1 2 3 4]
[-4 -3 -2 -1 0 0 1 2 3 5]], 'kelvin')>
t = None
def __array__(self, t=None):
> warnings.warn(
"The unit of the quantity is stripped when downcasting to ndarray.",
UnitStrippedWarning,
stacklevel=2,
)
E pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.
C:\Miniconda\envs\xarray-tests\lib\site-packages\pint\quantity.py:1700: UnitStrippedWarning
```
|
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
978356586 |