def METHOD_NAME(datadir):
    """Set the data directory.
    Parameters
    ----------
    datadir : str
        The name to the data directory. It must exist.
    Raises
    ------
    OSError
        If datadir is not a directory or is empty.
    """
    if not os.path.exists(datadir) or not os.path.isdir(datadir) \
       or not os.listdir(datadir):
        raise OSError(f"datadir={datadir} is empty or not a directory")
    global DATADIR
    DATADIR = datadir