Пример #1
0
def save_all_plots(error_POE10, error_POE50, error_POE90, actual_demand, fname, prefix, date):
    plt.clf()
    '''To plot POE10 ALL vs actual'''
    plt.plot(error_POE10[1:-1].values, linewidth=0.25)
    plt.plot(actual_demand.values, color='k', linewidth=2)
    plt.title("Actual demand against all POE10 forecasts for %s%s" % (prefix, date))
    plt.xlabel('Samples')
    plt.ylabel('Demand (MW)')
    plt.savefig("../Report/figures/poe10/all_data/POE10_v_actual_%s.eps" % remove_csv(fname), format='eps', dpi=1200)

    '''To plot POE50 ALL vs actual'''
    plt.plot(error_POE50[1:-1].values, linewidth=0.25)
    plt.plot(actual_demand.values, color='k', linewidth=2)
    plt.title("Actual demand against all POE50 forecasts for %s%s" % (prefix, date))
    plt.xlabel('Samples')
    plt.ylabel('Demand (MW)')
    plt.savefig("../Report/figures/poe50/all_data/POE50_v_actual_%s.eps" % remove_csv(fname), format='eps', dpi=1200)

    '''To plot POE90 ALL vs actual'''
    plt.plot(error_POE90[1:-1].values, linewidth=0.25)
    plt.plot(actual_demand.values, color='k', linewidth=2)
    plt.title("Actual demand against all POE90 forecasts for %s%s" % (prefix, date))
    plt.xlabel('Samples')
    plt.ylabel('Demand (MW)')
    plt.savefig("../Report/figures/poe90/all_data/POE90_v_actual_%s.eps" % remove_csv(fname), format='eps', dpi=1200)
    plt.clf()
Пример #2
0
# read the csv files into dictionary of dataframes
# make the dictionary key = name in names
data = OrderedDict()
filenames = []
for filename in os.listdir(DIR):
    if filename.endswith(".CSV") or filename.endswith(".csv"):
        data[filename] = pd.read_csv(DIR + filename)
        data[filename] = data[filename].transpose()
        data[filename].columns = data[filename].iloc[
            0]  # make second row the column row
        filenames.append(filename)  # just in case filenames are needed again
    else:
        continue

for fname, df in data.iteritems():
    date, prefix = convert_date(remove_csv(fname))

    error = df  # initialise error dataframe

    actual_demand = error['ACTUAL_DEMAND'][1:-1].astype(
        float)  # actual demand series

    # filter out the POE levels into seperate dataframes
    error_POE10 = error.filter(regex="^OPERATIONAL_DEMAND_POE10_\d+$")
    error_POE50 = error.filter(regex="^OPERATIONAL_DEMAND_POE50_\d+$")
    error_POE90 = error.filter(regex="^OPERATIONAL_DEMAND_POE90_\d+$")

    # save plots of all the non-error data
    plotting.save_all_plots(error_POE10, error_POE50, error_POE90,
                            actual_demand, fname, prefix, date)
Пример #3
0
# Need to read everything in this time
POE10_filenames, POE10_data = get_data(POE10_DIR)
POE50_filenames, POE50_data = get_data(POE50_DIR)
POE90_filenames, POE90_data = get_data(POE90_DIR)

# set up multi-bar bar chart
poe10_exceedance = exceeds_zero_error(POE10_data["09February2017_avg_err.csv"])
poe50_exceedence = exceeds_zero_error(POE50_data["09February2017_avg_err.csv"])
poe90_exceedence = exceeds_zero_error(POE90_data["09February2017_avg_err.csv"])
poe10_exceedance_2 = exceeds_zero_error(
    POE10_data["10February2017_avg_err.csv"])
poe50_exceedence_2 = exceeds_zero_error(
    POE50_data["10February2017_avg_err.csv"])
poe90_exceedence_2 = exceeds_zero_error(
    POE90_data["10February2017_avg_err.csv"])
date1, prefix1 = convert_date(remove_csv("09February2017_avg_err.csv"))
date2, prefix2 = convert_date(remove_csv("10February2017_avg_err.csv"))

y = [poe10_exceedance, poe50_exceedence, poe90_exceedence]
z = [poe10_exceedance_2, poe50_exceedence_2, poe90_exceedence_2]
x = np.arange(3)

# generate multi-bar bar chart
plotting.generate_multi_bar(x, y, z)

# fnames are shared by all dictionaries
for fname, df in POE10_data.iteritems(
):  # dfs contain the average error values of the POE level specified above
    # get the date and prefix of date (0, 1, 2, etc)
    date, prefix = convert_date(remove_csv(fname))
Пример #4
0
            data[filename] = data[filename].transpose()
            data[filename].columns = data[filename].iloc[
                0]  # make second row the column row
            filenames.append(
                filename)  # just in case filenames are needed again
        else:
            continue
    return filenames, data


POE10_filenames, POE10_data = get_data(POE10_DIR)
POE50_filenames, POE50_data = get_data(POE50_DIR)
POE90_filenames, POE90_data = get_data(POE90_DIR)

for fname, df in POE10_data.iteritems():
    date, prefix = convert_date(remove_csv(fname))  # get date, prefix

    # limit the data to the specified date
    poe10_single_day = df.filter(regex=date)
    poe50_single_day = POE50_data[fname].filter(regex=date)
    poe90_single_day = POE90_data[fname].filter(regex=date)

    # limit the data to a specific point in time, e.g. OPERATIONAL_DEMAND_POE10_201703010000 (row 1)
    data_series = poe10_single_day.iloc[
        1, :]  # Note that this creates a series
    poe50_series = poe50_single_day.iloc[1, :]
    poe90_series = poe90_single_day.iloc[1, :]

    # non-limited data
    poe10_all = df.iloc[1, :]
    poe50_all = POE50_data[fname].iloc[1, :]