Skip to content

utils.coords.map_coords

Import path: earth2studio.utils.coords.map_coords

View source on GitHub

Documentation

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. Does not support more advanced interpolation, such as between a regular and curvilinear grid. For such use-cases, use fetch_data or prep_data_array from data/utils.

Parameters:

  • x (Tensor) –

    Input data to map

  • input_coords (CoordSystem) –

    Respective input coordinate system

  • output_coords (CoordSystem) –

    Target output coordinates to map.

  • method (Literal["nearest"], default: 'nearest' ) –

    Method to use for mapping numeric coordinates, by default "nearest"

Returns:

  • tuple[Tensor, CoordSystem] –

    Mapped data and coordinate system.

Warning

Use this function with caution. Only certain coordinate transformations are supported / tested. Consider doing complex transforms manually in the inference pipeline.

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 If asked to interpolate between 2D lat/lon (curvilinear) coordinates