def grid_interpolate(func):
@wraps(func)<EOL>def wrapper(profile, grid, grid_radial_minimum=None, *args, **kwargs):<EOL><INDENT>if hasattr(grid, "<STR_LIT>"):<EOL><INDENT>interpolator = grid.interpolator<EOL>if grid.interpolator is not None:<EOL><INDENT>values = func(profile, interpolator.interp_grid, grid_radial_minimum, *args, **kwargs)<EOL>if values.ndim == <NUM_LIT:1>:<EOL><INDENT>return interpolator.interpolated_values_from_values(values=values)<EOL><DEDENT>elif values.ndim == <NUM_LIT:2>:<EOL><INDENT>y_values = interpolator.interpolated_values_from_values(values=values[:, <NUM_LIT:0>])<EOL>x_values = interpolator.interpolated_values_from_values(values=values[:, <NUM_LIT:1>])<EOL>return np.asarray([y_values, x_values]).T<EOL><DEDENT><DEDENT><DEDENT>return func(profile, grid, grid_radial_minimum, *args, **kwargs)<EOL><DEDENT>return wrapper<EOL>
Decorate a profile method that accepts a coordinate grid and returns a data grid.

If an interpolator attribute is associated with the input grid then that interpolator is used to down sample the
coordinate grid prior to calling the function and up sample the result of the function.

If no interpolator attribute is associated with the input grid then the function is called as normal.

Parameters
----------
func
    Some method that accepts a grid

Returns
-------
decorated_function
    The function with optional interpolation