def _assert_matching_units(ungridded_data, other, operation_name):
    """
    Check that the units of the ungridded_data and the other item are the same, or if
    the other does not have a unit, skip this test
    """
    if ungridded_data.units != getattr(other, 'units', ungridded_data.units):
        msg = 'Cannot use {!r} with differing units ({} & {})'.format(
            operation_name, ungridded_data.units, other.units)
        raise NotImplementedError(msg)
