@@ -44,11 +44,11 @@ def create_measurements_from_analog(self):
44
44
'PowerSystemResource' , 'positiveFlowIn' ]],
45
45
self .cim ['eq' ]['AnalogValue' ][['sensorAccuracy' , 'MeasurementValueSource' , 'Analog' , 'value' ]],
46
46
how = 'inner' , left_on = 'rdfId' , right_on = 'Analog' )
47
- analogs .drop (columns = ['rdfId' , 'Analog' ], inplace = True )
47
+ analogs = analogs .drop (columns = ['rdfId' , 'Analog' ])
48
48
analogs = pd .merge (analogs , self .cim ['eq' ]['MeasurementValueSource' ], how = 'left' ,
49
49
left_on = 'MeasurementValueSource' ,
50
50
right_on = 'rdfId' )
51
- analogs .drop (columns = ['rdfId' , 'MeasurementValueSource' ], inplace = True )
51
+ analogs = analogs .drop (columns = ['rdfId' , 'MeasurementValueSource' ])
52
52
# collect all the assets (line, trafo, trafo3w) and its connections
53
53
assets = pd .DataFrame (None , columns = ['element_type' , 'side' ])
54
54
append_dict = dict ({'line' : {'from_bus' : 'from' , 'to_bus' : 'to' },
@@ -61,7 +61,7 @@ def create_measurements_from_analog(self):
61
61
temp ['element_type' ] = element_type
62
62
temp ['side' ] = side
63
63
assets = pd .concat ([assets , temp ], sort = False )
64
- assets .rename (columns = {'index' : 'element' }, inplace = True )
64
+ assets = assets .rename (columns = {'index' : 'element' })
65
65
# now join the analogs with the assets
66
66
psr = pd .merge (analogs , assets , how = 'inner' , left_on = 'PowerSystemResource' , right_on = sc ['o_id' ])
67
67
# keep only entries which are associated to the terminal from the asset
@@ -96,24 +96,24 @@ def create_measurements_from_sv(self):
96
96
sc = cim_tools .get_pp_net_special_columns_dict ()
97
97
# get the measurements from the sv profile and set the Terminal as index
98
98
sv_powerflow = self .cim ['sv' ]['SvPowerFlow' ][['Terminal' , 'p' , 'q' ]]
99
- sv_powerflow .set_index ('Terminal' , inplace = True )
99
+ sv_powerflow = sv_powerflow .set_index ('Terminal' )
100
100
101
101
# ---------------------------------------measure: bus v---------------------------------------------------
102
102
busses_temp = self .net .bus [['name' , 'vn_kv' , sc ['ct' ]]].copy ()
103
- busses_temp .reset_index (level = 0 , inplace = True )
104
- busses_temp .rename (columns = {'index' : 'element' , sc ['ct' ]: 'TopologicalNode' }, inplace = True )
103
+ busses_temp = busses_temp .reset_index (level = 0 )
104
+ busses_temp = busses_temp .rename (columns = {'index' : 'element' , sc ['ct' ]: 'TopologicalNode' })
105
105
sv_sv_voltages = pd .merge (self .cim ['sv' ]['SvVoltage' ][['TopologicalNode' , 'v' ]], busses_temp ,
106
106
how = 'left' , on = 'TopologicalNode' )
107
107
# drop all the rows mit vn_kv == np.NaN (no measurements available for that bus)
108
- sv_sv_voltages .dropna (subset = ['vn_kv' ], inplace = True )
108
+ sv_sv_voltages = sv_sv_voltages .dropna (subset = ['vn_kv' ])
109
109
sv_sv_voltages .reset_index (inplace = True )
110
110
if 'index' in sv_sv_voltages .columns :
111
- sv_sv_voltages .drop (['index' ], inplace = True , axis = 1 )
111
+ sv_sv_voltages = sv_sv_voltages .drop (['index' ], axis = 1 )
112
112
# value -> voltage ()
113
113
sv_sv_voltages ['value' ] = sv_sv_voltages .v / sv_sv_voltages .vn_kv
114
114
sv_sv_voltages ['value' ].replace (0 , np .nan , inplace = True )
115
115
# drop all the rows mit value == np.NaN
116
- sv_sv_voltages .dropna (subset = ['value' ], inplace = True )
116
+ sv_sv_voltages = sv_sv_voltages .dropna (subset = ['value' ])
117
117
sv_sv_voltages .reset_index (inplace = True )
118
118
sv_sv_voltages ['value_stddev' ] = sv_sv_voltages .value * 0.001
119
119
sv_sv_voltages ['vn_kv_stddev' ] = 0.1 / sv_sv_voltages .vn_kv
@@ -136,7 +136,7 @@ def create_measurements_from_sv(self):
136
136
line_temp ['q_to' ] = \
137
137
pd .merge (line_temp [sc ['t_to' ]], sv_powerflow ['q' ], left_on = sc ['t_to' ], right_index = True )['q' ]
138
138
139
- line_temp .dropna (subset = ['p_from' , 'p_to' , 'q_from' , 'q_to' ], thresh = 4 , inplace = True )
139
+ line_temp = line_temp .dropna (subset = ['p_from' , 'p_to' , 'q_from' , 'q_to' ], thresh = 4 )
140
140
141
141
line_temp ['stddev_line_from_p' ] = abs (line_temp .p_from ) * sigma_line + 1.
142
142
line_temp ['stddev_line_to_p' ] = abs (line_temp .p_to ) * sigma_line + 1.
@@ -181,7 +181,7 @@ def create_measurements_from_sv(self):
181
181
trafo_temp ['q_lv' ] = \
182
182
pd .merge (trafo_temp [sc ['t_lv' ]], sv_powerflow ['q' ], left_on = sc ['t_lv' ], right_index = True )['q' ]
183
183
184
- trafo_temp .dropna (subset = ['p_hv' , 'p_lv' , 'q_hv' , 'q_lv' ], thresh = 4 , inplace = True )
184
+ trafo_temp = trafo_temp .dropna (subset = ['p_hv' , 'p_lv' , 'q_hv' , 'q_lv' ], thresh = 4 )
185
185
186
186
trafo_temp ['stddev_trafo_hv_p' ] = abs (trafo_temp .p_hv ) * sigma_trafo + 1.
187
187
trafo_temp ['stddev_trafo_lv_p' ] = abs (trafo_temp .p_lv ) * sigma_trafo + 1.
@@ -230,7 +230,7 @@ def create_measurements_from_sv(self):
230
230
trafo3w_temp ['q_lv' ] = \
231
231
pd .merge (trafo3w_temp [sc ['t_lv' ]], sv_powerflow ['q' ], left_on = sc ['t_lv' ], right_index = True )['q' ]
232
232
233
- trafo3w_temp .dropna (subset = ['p_hv' , 'p_mv' , 'p_lv' , 'q_hv' , 'q_mv' , 'q_lv' ], thresh = 6 , inplace = True )
233
+ trafo3w_temp = trafo3w_temp .dropna (subset = ['p_hv' , 'p_mv' , 'p_lv' , 'q_hv' , 'q_mv' , 'q_lv' ], thresh = 6 )
234
234
235
235
trafo3w_temp ['stddev_trafo_hv_p' ] = abs (trafo3w_temp .p_hv ) * sigma_trafo3w + 1.
236
236
trafo3w_temp ['stddev_trafo_mv_p' ] = abs (trafo3w_temp .p_mv ) * sigma_trafo3w + 1.
@@ -275,7 +275,7 @@ def create_measurements_from_sv(self):
275
275
self ._copy_to_measurement (trafo3w_temp )
276
276
277
277
# remove NaN values
278
- self .net .measurement . dropna (subset = ['value' ], inplace = True )
278
+ self .net .measurement = self . net . measurement . dropna (subset = ['value' ])
279
279
# set the element from float to default uint32
280
280
self ._set_measurement_element_datatype ()
281
281
0 commit comments