def bit_for_bit(model_path, bench_path, config):
fname = model_path.split(os.path.sep)[-<NUM_LIT:1>]<EOL>if not (os.path.isfile(bench_path) and os.path.isfile(model_path)):<EOL><INDENT>return elements.error("<STR_LIT>",<EOL>"<STR_LIT>" + fname + "<STR_LIT>")<EOL><DEDENT>try:<EOL><INDENT>model_data = Dataset(model_path)<EOL>bench_data = Dataset(bench_path)<EOL><DEDENT>except (FileNotFoundError, PermissionError):<EOL><INDENT>return elements.error("<STR_LIT>",<EOL>"<STR_LIT>" + fname + "<STR_LIT>")<EOL><DEDENT>if not (netcdf.has_time(model_data) and netcdf.has_time(bench_data)):<EOL><INDENT>return elements.error("<STR_LIT>",<EOL>"<STR_LIT>" + fname + "<STR_LIT>")<EOL><DEDENT>headers = ["<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>"]<EOL>stats = LIVVDict()<EOL>for i, var in enumerate(config["<STR_LIT>"]):<EOL><INDENT>if var in model_data.variables and var in bench_data.variables:<EOL><INDENT>m_vardata = model_data.variables[var][:]<EOL>b_vardata = bench_data.variables[var][:]<EOL>diff_data = m_vardata - b_vardata<EOL>if diff_data.any():<EOL><INDENT>stats[var]["<STR_LIT>"] = np.amax(np.absolute(diff_data))<EOL>stats[var]["<STR_LIT>"] = str(<EOL>np.unravel_index(np.absolute(diff_data).argmax(), diff_data.shape))<EOL>stats[var]["<STR_LIT>"] = np.sqrt(np.sum(np.square(diff_data).flatten()) /<EOL>diff_data.size)<EOL>pf = plot_bit_for_bit(fname, var, m_vardata, b_vardata, diff_data)<EOL><DEDENT>else:<EOL><INDENT>stats[var]["<STR_LIT>"] = stats[var]["<STR_LIT>"] = <NUM_LIT:0><EOL>pf = stats[var]["<STR_LIT>"] = "<STR_LIT>"<EOL><DEDENT>stats[var]["<STR_LIT>"] = pf<EOL><DEDENT>else:<EOL><INDENT>stats[var] = {"<STR_LIT>": "<STR_LIT>", "<STR_LIT>": "<STR_LIT>", "<STR_LIT>": "<STR_LIT>"}<EOL><DEDENT><DEDENT>model_data.close()<EOL>bench_data.close()<EOL>return elements.bit_for_bit("<STR_LIT>", headers, stats)<EOL>
Checks whether the given files have bit for bit solution matches
on the given variable list.

Args:
    model_path: absolute path to the model dataset
    bench_path: absolute path to the benchmark dataset
    config: the configuration of the set of analyses

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