Skip to content

Uxarray types dropped during math with xarrays, depending on order of operations #1695

Description

@Sevans711

Version

2026.8.0

How did you install UXarray?

Source

What happened?

Uxarray object typing gets lost during binary math operations with xarray objects when the xarray object appears first.

What did you expect to happen?

I expected that mathematical calculations including uxarray objects and xarray objects should give uxarray object results, regardless of which kind of object appears earlier.

Can you provide a MCVE to repoduce the bug?

import uxarray as ux
import xarray as xr
uxarr = ux.tutorial.open_dataset('quad-hexagon')['t2m']

# expecting UxDataArray but got xarray.DataArray:
xr.DataArray(7) * uxarr

# meanwhile, putting the uxarr object first correctly gives UxDataArray:
uxarr * xr.DataArray(7)

# (this is extra confusing because the two are mathematically equivalent...)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status
    📝 To-Do

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions