def unstagger_xarray(qty, index):
    """Interpolate u, v, or w component values to values at grid cell centres.

    Named indexing requires that input arrays are XArray DataArrays.

    :arg qty: u, v, or w component values
    :type qty: :py:class:`xarray.DataArray`

    :arg index: index name along which to centre
        (generally one of 'gridX', 'gridY', or 'depth')
    :type index: str

    :returns qty: u, v, or w component values at grid cell centres
    :rtype: :py:class:`xarray.DataArray`
    """

    qty = (qty + qty.shift(**{index: 1})) / 2

    return qty