Compute all coordinate labels at once.
(
self, dims: tuple[str, ...] | None = None
)
| 94 | raise NotImplementedError |
| 95 | |
| 96 | def generate_coords( |
| 97 | self, dims: tuple[str, ...] | None = None |
| 98 | ) -> dict[Hashable, Any]: |
| 99 | """Compute all coordinate labels at once.""" |
| 100 | if dims is None: |
| 101 | dims = self.dims |
| 102 | |
| 103 | positions = np.meshgrid( |
| 104 | *[np.arange(self.dim_size[d]) for d in dims], |
| 105 | indexing="ij", |
| 106 | ) |
| 107 | dim_positions = {dim: positions[i] for i, dim in enumerate(dims)} |
| 108 | |
| 109 | return self.forward(dim_positions) |