def test_get_stat_file_base_columns(): # Independently test getting list # of the base MET version .stat file columns # Test 1 met_version = '8.0' expected_stat_file_base_columns = [ 'VERSION', 'MODEL', 'DESC', 'FCST_LEAD', 'FCST_VALID_BEG', 'FCST_VALID_END', 'OBS_LEAD', 'OBS_VALID_BEG', 'OBS_VALID_END', 'FCST_VAR', 'FCST_LEV', 'OBS_VAR', 'OBS_LEV', 'OBTYPE', 'VX_MASK', 'INTERP_MTHD', 'INTERP_PNTS', 'FCST_THRESH', 'OBS_THRESH', 'COV_THRESH', 'ALPHA', 'LINE_TYPE' ] test_stat_file_base_columns = plot_util.get_stat_file_base_columns( met_version) assert (test_stat_file_base_columns == expected_stat_file_base_columns) # Test 2 met_version = '8.1' expected_stat_file_base_columns = [ 'VERSION', 'MODEL', 'DESC', 'FCST_LEAD', 'FCST_VALID_BEG', 'FCST_VALID_END', 'OBS_LEAD', 'OBS_VALID_BEG', 'OBS_VALID_END', 'FCST_VAR', 'FCST_UNITS', 'FCST_LEV', 'OBS_VAR', 'OBS_UNITS', 'OBS_LEV', 'OBTYPE', 'VX_MASK', 'INTERP_MTHD', 'INTERP_PNTS', 'FCST_THRESH', 'OBS_THRESH', 'COV_THRESH', 'ALPHA', 'LINE_TYPE' ] test_stat_file_base_columns = plot_util.get_stat_file_base_columns( met_version) assert (test_stat_file_base_columns == expected_stat_file_base_columns)
event_equalization = os.environ['EVENT_EQUALIZATION'] met_version = os.environ['MET_VERSION'] logger = logging.getLogger(os.environ['LOGGING_FILENAME']) logger.setLevel(os.environ['LOGGING_LEVEL']) formatter = logging.Formatter( "%(asctime)s.%(msecs)03d (%(filename)s:%(lineno)d) " "%(levelname)s: %(message)s", "%m/%d %H:%M:%S") file_handler = logging.FileHandler(os.environ['LOGGING_FILENAME'], mode='a') file_handler.setFormatter(formatter) logger.addHandler(file_handler) plot_time_dates, expected_stat_file_dates = plot_util.get_date_arrays( plot_time, start_date_YYYYmmdd, end_date_YYYYmmdd, valid_time_info, init_time_info, lead) total_days = len(plot_time_dates) stat_file_base_columns = plot_util.get_stat_file_base_columns(met_version) logger.info("Reading in model data") for model in model_info: model_num = model_info.index(model) + 1 model_name = model[0] model_plot_name = model[1] model_data_now_index = pd.MultiIndex.from_product( [[model_plot_name], expected_stat_file_dates], names=['model_plot_name', 'dates']) model_stat_file = os.path.join( stat_file_input_dir_base, verif_case, verif_type, model_plot_name, plot_time + start_date_YYYYmmdd + "to" + end_date_YYYYmmdd + "_valid" + valid_time_info[0] + "to" + valid_time_info[-1] + "Z_init" + init_time_info[0] + "to" + init_time_info[-1] + "Z", model_plot_name + "_f" + lead + "_fcst" + fcst_var_name +