Skip to content

BilinearRegridder

Import path: earth2studio.grids.BilinearRegridder

View source on GitHub

Documentation

Bases: _IndexRegridder

Interpolate between the four source points surrounding each target point.

Source points are located by topology:

  • Rectilinear sources bracket each target along their latitude and longitude axes. Longitude wraps when the grid covers the globe, and target longitudes are matched to the source convention.
  • Projected sources transform targets into the source CRS and bracket them along the projected axes, which is exact for any target.
  • Curvilinear sources triangulate their geographic coordinates. This is planar in degrees, needs SciPy (the utils extra), and does not wrap longitude.

Targets outside the source grid are outside coverage. Interpolation is in index space, so a source NaN propagates to targets that weight it.

Parameters:

  • source_grid (str | GridDefinition) –

    Rectilinear, projected or curvilinear grid of the fields to regrid, or a registered grid name.

  • target_grid (str | GridDefinition) –

    Grid to produce, or a registered grid name. A name is recorded in the output's earth2studio_grid_id.

  • fill_value (float | None, default: nan ) –

    Value for targets outside coverage, by default NaN. None raises ValueError at construction if any target is outside coverage.

supports classmethod

supports(
    source_grid: GridDefinition, target_grid: GridDefinition
) -> bool

Whether the source grid has the structure bilinear interpolation needs.

Parameters:

  • source_grid (GridDefinition) –

    Grid of the fields to regrid.

  • target_grid (GridDefinition) –

    Grid to produce.

Returns:

  • bool –

    True for rectilinear sources with monotonic axes of at least two points, projected sources with a CRS, and curvilinear sources.