home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 1252540520

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/issues/7058#issuecomment-1252540520 https://api.github.com/repos/pydata/xarray/issues/7058 1252540520 IC_kwDOAMm_X85KqEBo 4160723 2022-09-20T15:38:02Z 2022-09-20T15:40:34Z MEMBER

Hi @adelezaini,

I'm a bit confused since you're trying to make a simple operation between two DataArrays and the example that you mention is about element-wise product of a DataArray with an unlabelled numpy array.

If you want to perform an element-wise operation like * between two DataArrays, xarray supports automatic broadcasting by dimension name, so all you need is to ensure that the two DataArrays share common dimension names and have the same number of elements along those dimensions (the latter is not strictly required if the DataArrays both have coordinates along those dimensions, in which case xarray also automatically aligns the two DataArrays).

I believe a very useful implementation would be adding xr.mult(arrays, dim, args) - or xr.prod or similar -,

There's already DataArray.prod but it serves a different purpose, i.e., compute the product of array elements over a given dimension and return a reduced DataArray (like numpy.prod).

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  1379365175
Powered by Datasette · Queries took 0.573ms · About: xarray-datasette