@@ -157,11 +157,11 @@ def struct_open_props(struct, th_data, out_freq="15min", datetime_idx=None):
157157 For instance, a simple gate might just be (width * height)/(max(width) * max(height))
158158 """
159159
160- if struct . type == "weir" :
160+ if struct [ " type" ] == "weir" :
161161 # width, elevation, op_down, op_up
162162 up_cols_to_multiply = ["install" , "ndup" , "op_up" , "elev" , "width" ]
163163 down_cols_to_multiply = ["install" , "ndup" , "op_down" , "elev" , "width" ]
164- elif struct . type == "radial" :
164+ elif struct [ " type" ] == "radial" :
165165 # width, height, elevation, op_down, op_up
166166 up_cols_to_multiply = ["install" , "ndup" , "op_up" , "elev" , "width" , "height" ]
167167 down_cols_to_multiply = [
@@ -172,11 +172,11 @@ def struct_open_props(struct, th_data, out_freq="15min", datetime_idx=None):
172172 "width" ,
173173 "height" ,
174174 ]
175- elif struct . type == "culvert" :
175+ elif struct [ " type" ] == "culvert" :
176176 # rad, elevation, op_down, op_up
177177 up_cols_to_multiply = ["install" , "ndup" , "op_up" , "elev" , "rad" ]
178178 down_cols_to_multiply = ["install" , "ndup" , "op_down" , "elev" , "rad" ]
179- elif struct . type == "radial_relheight" :
179+ elif struct [ " type" ] == "radial_relheight" :
180180 # width, height, elevation, op_down, op_up
181181 up_cols_to_multiply = ["install" , "ndup" , "op_up" , "elev" , "width" , "height" ]
182182 down_cols_to_multiply = [
@@ -187,7 +187,7 @@ def struct_open_props(struct, th_data, out_freq="15min", datetime_idx=None):
187187 "width" ,
188188 "height" ,
189189 ]
190- elif struct . type == "weir_culvert" :
190+ elif struct [ " type" ] == "weir_culvert" :
191191 # elevation, width, op_down, op_up - weirs
192192 # elevation, width, op_up, op_down - culvert
193193 up_cols_to_multiply = [
@@ -213,7 +213,7 @@ def struct_open_props(struct, th_data, out_freq="15min", datetime_idx=None):
213213 "down_op_pipe" ,
214214 ]
215215 else :
216- raise ValueError (f"structure type { struct . type } is not yet supported!" )
216+ raise ValueError (f"structure type { struct [ ' type' ] } is not yet supported!" )
217217
218218 # Take the dataframe and normalize to max/min of each column
219219 norm_df = normalize_df (th_data )
@@ -225,8 +225,8 @@ def struct_open_props(struct, th_data, out_freq="15min", datetime_idx=None):
225225 norm_df = norm_df .ffill ()
226226
227227 up_df = norm_df [["open_up" ]].copy ()
228- up_df .columns = [f"{ struct . name } _up" ]
228+ up_df .columns = [f"{ struct [ ' name' ] } _up" ]
229229 down_df = norm_df [["open_down" ]].copy ()
230- down_df .columns = [f"{ struct . name } _down" ]
230+ down_df .columns = [f"{ struct [ ' name' ] } _down" ]
231231
232232 return up_df , down_df
0 commit comments