def get_data_names(data, data_names):
    """
    Get default names for data fields if none are given based on the data.

    Examples
    --------

    >>> import numpy as np
    >>> east, north, up = [np.arange(10)]*3
    >>> get_data_names((east,), data_names=None)
    ('scalars',)
    >>> get_data_names((east, north), data_names=None)
    ('east_component', 'north_component')
    >>> get_data_names((east, north, up), data_names=None)
    ('east_component', 'north_component', 'vertical_component')
    >>> get_data_names((up, north), data_names=('ringo', 'george'))
    ('ringo', 'george')

    """
    if data_names is not None:
        if len(data) != len(data_names):
            raise ValueError(
                'Data has {} components but only {} names provided: {}'.
                format(len(data), len(data_names), str(data_names)))
        return data_names
    data_types = [('scalars',), ('east_component', 'north_component'), (
        'east_component', 'north_component', 'vertical_component')]
    if len(data) > len(data_types):
        raise ValueError(' '.join([
            'Default data names only available for up to 3 components.',
            "Must provide custom names through the 'data_names' argument."]))
    return data_types[len(data) - 1]
