MCPcopy
hub / github.com/pydata/xarray / IdentityTransform

Class IdentityTransform

properties/test_coordinate_transform.py:25–39  ·  view source on GitHub ↗

Identity transform that returns dimension positions as coordinate labels.

Source from the content-addressed store, hash-verified

23
24
25class 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
42def create_transform_da(sizes: dict[str, int]) -> xr.DataArray:

Callers 1

create_transform_daFunction · 0.85

Calls

no outgoing calls

Tested by 1

create_transform_daFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…