Increase the resolution of an array by duplicating its values to fill
    a larger array.

    Parameters
    ----------
    a: array, shape (a1, a2, a3, ...)
    n: integer
        Factor by which to expand the array.

    Returns
    -------
    ae: array, shape (n * a1, n * a2, n * a3, ...)

def extend_array(a, n):
    """Increase the resolution of an array by duplicating its values to fill
    a larger array.

    Parameters
    ----------
    a: array, shape (a1, a2, a3, ...)
    n: integer
        Factor by which to expand the array.

    Returns
    -------
    ae: array, shape (n * a1, n * a2, n * a3, ...)
    """
    a_new = a.copy()
    for d in range(a.ndim):
        a_new = np.repeat(a_new, n, axis=d)
    return a_new