earth2studio.utils.coords
.map_coords#
- earth2studio.utils.coords.map_coords(x, input_coords, output_coords, method='nearest')[source]#
A basic interpolation util to map between coordinate systems with common dimensions. Namely, output_coords should consist of keys are present in input_coords. Note that output_coords do not need have all the dimensions of the input_coords.
- Parameters:
x (torch.Tensor) – Input data to map
input_coords (CoordSystem) – Respective input coordinate system
output_coords (CoordSystem) – Target output coordinates to map.
method (Literal["nearest"], optional) – Method to use for mapping numeric coordinates, by default “nearest”
- Returns:
Mapped data and coordinate system.
- Return type:
tuple[torch.Tensor, CoordSystem]
- Raises:
KeyError: – If output coordinate has a dimension not in the input coordinate
ValueError – If value in non-numeric output coordinate is not in input coordinate