def cube(data, xcoords=None, ycoords=None, chcoords=None, scalarcoords=None, datacoords=None, attrs=None, name=None):
    """Create a cube as an instance of xarray.DataArray with Decode accessor.

    Args:
        data (numpy.ndarray): 3D (x x y x channel) array.
        xcoords (dict, optional): Dictionary of arrays that label x axis.
        ycoords (dict, optional): Dictionary of arrays that label y axis.
        chcoords (dict, optional): Dictionary of arrays that label channel axis.
        scalarcoords (dict, optional): Dictionary of values that don't label any axes (point-like).
        datacoords (dict, optional): Dictionary of arrays that label x, y, and channel axes.
        attrs (dict, optional): Dictionary of attributes to add to the instance.
        name (str, optional): String that names the instance.

    Returns:
        decode cube (decode.cube): Decode cube.
    """
    # initialize coords with default values
    cube = xr.DataArray(data, dims=('x', 'y', 'ch'), attrs=attrs, name=name)
    cube.dcc._initcoords()

    # update coords with input values (if any)
    if xcoords is not None:
        cube.coords.update({key: ('x', xcoords[key]) for key in xcoords})

    if ycoords is not None:
        cube.coords.update({key: ('y', ycoords[key]) for key in ycoords})

    if chcoords is not None:
        cube.coords.update({key: ('ch', chcoords[key]) for key in chcoords})

    if datacoords is not None:
        cube.coords.update({key: (('x', 'y', 'ch'), datacoords[key]) for key in datacoords})

    if scalarcoords is not None:
        cube.coords.update(scalarcoords)

    return cube