diff --git a/docs/dist_system/plotting.ipynb b/docs/dist_system/plotting.ipynb index 9e534bbf..cda950de 100644 --- a/docs/dist_system/plotting.ipynb +++ b/docs/dist_system/plotting.ipynb @@ -377,6 +377,7 @@ } ], "source": [ + "! pip install matplotlib\n", "## Plotting using Matplotlib\n", "\n", "df = distribution_system.to_gdf()\n", diff --git a/docs/dist_system/test.csv b/docs/dist_system/test.csv new file mode 100644 index 00000000..38f94704 --- /dev/null +++ b/docs/dist_system/test.csv @@ -0,0 +1,22 @@ +,Name,Type,kV,Phases,X,Y,geometry,Length +0,p5rdt149-p5rhs0_1247x,DistributionBus,7.199557856794634,"A,B,C",36.60102672210813,-120.91292875147646,POINT (36.60102672210813 -120.91292875147646), +1,p5rdt149-p5rhs0_1247x_b1_1,DistributionBus,7.199557856794634,"A,B,C",36.59776619575616,-120.91984825250762,POINT (36.59776619575616 -120.91984825250762), +2,p5rdt149lv,DistributionBus,0.27712812921102037,"A,B,C",36.56885399412164,-120.96155778160369,POINT (36.56885399412164 -120.96155778160369), +3,p5rlv265,DistributionBus,0.27712812921102037,"A,B,C",36.56884369179864,-120.96150686468123,POINT (36.56884369179864 -120.96150686468123), +4,p5rdt22lv,DistributionBus,0.27712812921102037,"A,B,C",36.588975013233814,-120.97495604893834,POINT (36.588975013233814 -120.97495604893834), +5,p5rlv40,DistributionBus,0.27712812921102037,"A,B,C",36.58898169475094,-120.9749855407454,POINT (36.58898169475094 -120.9749855407454), +6,p5rdt149,DistributionBus,7.199557856794634,"A,B,C",36.56887241444432,-120.96160511254412,POINT (36.56887241444432 -120.96160511254412), +7,p5rdt149-p5rdt22x,DistributionBus,7.199557856794634,"A,B,C",36.584033672730996,-120.97076724677004,POINT (36.584033672730996 -120.97076724677004), +8,p5rdt22,DistributionBus,7.199557856794634,"A,B,C",36.588933180522076,-120.97494941278845,POINT (36.588933180522076 -120.97494941278845), +9,p5rdt149-p5rhs0_1247x_b2_1,DistributionBus,7.199557856794634,"A,B,C",36.593633797608774,-120.92580511661268,POINT (36.593633797608774 -120.92580511661268), +10,l(r:p5rdt149-p5rhs0_1247),MatrixImpedanceBranch,,"A,B,C","[36.60102672210813, 36.59776619575616]","[-120.91292875147646, -120.91984825250762]","LINESTRING (36.60102672210813 -120.91292875147646, 36.59776619575616 -120.91984825250762)",1842.0308398950133 +11,l(r:p5rdt149-p5rhs0_1247)_disconnect,MatrixImpedanceSwitch,,"A,B,C","[36.59776619575616, 36.593633797608774]","[-120.91984825250762, -120.92580511661268]","LINESTRING (36.59776619575616 -120.91984825250762, 36.593633797608774 -120.92580511661268)",0.0032808398950131233 +12,l(r:p5rdt149lv-p5rlv265),MatrixImpedanceBranch,,"A,B,C","[36.56885399412164, 36.56884369179864]","[-120.96155778160369, -120.96150686468123]","LINESTRING (36.56885399412164 -120.96155778160369, 36.56884369179864 -120.96150686468123)",3.280839895013124 +13,tr(r:p5rdt149-p5rdt149lv),DistributionTransformer,,"A,B,C +A,B,C","[36.56885399412164, 36.56887241444432]","[-120.96155778160369, -120.96160511254412]","LINESTRING (36.56885399412164 -120.96155778160369, 36.56887241444432 -120.96160511254412)",15.0 +14,l(r:p5rdt22lv-p5rlv40),MatrixImpedanceBranch,,"A,B,C","[36.588975013233814, 36.58898169475094]","[-120.97495604893834, -120.9749855407454]","LINESTRING (36.588975013233814 -120.97495604893834, 36.58898169475094 -120.9749855407454)",14.600000000000005 +15,tr(r:p5rdt22-p5rdt22lv),DistributionTransformer,,"A,B,C +A,B,C","[36.588975013233814, 36.588933180522076]","[-120.97495604893834, -120.97494941278845]","LINESTRING (36.588975013233814 -120.97495604893834, 36.588933180522076 -120.97494941278845)",15.0 +16,l(r:p5rdt149-p5rdt22)_s0,MatrixImpedanceBranch,,"A,B,C","[36.56887241444432, 36.584033672730996]","[-120.96160511254412, -120.97076724677004]","LINESTRING (36.56887241444432 -120.96160511254412, 36.584033672730996 -120.97076724677004)",2722.5360892388453 +17,l(r:p5rdt149-p5rhs0_1247)_cont,MatrixImpedanceBranch,,"A,B,C","[36.56887241444432, 36.593633797608774]","[-120.96160511254412, -120.92580511661268]","LINESTRING (36.56887241444432 -120.96160511254412, 36.593633797608774 -120.92580511661268)",16607.80511811024 +18,l(r:p5rdt149-p5rdt22)_s1,MatrixImpedanceBranch,,"A,B,C","[36.584033672730996, 36.588933180522076]","[-120.97076724677004, -120.97494941278845]","LINESTRING (36.584033672730996 -120.97076724677004, 36.588933180522076 -120.97494941278845)",6150.688976377954 diff --git a/src/gdm/distribution/distribution_system.py b/src/gdm/distribution/distribution_system.py index 799307cc..60d42dbe 100644 --- a/src/gdm/distribution/distribution_system.py +++ b/src/gdm/distribution/distribution_system.py @@ -714,9 +714,9 @@ def plot( self._add_node_traces(fig, nodes_gdf, color_node_by, map_type, flip_coordinates) if flip_coordinates: - center_x, center_y = center.x, center.y - else: center_y, center_x = center.x, center.y + else: + center_x, center_y = center.x, center.y if map_type == MapType.SCATTER_MAP: fig.update_layout( @@ -772,11 +772,11 @@ def _add_node_traces( ] if not flip_coordinates: - lon = filt_gdf.geometry.y - lat = filt_gdf.geometry.x - else: lon = filt_gdf.geometry.x lat = filt_gdf.geometry.y + else: + lon = filt_gdf.geometry.y + lat = filt_gdf.geometry.x fig.add_trace( map_obj( @@ -820,9 +820,9 @@ def _add_edge_traces( continue for linestring in linestrings: if not flip_coordinates: - y, x = linestring.xy - else: x, y = linestring.xy + else: + y, x = linestring.xy lats = np.append(lats, y) lons = np.append(lons, x) types = np.append(types, [model_type] * len(y))