contrailopt.fill_nan_spatial¶
- contrailopt.fill_nan_spatial(ds: Dataset) Dataset[source]¶
Fill NaN in gridded met with the value at the nearest valid horizontal neighbor.
Nearest is measured in grid cells rather than on the sphere. The fill does not wrap across the antimeridian, and it ignores the convergence of meridians at the poles.
Each
(level, time)slice is filled independently, so values are never borrowed across pressure levels or time steps.- Parameters:
ds (
xarray.Dataset) – Gridded met with dimslongitude,latitude,level, andtime.- Returns:
Dataset with NaN replaced by the value at the nearest
(longitude, latitude)cell holding a finite value.- Return type: