<jupyter_start><jupyter_text>There is a single data point that is nearly twice the maximum power that is supposed to be delivered to campus, I am forcing it to be the maximum value because there is only one in the entire dataset.<jupyter_code>power_data.plot()
power_data.rename(columns={'Time':'time', 'MWh':'kw'})
years = power_data.groupby(power_data.index.year)

df17 = years.get_group(2017)
df18 = years.get_group(2018)
df18.plot()
df18['MWh'].sum()
# df18.resample('H').mean()
df18<jupyter_output><empty_output><jupyter_text>Compare to wind speed model...<jupyter_code>power_model = pd.read_csv(path+"windHistories_2.csv")
power_model.plot()
power_model['power'].sum()/1000
power_model[power_model['power']>8800]=8800
power_model['power'].sum()/1000<jupyter_output><empty_output><jupyter_text>Prepare and pass to RAVENI am grabbing the typical wind speeds from the ~typical wind power file~. Actually, I can just pull the data from the lincoln weather file.<jupyter_code>typwind = pd.read_csv(path+"TypicalWind_0.csv")
typwind
lincoln_wind = pd.read_csv(path+'lincoln_weather_clean.csv', parse_dates=True, index_col='time')
lincoln_wind
wind_years = lincoln_wind.groupby(lincoln_wind.index.year)
wind17=wind_years.get_group(2017)
wind18=wind_years.get_group(2018)
# check if there are NaN values
print("The data frame is missing values:", wind17.isnull().values.any())

# interpolate
wind17 = wind17.interpolate(method='linear')

# check if there are NaN values
print("The data frame is missing values:", wind17.isnull().values.any())
# check if there are NaN values
print("The data frame is missing values:", wind18.isnull().values.any())

# interpolate
wind18 = wind18.interpolate(method='linear')

# check if there are NaN values
print("The data frame is missing values:", wind18.isnull().values.any())
df17['u'] = wind17['u']
df18['u'] = wind18['u']
import datetime as dt
fig,ax = plt.subplots(figsize=(12,9))
ax.plot(df18.index, df17['u'], label='Wind Speed [m/s]')
ax.plot(df18.index, df17['MWh'], label='Power [MW]')
ax.set_xlim(dt.date(2018,12,1), dt.date(2019,1,1))
ax.legend()
ax.set_title("Wind Speeds Compared With Power Generation at Rail Splitter WF", fontsize=18)
ax.set_xlabel("Date")
df17.reset_index(inplace=True)
df17.rename(columns={'Time':'time','MWh':'mw'},inplace=True)
df17['time'] = df17.index
df17
df18.reset_index(inplace=True)
df18.rename(columns={'Time':'time','MWh':'mw'}, inplace=True)
df18['time'] = df18.index
df18
# writes the header file for RAVEN
fname = 'railsplitter_data201'
sun_keys = [fname + str(i) + '.csv' for i in range(7,9,1)]
header_file = pd.DataFrame({'scaling':np.zeros(len(sun_keys), dtype=np.int8), 'filename':sun_keys})
header_file.to_csv(path+'railsplitter_H.csv')
df17.to_csv(path+"railsplitter_data2017.csv")
df18.to_csv(path+"railsplitter_data2018.csv")
if platform.system() == 'Windows':
    !git-bash %userprofile%/research/raven/raven_framework %userprofile%/research/pride/inputfiles/typical_railsplitter.xml
else:
    !~/research/raven/raven_framework ~/research/pride/inputfiles/typical_railsplitter.xml
typical_railsplitter = pd.read_csv(path+"TypicalRailSplitter_0.csv")

typical_railsplitter['date'] = pd.date_range(start='1/1/2018', end='1/1/2019', freq='H')[:8760]
import matplotlib.dates as mdates
import datetime


# Set the locator
locator = mdates.MonthLocator()  # every month
# Specify the format - %b gives us Jan, Feb...
fmt = mdates.DateFormatter('%b')

fig,ax = plt.subplots(1,1,figsize=(12,9), edgecolor='k', facecolor='w')
ax.plot(typical_railsplitter.date, typical_railsplitter.mw*1000)
ax.set_title('Typical Year of Wind Power at UIUC (Rail Splitter)', fontsize=24)
ax.set_xlabel('Date', fontsize=18)
ax.set_ylabel('Power [kWh/hour]',fontsize=18)
ax.set_xlim(datetime.date(2018,1,1), datetime.date(2019,1,1))
ax.set_ylim(0, 10000)
X = plt.gca().xaxis
X.set_major_locator(locator)
# Specify formatter
X.set_major_formatter(fmt)
plt.show()
if platform.system() == 'Windows':
    !git-bash %userprofile%/research/raven/raven_framework %userprofile%/research/pride/inputfiles/railsplitter_arma.xml
else:
    !~/research/raven/raven_framework ~/research/pride/inputfiles/railsplitter_arma.xml
synthetic_history = pd.read_csv(path+"RailSplitterHistories_2.csv")
synthetic_history
over_max = synthetic_history.mw > 8.643
synthetic_history.mw.mask(over_max, 8.643, inplace=True)
# plot synthetic history
fig,ax = plt.subplots(1,1,figsize=(12,9), edgecolor='k', facecolor='w')
ax.plot(synthetic_history['time'], synthetic_history['mw']*1000, 
         color='tab:red',lw = 0.5, label='Synthetic Rail Splitter Generation')
ax.plot(typical_railsplitter['time'], typical_railsplitter['mw']*1000, 
         color='tab:blue', lw=0.5, label='Typical Rail Splitter Generation')
ax.set_ylabel("Wind Power [kWh]", fontsize=18)
ax.set_xlabel("Time (hours)", fontsize=18)
ax.set_ylim(0,10000)
ax.set_xlim(0,8760)
ax.legend(fontsize=14, fancybox=True)
ax.set_title("Synthetic and Typical Wind Power Histories (Rail Splitter)", fontsize=24)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15409054805401112, 'fraction_numerical': 0.04646544876886418, 'mean_word_length': 7.298187808896211, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '219381', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 2023, 'n_tokens_neox': 1820, 'n_words': 355, 'path': 'data_processing/railsplitter_data.ipynb', 'repo_name': 'datw0258/2020-dotson-optimal-sizing', 'size': '5036'}