def set_weather_from_metar(<EOL>metar: typing.Union[Metar.Metar, str],<EOL>in_file: typing.Union[str, Path],<EOL>out_file: typing.Union[str, Path] = None<EOL>) -> typing.Tuple[typing.Union[str, None], typing.Union[str, None]]:
error, metar = custom_metar.CustomMetar.get_metar(metar)<EOL>if error:<EOL><INDENT>return error, None<EOL><DEDENT>if metar:<EOL><INDENT>LOGGER.debug('<STR_LIT>', metar.code)<EOL><DEDENT>in_file = elib.path.ensure_file(in_file)<EOL>if out_file is None:<EOL><INDENT>out_file = in_file<EOL><DEDENT>else:<EOL><INDENT>out_file = elib.path.ensure_file(out_file, must_exist=False)<EOL><DEDENT>LOGGER.debug('<STR_LIT>', in_file, out_file)<EOL>try:<EOL><INDENT>LOGGER.debug('<STR_LIT>')<EOL>_mission_weather = mission_weather.MissionWeather(metar)<EOL>with Miz(str(in_file)) as miz:<EOL><INDENT>_mission_weather.apply_to_miz(miz)<EOL>miz.zip(str(out_file))<EOL>return None, f'<STR_LIT>'<EOL><DEDENT><DEDENT>except ValueError:<EOL><INDENT>error = f'<STR_LIT>'f'<STR_LIT>'f'<STR_LIT>'<EOL>return error, None<EOL><DEDENT>
Applies the weather from a METAR object to a MIZ file

Args:
    metar: metar object
    in_file: path to MIZ file
    out_file: path to output MIZ file (will default to in_file)

Returns: tuple of error, success