def write_output_metadata(output_params):
if "<STR_LIT:path>" in output_params:<EOL><INDENT>metadata_path = os.path.join(output_params["<STR_LIT:path>"], "<STR_LIT>")<EOL>logger.debug("<STR_LIT>", metadata_path)<EOL>try:<EOL><INDENT>existing_params = read_output_metadata(metadata_path)<EOL>logger.debug("<STR_LIT>", metadata_path)<EOL>logger.debug("<STR_LIT>", pformat(existing_params))<EOL>existing_tp = existing_params["<STR_LIT>"]<EOL>current_params = params_to_dump(output_params)<EOL>logger.debug("<STR_LIT>", pformat(current_params))<EOL>current_tp = BufferedTilePyramid(**current_params["<STR_LIT>"])<EOL>if existing_tp != current_tp:<EOL><INDENT>raise MapcheteConfigError(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>" % (existing_tp, current_tp)<EOL>)<EOL><DEDENT>existing_format = existing_params["<STR_LIT>"]["<STR_LIT>"]<EOL>current_format = current_params["<STR_LIT>"]["<STR_LIT>"]<EOL>if existing_format != current_format:<EOL><INDENT>raise MapcheteConfigError(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>" % (<EOL>(existing_format, current_format)<EOL>)<EOL>)<EOL><DEDENT><DEDENT>except FileNotFoundError:<EOL><INDENT>logger.debug("<STR_LIT>", metadata_path)<EOL>dump_params = params_to_dump(output_params)<EOL>write_json(metadata_path, dump_params)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>logger.debug("<STR_LIT>")<EOL><DEDENT>
Dump output JSON and verify parameters if output metadata exist.