Skip to content

Document how dot interacts with coordinates #10899

@oxinabox

Description

@oxinabox

Is your feature request related to a problem?

The docs on for dot
do not mention how coordinates interact with dot.
It is also not used in any examples.

It is unclear on the behavour (e.g. does it error?)

  • if they are in different orders
  • if they do not overlap

Nor what coordinates will end up in the output

Describe the solution you'd like

Add examples and a few sentences of text.

It seems like if they are in different order the coordinate is use (not the order).

In [18]: x = xr.DataArray(pd.Series({"a": 1, "b": 10}), dims=("foo",))
    ...: y = xr.DataArray(pd.Series({"b": 2, "a": 20}), dims=("foo",))

In [19]: x @ y
Out[19]: 
<xarray.DataArray ()> Size: 8B
array(40)

and if they do not overlap, missing entries on one are treated as being zero:

In [3]: x = xr.DataArray(pd.Series({"a": 1, "b": 10}), dims=("foo",))
   ...: y = xr.DataArray(pd.Series({"b": 2, "c": 30}), dims=("foo",))

In [4]: xr.dot(x, y)
Out[4]: 
<xarray.DataArray ()> Size: 8B
array(20)

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions