def swap_header_axis(h, a0, a1):
    """
    Swaps header keywords between dimensions.
    Affects only keywords 'NAXIS', 'CRPIX', 'CRVAL', 'CDELT', 'CUNIT', 'CTYPE'.

    Parameters
    ----------
    h : dict
        The header to update
    a0 : int
        First index to swap from
    a1 : int
        Second index to swap to

    Returns
    -------
    updated_h : dict
        Updated header where dimensions have been interchanged
    """
    keywords = ['NAXIS', 'CRPIX', 'CRVAL', 'CDELT', 'CUNIT', 'CTYPE']
    tmp = {}
    for k in keywords:
        try:
            tmp[k] = h[k+str(a0)]
        except KeyError:
            tmp[k] = ''
        try:
            h[k+str(a0)] = h[k+str(a1)]
        except KeyError:
            h[k+str(a0)] = ''
        h[k+str(a1)] = tmp[k]

    for k in h.keys():
        if 'PC' in k:
            if str(a0) in k:
                h[k.replace(str(a0), str(a1))] = h.pop(k)
    return h