def _generate_path(date, root_path, path_format):
    """Generate file path."""
    if not isinstance(date, datetime):
        raise TypeError("The input 'date' argument must be a datetime object")

    if path_format != "":
        sub_path = date.strftime(path_format)
        return os.path.join(root_path, sub_path)
    else:
        return root_path
Generate file path.
pysteps/io/archive.py