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

Function concatenate

xarray/tests/test_computation.py:560–575  ·  view source on GitHub ↗
(objects, dim="x")

Source from the content-addressed store, hash-verified

558
559def test_apply_exclude() -> None:
560 def concatenate(objects, dim="x"):
561 def func(*x):
562 return np.concatenate(x, axis=-1)
563
564 result = apply_ufunc(
565 func,
566 *objects,
567 input_core_dims=[[dim]] * len(objects),
568 output_core_dims=[[dim]],
569 exclude_dims={dim},
570 )
571 if isinstance(result, xr.Dataset | xr.DataArray):
572 # note: this will fail if dim is not a coordinate on any input
573 new_coord = np.concatenate([obj.coords[dim] for obj in objects])
574 result.coords[dim] = new_coord
575 return result
576
577 arrays = [np.array([1]), np.array([2, 3])]
578 variables = [xr.Variable("x", a) for a in arrays]

Callers 1

test_apply_excludeFunction · 0.70

Calls 1

apply_ufuncFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…