Search code examples
pythonmetpy

Gridding data to edge of bounds


I have some scatter data of mesonet stations and I want to generate maps for a specific variable. I first want to grid the data and store it in a NetCDF for repeated access. I'm using metpy to generate the grids for the lat/lon/variable:

interpolate_to_grid(X, Y, Z, interp_type="natural_neighbor", hres=0.125, boundary_coords={'west': -120., 'south': 33., 'east': -90., 'north': 53.})

The scatter data for this variable does not cover the whole state (the example is in Iowa), there are holes shown in the image below.

enter image description here

When I generate an image from the gridded data It does not interpolate to the edge.

Variable plotted in Iowa

Is there a way to get metpy.interpolate_to_grid to grid the data to the edge of the bounds?


Solution

  • Not with natural neighbor interpolation. The area you see is what's known as the "convex hull" of your data. Essentially, to interpolate to a grid point, that point needs to be "surrounded" by data. Other methods, like the linear interpolation, or the distance-weighting methods, will give you a different bound of valid data.