Exemplo n.º 1
0
def test_get_stat_plot_name():
    # Independently test getting the
    # a more formalized statistic name
    # Test 1
    stat = 'bias'
    expected_stat_plot_name = 'Bias'
    test_stat_plot_name = plot_util.get_stat_plot_name(logger, stat)
    assert (test_stat_plot_name == expected_stat_plot_name)
    # Test 2
    stat = 'rmse_md'
    expected_stat_plot_name = 'Root Mean Square Error from Mean Error'
    test_stat_plot_name = plot_util.get_stat_plot_name(logger, stat)
    assert (test_stat_plot_name == expected_stat_plot_name)
    # Test 3
    stat = 'fbar_obar'
    expected_stat_plot_name = 'Forecast and Observation Averages'
    test_stat_plot_name = plot_util.get_stat_plot_name(logger, stat)
    assert (test_stat_plot_name == expected_stat_plot_name)
    # Test 4
    stat = 'acc'
    expected_stat_plot_name = 'Anomaly Correlation Coefficient'
    test_stat_plot_name = plot_util.get_stat_plot_name(logger, stat)
    assert (test_stat_plot_name == expected_stat_plot_name)
    # Test 5
    stat = 'vdiff_speed'
    expected_stat_plot_name = 'Difference Vector Speed'
    test_stat_plot_name = plot_util.get_stat_plot_name(logger, stat)
    assert (test_stat_plot_name == expected_stat_plot_name)
    # Test 6
    stat = 'baser'
    expected_stat_plot_name = 'Base Rate'
    test_stat_plot_name = plot_util.get_stat_plot_name(logger, stat)
    assert (test_stat_plot_name == expected_stat_plot_name)
    # Test 7
    stat = 'fbias'
    expected_stat_plot_name = 'Frequency Bias'
    test_stat_plot_name = plot_util.get_stat_plot_name(logger, stat)
    assert (test_stat_plot_name == expected_stat_plot_name)
Exemplo n.º 2
0
file_handler.setFormatter(formatter)
logger.addHandler(file_handler)
nmodels = len(model_name_list)
fcst_var_thresh_val_array = np.asarray(fcst_var_thresh_val_list, dtype=float)
CI_bar_max_widths = np.append(
    np.diff(fcst_var_thresh_counts),
    fcst_var_thresh_counts[-1] - fcst_var_thresh_counts[-2]) / 1.5
CI_bar_min_widths = np.append(
    np.diff(fcst_var_thresh_counts),
    fcst_var_thresh_counts[-1] - fcst_var_thresh_counts[-2]) / nmodels
CI_bar_intvl_widths = ((CI_bar_max_widths - CI_bar_min_widths) / nmodels)

# Read and plot data
for stat in plot_stats_list:
    logger.debug("Working on " + stat)
    stat_plot_name = plot_util.get_stat_plot_name(logger, stat)
    stat_min_max_dict = {
        'ax1_stat_min': np.ma.masked_invalid(np.nan),
        'ax1_stat_max': np.ma.masked_invalid(np.nan),
        'ax2_stat_min': np.ma.masked_invalid(np.nan),
        'ax2_stat_max': np.ma.masked_invalid(np.nan)
    }
    logger.info("Reading in model data")
    for model in model_info:
        model_num = model_info.index(model) + 1
        model_index = model_info.index(model)
        model_name = model[0]
        model_plot_name = model[1]
        model_plot_settings_dict = (
            model_obs_plot_settings_dict['model' + str(model_num)])
        if stat == "fbar_obar":