(objects, dim="x")
| 558 | |
| 559 | def 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] |
no test coverage detected
searching dependent graphs…