Closed
Description
Is your feature request related to a problem?
If we have two objects with dims x
and x1
, then xr.align(..., join="exact")
will pass because these dimensions are broadcastable.
I'd like a stricter option (join="strict"
?) that disallows broadcasting.
Describe the solution you'd like
xr.align(
xr.DataArray([1], dims="x"),
xr.DataArray([1], dims="x1"),
join="strict",
)
would raise an error.
It'd be nice to have this as a built-in option so we can use
with xr.set_options(arithmetic_join="strict"):
...
Describe alternatives you've considered
An alternative would be to allow control over automatic broadcasting through the set_options
context manager., but that seems like it would be more complicated to implement.
Additional context
This turns up in staggered grid calculations with xgcm where it is easy to mistakenly construct very high-dimensional arrays because of automatic broadcasting.