Commit 486c4760 authored by sp2668's avatar sp2668

basemap integration

parent 40c77856
This diff is collapsed.
......@@ -11,9 +11,8 @@ from sklearn.cluster import KMeans, SpectralClustering
from mpl_toolkits.basemap import Basemap
### FUNCTIONS
def plot_clusters(network, y_pred,X,lim_fig="None"):
colors_choice=['b', 'g', 'r', 'c', 'y', 'violet','purple','k','chartreuse','indianred','pink','orange','gray','yellow','springgreen','indigo','brown','silver','aqua']*(int(max(y_pred)/19)+1)
colors_list = [ colors_choice[x] for x in y_pred]
......@@ -33,10 +32,10 @@ def plot_clusters(network, y_pred,X,lim_fig="None"):
plt.show()
def plot_network(network,option="AC_DC",basemap="no"):
fig, ax = plt.subplots()
fig.set_size_inches(15,15)
if basemap=="yes":
long_min=-10
long_max=30
......@@ -77,6 +76,7 @@ def plot_network(network,option="AC_DC",basemap="no"):
plt.legend(handles=[blue_line,green_line,orange_line,red_line,violet_line])
def find_kmeans_busmap(n_clusters, n, n_weightings, **kwargs):
kmeans = KMeans(init='k-means++', n_clusters=n_clusters, ** kwargs)
kmeans.fit(n[["x","y"]].values)
......@@ -104,6 +104,7 @@ def P_nom_re(network,w_s=2.5,w_onw=0.2,w_ofw=0.1):
network.generators.loc[network.generators['carrier'] == 'offwind',"p_nom"]=network.generators.loc[network.generators['carrier'] == 'offwind',"weight"]*w_ofw
def lopf_d_h(network,day,hour):
network.set_snapshots(pd.DatetimeIndex(start=hour.format(day), end=hour.format(day), freq='H'))
# solve linear optimal power flow
......@@ -111,6 +112,7 @@ def lopf_d_h(network,day,hour):
solver_name='glpk')
def plot_line_loading(network):
fig, ax = plt.subplots()
ax.set_ylim([35,72])
fig.set_size_inches(15,15)
......@@ -132,6 +134,7 @@ def plot_line_loading(network):
plt.colorbar(fraction=0.01, pad=0.01)
def plot_bus_status(network):
fig, ax = plt.subplots()
ax.set_ylim([35,72])
fig.set_size_inches(15,15)
......@@ -169,6 +172,7 @@ def plot_bus_status(network):
plt.colorbar(fraction=0.01, pad=0.01)
def plot_line_loading_bus_status(network):
fig, ax = plt.subplots()
ax.set_ylim([35,72])
fig.set_size_inches(15,15)
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment