MCPcopy Index your code
hub / github.com/pydata/xarray / broadcast_variables

Function broadcast_variables

xarray/core/variable.py:3040–3054  ·  view source on GitHub ↗

Given any number of variables, return variables with matching dimensions and broadcast data. The data on the returned variables will be a view of the data on the corresponding original arrays, but dimensions will be reordered and inserted so that both broadcast arrays have the same

(*variables: Variable)

Source from the content-addressed store, hash-verified

3038
3039
3040def broadcast_variables(*variables: Variable) -> tuple[Variable, ...]:
3041 """Given any number of variables, return variables with matching dimensions
3042 and broadcast data.
3043
3044 The data on the returned variables will be a view of the data on the
3045 corresponding original arrays, but dimensions will be reordered and
3046 inserted so that both broadcast arrays have the same dimensions. The new
3047 dimensions are sorted in order of appearance in the first variable's
3048 dimensions followed by the second variable's dimensions.
3049 """
3050 dims_map = _unified_dims(variables)
3051 dims_tuple = tuple(dims_map)
3052 return tuple(
3053 var.set_dims(dims_map) if var.dims != dims_tuple else var for var in variables
3054 )
3055
3056
3057def _broadcast_compat_data(self, other):

Callers 4

interpMethod · 0.90
to_dataarrayMethod · 0.90
_interpndFunction · 0.90
broadcast_equalsMethod · 0.85

Calls 2

_unified_dimsFunction · 0.85
set_dimsMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…