issues: 351000813
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
351000813 | MDU6SXNzdWUzNTEwMDA4MTM= | 2370 | Inconsistent results when calculating sums on float32 arrays w/ bottleneck installed | 5179430 | closed | 0 | 6 | 2018-08-15T23:18:41Z | 2020-08-17T00:07:12Z | 2020-08-17T00:07:12Z | CONTRIBUTOR | Code Sample, a copy-pastable example if possibleData file used is here: test.nc.zip Output from each statement is commented out. ```python import xarray as xr ds = xr.open_dataset('test.nc') ds.cold_rad_cnts.min() 13038.ds.cold_rad_cnts.max() 13143.ds.cold_rad_cnts.mean() 12640.583984ds.cold_rad_cnts.std() 455.035156ds.cold_rad_cnts.sum() 4.472997e+10``` Problem descriptionAs you can see above, the mean falls outside the range of the data, and the standard deviation is nearly two orders of magnitude higher than it should be. This is because a significant loss of precision is occurring when using bottleneck's Naturally, this means that converting the data to Expected Output```python In [8]: import numpy as np In [9]: np.nansum(ds.cold_rad_cnts) Out[9]: 46357123000.0 In [10]: np.nanmean(ds.cold_rad_cnts) Out[10]: 13100.413 In [11]: np.nanstd(ds.cold_rad_cnts) Out[11]: 8.158843 ``` Output of
|
{ "url": "https://api.github.com/repos/pydata/xarray/issues/2370/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |