def parse_log(file_path):
if not os.path.isfile(file_path):<EOL><INDENT>return elements.error("<STR_LIT>", "<STR_LIT>" + file_path.split(os.sep)[-<NUM_LIT:1>])<EOL><DEDENT>headers = ["<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>"]<EOL>with open(file_path, '<STR_LIT:r>') as f:<EOL><INDENT>dycore_types = {"<STR_LIT:0>": "<STR_LIT>",<EOL>"<STR_LIT:1>": "<STR_LIT>",<EOL>"<STR_LIT:2>": "<STR_LIT>",<EOL>"<STR_LIT:3>": "<STR_LIT>",<EOL>"<STR_LIT:4>": "<STR_LIT>"}<EOL>curr_step = <NUM_LIT:0><EOL>proc_count = <NUM_LIT:0><EOL>iter_number = <NUM_LIT:0><EOL>converged_iters = []<EOL>iters_to_converge = []<EOL>for line in f:<EOL><INDENT>split = line.split()<EOL>if ('<STR_LIT>' in line):<EOL><INDENT>if line.split()[-<NUM_LIT:1>] == '<STR_LIT:=>':<EOL><INDENT>dycore_type = dycore_types[next(f).strip()]<EOL><DEDENT>else:<EOL><INDENT>dycore_type = dycore_types[line.split()[-<NUM_LIT:1>]]<EOL><DEDENT><DEDENT>elif ('<STR_LIT>' in line):<EOL><INDENT>proc_count += int(line.split()[-<NUM_LIT:1>])<EOL><DEDENT>elif ('<STR_LIT>' in line):<EOL><INDENT>curr_step = int(line.split()[<NUM_LIT:4>])<EOL><DEDENT>elif ('<STR_LIT>' in line):<EOL><INDENT>converged_iters.append(curr_step)<EOL>curr_step = float(line.split()[-<NUM_LIT:1>])<EOL><DEDENT>elif ('<STR_LIT>' in line):<EOL><INDENT>split = line.split()<EOL>iters_to_converge.append(int(split[split.index('<STR_LIT>') + <NUM_LIT:2>]))<EOL><DEDENT>elif ("<STR_LIT>" in line):<EOL><INDENT>iters_to_converge.append(int(iter_number))<EOL><DEDENT>elif len(split) > <NUM_LIT:0> and split[<NUM_LIT:0>].isdigit():<EOL><INDENT>iter_number = split[<NUM_LIT:0>]<EOL><DEDENT><DEDENT>if iters_to_converge == []:<EOL><INDENT>iters_to_converge.append(int(iter_number))<EOL><DEDENT><DEDENT>data = {<EOL>"<STR_LIT>": dycore_type,<EOL>"<STR_LIT>": proc_count,<EOL>"<STR_LIT>": len(converged_iters),<EOL>"<STR_LIT>": np.mean(iters_to_converge)<EOL>}<EOL>return elements.table("<STR_LIT>", headers, data)<EOL>
Parse a CISM output log and extract some information.

Args:
    file_path: absolute path to the log file

Return:
    A dictionary created by the elements object corresponding to
    the results of the bit for bit testing