def construct_cell()

in src/h3/api/memview_int/__init__.py [0:0]


def construct_cell(base_cell_number, *digits, res=None):
    """
    Construct cell from base cell and digits.

    Parameters
    ----------
    base_cell_number : int
        Base cell *number* (``0`` to ``121``).
    *digits : int
        Sequence of index digits (``0`` to ``6``).
        Length of digits will be the resulting resolution of the output cell.
    res : int, optional
        Resolution of the constructed cell. If provided, it must equal
        ``len(digits)``; otherwise it is inferred from the number of digits.

    Returns
    -------
    H3Cell
        The constructed cell.

    Examples
    --------
    >>> construct_cell(7, 2, 1, 4)  # resolution 3 cell
    '830e8cfffffffff'

    >>> construct_cell(15, 0, 0, 5, 3)  # resolution 4 cell
    '841e057ffffffff'

    >>> construct_cell(15, 0, 0, 5, 3, res=4)
    '841e057ffffffff'
    """
    if (res is not None) and (len(digits) != res):
        raise ValueError('Resolution must match number of digits.')

    digits = array('i', digits)
    o = _cy.construct_cell(base_cell_number, digits)
    return _out_scalar(o)