NearestRegridder¶
Import path: earth2studio.grids.NearestRegridder
Documentation¶
Bases: _IndexRegridder
Map each target point to its nearest source point.
Distances are great-circle, so the regridder is indifferent to the longitude convention of either grid. Source points without finite coordinates, such as off-disk satellite pixels, are never selected.
Parameters:
-
source_grid(str | GridDefinition) –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. -
max_dist_km(float | 'auto' | None, default:None) –Targets farther than this from their nearest source point are outside coverage.
"auto"uses the source grid's resolution, estimated from the spacing of its points, so targets beyond the source are never filled by extrapolation. By default None, which accepts every target. -
fill_value(float | None, default:nan) –Value for targets outside coverage, by default NaN. None raises
ValueErrorat construction if any target is outside coverage. -
source_mask(array-like of bool, default:None) –Validity of each source point, shaped like
source_grid(anxr.DataArrayis transposed to the grid's dimensions). Masked points are never selected, so every target takes the value of its nearest valid source point: a land-masked SST field fills coastal and inland targets from the nearest ocean point. By default every point is valid.
Note
Needs SciPy (the utils extra) to build the search tree.
source_mask
property
¶
Validity of each source point, shaped like source_grid, or None.
supports
classmethod
¶
supports(
source_grid: GridDefinition, target_grid: GridDefinition
) -> bool
Whether both grids provide geographic coordinates.
Parameters:
-
source_grid(GridDefinition) –Grid of the fields to regrid.
-
target_grid(GridDefinition) –Grid to produce.
Returns:
-
bool–True for every built-in grid topology.