Closed
Description
While working on #3238, I tried replacing np.arange
with np.linspace
to create test arrays:
>>> ureg = pint.UnitRegistry()
>>> # with int values
>>> array = np.arange(10).astype(int) * ureg.m
>>> np.max(array)
<Quantity(9, 'meter')>
>>> np.max(xr.DataArray(data=array)) # works as expected
<xarray.DataArray ()>
<Quantity(9, 'meter')>
>>> # now with floats
>>> array = np.arange(10).astype(float) * ureg.m
>>> np.max(array)
<Quantity(9.0, 'meter')>
>>> np.max(xr.DataArray(data=array)) # unit information is lost
<xarray.DataArray ()>
array(9.)
Judging by the build logs of #3238, this seems to be the case for all aggregation functions except from np.median
and of course those that return booleans or indices.
Metadata
Metadata
Assignees
Labels
No labels