home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 435170643

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
435170643 MDU6SXNzdWU0MzUxNzA2NDM= 2907 xr.dot result differs from np.dot 29361544 closed 0     4 2019-04-19T13:03:34Z 2019-04-19T17:51:45Z 2019-04-19T17:51:44Z NONE      

Code Sample

Hi, shouldn't the result of xr.dot be equivalent to np.dot? In np.dot I get values of ~280, and for xr.dot I get ~1100:

```python <xarray.DataArray 'models' (model name: 4)> array([283.6939 , 283.129198, 284.671649, 284.01668 ]) Coordinates: valid_time datetime64[ns] 2019-03-15T19:00:00 lat float64 45.89 lon float64 4.683 * model name (model name) |S5 'apple' 'juice' 'banana' 'milk'

<xarray.DataArray 'weights' (models: 4)> array([0.308999, 0.191562, 0.049474, 0.449983]) Coordinates: lat float64 45.89 lon float64 4.683 Dimensions without coordinates: models Now the calculation:python np.dot(models.values, weights_da.values) 283.7847051563903

xr.dot(weights_da, models, dims=['models', 'model name']) <xarray.DataArray ()> array(1135.532891) Coordinates: lat float64 45.89 lon float64 4.683 valid_time datetime64[ns] 2019-03-15T19:00:00

```

Problem description

What's going on below the surface? I mean if I create the array by hand (not from the file) I can't reproduce this. I don't think it's related to the file (as the values from the file work with numpy.dot). Something related to dask? Doing np.dot on the whole array (not just this piece here) results in a MemoryError. I'm

Thanks for any advice!

EDIT: I also tested it on python 3.7.3. xarray 0.11.3. Same result.

Output of xr.show_versions()

In [23]: xr.show_versions() /home/py_user/miniconda2/envs/v0/lib/python2.7/site-packages/distributed/config.py:20: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details. defaults = yaml.load(f) INSTALLED VERSIONS ------------------ commit: None python: 2.7.15.final.0 python-bits: 64 OS: Linux OS-release: 4.4.0-143-generic machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_US.UTF-8" LOCALE: None.None xarray: 0.10.9 pandas: 0.23.4 numpy: 1.16.2 scipy: 1.2.1 netCDF4: 1.4.2 h5netcdf: 0.7.1 h5py: 2.8.0 Nio: None zarr: None cftime: 1.0.3.4 PseudonetCDF: None rasterio: None iris: None bottleneck: 1.2.1 cyordereddict: 1.0.0 dask: 1.1.4 distributed: 1.26.0 matplotlib: 2.2.3 cartopy: None seaborn: 0.9.0 setuptools: 40.8.0 pip: 19.0.3 conda: None pytest: None IPython: 5.8.0 sphinx: None
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/2907/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed 13221727 issue

Links from other tables

  • 1 row from issues_id in issues_labels
  • 4 rows from issue in issue_comments
Powered by Datasette · Queries took 163.171ms · About: xarray-datasette