nsrdb.utilities.interpolation.spatial_interp
- spatial_interp(var, data, native_grid, new_grid, method, dist, ind, elevation_correct)[source]
Perform single variable spatial interpolation on MERRA data array.
- Parameters:
var (str) – NSRDB variable name.
data (np.ndarray) – 2D data array (time X sites) for a single variable.
native_grid (pd.DataFrame) – Native grid associated with the input data. Should have column for elevation.
new_grid (pd.DataFrame) – New grid associated with the output data. Should have column for elevation.
method (str) – Interpolation method (IDW for inverse distance weighted, NN for nearest neighbor, AGG for aggregation). Last character can be an integer to set IDW power or number of AGG neighbors.
dist (ndarray) – Distance array in km returned if return_dist input arg set to True.
indicies (ndarray) – 1D array of row indicies in native_grid that match new_grid.
elevation_correct (bool) – Flag to perform elevation correction.
- Returns:
out_array (np.ndarray) – 2D data array (time X sites) with sites matching the new_grid resolution.