def dmsp_map_interpolate(X_dmsp, Y_dmsp, X_map, Y_map, tolerance=0.5):
    '\n    generic function to spatially interpolate with the SSJ data using nearest neighbors using some arbirtary distance tolerance\n    '
    indices = scipy.interpolate.griddata((X_map, Y_map), np.arange(len(X_map.flatten())), (X_dmsp, Y_dmsp), method='nearest')
    mask = ((abs((X_map[indices] - X_dmsp)) < tolerance) & (abs((Y_map[indices] - Y_dmsp)) < tolerance))
    return (indices, mask)
generic function to spatially interpolate with the SSJ data using nearest neighbors using some arbirtary distance tolerance
def dmsp_map_interpolate(X_dmsp, Y_dmsp, X_map, Y_map, tolerance=0.5):
    '\n    \n    '
    indices = scipy.interpolate.griddata((X_map, Y_map), np.arange(len(X_map.flatten())), (X_dmsp, Y_dmsp), method='nearest')
    mask = ((abs((X_map[indices] - X_dmsp)) < tolerance) & (abs((Y_map[indices] - Y_dmsp)) < tolerance))
    return (indices, mask)