def _pad_mode_str(extrapolation):
    """
Converts an extrapolation string (or struct of strings) to a string that can be passed to math functions like math.pad or math.resample.
    :param extrapolation: field extrapolation
    :return: padding mode, same type as extrapolation
    """
    return {'periodic': 'circular',
            'boundary': 'replicate',
            'constant': 'constant'}[extrapolation]