Skip to content

Commit

Permalink
codacy issue fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan-Hendrik Menke committed Mar 22, 2017
1 parent 05df48c commit 738ff83
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
2 changes: 1 addition & 1 deletion pandapower/plotting/powerflow_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def plot_voltage_profile(net, plot_transformers=True, ax=None, xlabel="Distance
x0 + d.loc[transformer.lv_bus]],
[net.res_bus.vm_pu.loc[transformer.hv_bus],
net.res_bus.vm_pu.loc[transformer.lv_bus]], color=trafocolor,
**{k:v for k,v in kwargs.items() if not k == "color"})
**{k: v for k, v in kwargs.items() if not k == "color"})
if xlabel:
ax.set_xlabel(xlabel, fontweight="bold", color=(.4, .4, .4))
if ylabel:
Expand Down
34 changes: 19 additions & 15 deletions pandapower/plotting/simple_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@
def simple_plot(net=None, respect_switches=False, line_width=1.0, bus_size=1.0, ext_grid_size=1.0,
bus_color=colors[0], line_color='grey', trafo_color='g', ext_grid_color='y'):
"""
Plots a pandapower network as simple as possible. If no geodata is available, artificial geodata is generated. For advanced plotting see the tutorial
Plots a pandapower network as simple as possible. If no geodata is available, artificial
geodata is generated. For advanced plotting see the tutorial
INPUT:
**net** - The pandapower format network. If none is provided, mv_oberrhein() will be plotted as an example
**net** - The pandapower format network. If none is provided, mv_oberrhein() will be
plotted as an example
OPTIONAL:
**respect_switches** (bool, False) - Respect switches when artificial geodata is created
Expand All @@ -38,23 +40,25 @@ def simple_plot(net=None, respect_switches=False, line_width=1.0, bus_size=1.0,
**bus_size** (float, 1.0) - Relative size of buses to plot.
The value bus_size is multiplied with mean_distance_between_buses, which equals the distance between
The value bus_size is multiplied with mean_distance_between_buses, which equals the
distance between
the max geoocord and the min divided by 200.
mean_distance_between_buses = sum((net['bus_geodata'].max() - net['bus_geodata'].min()) / 200)
mean_distance_between_buses = sum((net['bus_geodata'].max()
- net['bus_geodata'].min()) / 200)
**ext_grid_size** (float, 1.0) - Relative size of ext_grids to plot.
See bus sizes for details. Note: ext_grids are plottet as rectangles
**bus_color** (String, colors[0]) - Bus Color. Init as first value of color palette. Usually colors[0] = "b".
**bus_color** (String, colors[0]) - Bus Color. Init as first value of color palette.
Usually colors[0] = "b".
**line_color** (String, 'grey') - Line Color. Init is grey
**trafo_color** (String, 'g') - Trafo Color. Init is green
**ext_grid_color** (String, 'y') - External Grid Color. Init is yellow
"""
"""
if net is None:
import pandapower.networks as nw
logger.warning("No pandapower network provided -> Plotting mv_oberrhein")
Expand Down Expand Up @@ -84,20 +88,20 @@ def simple_plot(net=None, respect_switches=False, line_width=1.0, bus_size=1.0,
# create bus collections ti plot
bc = create_bus_collection(net, net.bus.index, size=bus_size, color=bus_color, zorder=10)
lc = create_line_collection(net, net.line.index, color=line_color, linewidths=line_width,
use_line_geodata=use_line_geodata)
use_line_geodata=use_line_geodata)
collections = [bc, lc]
eg_buses_with_geocoordinates = set(net.ext_grid.bus.values) & set(net.bus_geodata.index)
if len(eg_buses_with_geocoordinates) > 0:
sc = create_bus_collection(net, eg_buses_with_geocoordinates, patch_type="rect",
eg_buses_with_geo_coordinates = set(net.ext_grid.bus.values) & set(net.bus_geodata.index)
if len(eg_buses_with_geo_coordinates) > 0:
sc = create_bus_collection(net, eg_buses_with_geo_coordinates, patch_type="rect",
size=ext_grid_size, color=ext_grid_color, zorder=11)
collections.append(sc)
# create trafo collection if trafo is available

trafo_buses_with_geocoordinates = [t for t, trafo in net.trafo.iterrows() \
if trafo.hv_bus in net.bus_geodata.index \
trafo_buses_with_geo_coordinates = [t for t, trafo in net.trafo.iterrows()
if trafo.hv_bus in net.bus_geodata.index
and trafo.lv_bus in net.bus_geodata.index]
if len(trafo_buses_with_geocoordinates) > 0:
tc = create_trafo_collection(net, trafo_buses_with_geocoordinates, color=trafo_color)
if len(trafo_buses_with_geo_coordinates) > 0:
tc = create_trafo_collection(net, trafo_buses_with_geo_coordinates, color=trafo_color)
collections.append(tc)

draw_collections(collections)
Expand Down

0 comments on commit 738ff83

Please sign in to comment.