Exemplo n.º 1
0
                     18]  # same-day forecast, highlight, within [4,18]
    highlight_X_1 = [
        6, 7, 8, 9, 17, 18, 19
    ]  # 1-day-ahead forecast, highlight the hour/month on the plot
else:  # if DST[0]==False
    highlight_X_0 = [7, 8, 9,
                     17]  # same-day forecast, highlight, within [5,17]
    highlight_X_1 = [6, 7, 8, 9, 17, 18, 19]
# ------------------#
show_plot = 1
save_plot = 0
# --------------------------------------------------------------------------------------------------------------------#
for k in k_list:
    df = import_preprocess(station=k,
                           yr=year,
                           fulldata=True,
                           actual_diff=False,
                           fcst_diff=True)

    # plot for a day
    # dh = df[(df.daysahead == 1) & (df.month == 1) & (df.date == date(2019, 1, 2))]
    # plt.plot(dh.ept, dh[y])

    # for season_no, season in enumerate(seasons, 1):  # start season index is 1

    # By X boxplot
    if by_X_boxplot:
        sns.set_style("ticks")
        for horizon in range(1, 2):
            dh = df[(df.daysahead == horizon) & (df.DST.isin(DST))]
            # if season_no == 1:
Exemplo n.º 2
0
# --------------------------------#
check_actual_outlier_boxplot = 0  # check if there is any outliers/data issues in actual temperature data
check_daysahead_err_boxplot = 0  # check errors for each daysahead
# --------------------------------#
save_plot = 0
show_plot = 1
# zero_dif = 1  # find out when forecast Temp change is 0, what's the forecast error looks like
after_1000 = 0  # this is used for apple-to-apple comparison between same-day and 1-day-ahead. same-day only has forecasts after 1000am
highlight_month = []

# ----------------------------------------------------------------------------------------------------------------#

# %% Plot
for k in k_list:
    if plot_scatter:
        df = import_preprocess(station=k, yr=year)
        for horizon in range(1, 2):
            dh = df[df.daysahead == horizon]

            if after_1000:
                dh = df[(df.year.isin(year)) & (df.daysahead == horizon) & (df.hour > 10)]

            # show average error on plots
            avg_err = np.around(np.mean(df[(df.year.isin(year)) & (df.daysahead == horizon)].err), decimals=3)

            # if zero_dif:
            #     for i in range(3):  # col
            #         for j in range(3):  # row
            #             colname = 'dif' + str(i + j * 3 + 1)
            #             zero = dh[dh[x + colname] == 0]
            #             freq = zero.groupby([x + colname, y]).size().reset_index(name="occurrance")  # coordinate freq