Identity transform that returns dimension positions as coordinate labels.
| 23 | |
| 24 | |
| 25 | class IdentityTransform(CoordinateTransform): |
| 26 | """Identity transform that returns dimension positions as coordinate labels.""" |
| 27 | |
| 28 | def forward(self, dim_positions: dict[str, Any]) -> dict[Hashable, Any]: |
| 29 | return dim_positions |
| 30 | |
| 31 | def reverse(self, coord_labels: dict[Hashable, Any]) -> dict[str, Any]: |
| 32 | return coord_labels |
| 33 | |
| 34 | def equals( |
| 35 | self, other: CoordinateTransform, exclude: frozenset[Hashable] | None = None |
| 36 | ) -> bool: |
| 37 | if not isinstance(other, IdentityTransform): |
| 38 | return False |
| 39 | return self.dim_size == other.dim_size |
| 40 | |
| 41 | |
| 42 | def create_transform_da(sizes: dict[str, int]) -> xr.DataArray: |
no outgoing calls
searching dependent graphs…