replace_inp_section method #140
-
Hi swmmio.utils.modify_model.replace_inp_section() using the data frame obtained in this way? model = swmmio.Model('example_copy.inp')
df = model.subcatchments.dataframe At this moment I'm able to call replace_inp_section with dataframe extracted this way. df = swmmio.utils.dataframes.dataframe_from_inp(model.inp.path, '[SUBCATCHMENTS]') I want to overwrite columns as N-Imperv, N-Perv, S-Imperv, S-Perv, PctZero. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @BuczynskiRafal, One way you can accomplish overwriting / editing N-Imperv, N-Perv etc. columns is by using the The columns you'd like to overwrite exist in the SUBAREAS section of the inp file. So, as an example, you could modify parameters in your model by doing something like this: model = swmmio.Model('example_copy.inp')
# extract the subareas section of the INP file
subareas = model.inp.subareas
# apply whatever modifications you need to the subareas dataframe
subareas['N-Imperv'] = 0.03
# set the subareas section of the inp object
model.inp.subareas = subareas
# save your updated inp file to disk
model.inp.save('example_model_update.inp') Hopefully that helps! Let me know how you make out. |
Beta Was this translation helpful? Give feedback.
Hi @BuczynskiRafal,
One way you can accomplish overwriting / editing N-Imperv, N-Perv etc. columns is by using the
swmmio.Model.inp
API. Note that theinp
API provides lower-level access to sections of the INP file with getters / setters, whereas theModel.subcatchments
aggregates multiple subcacthment-related sections of the INP file into one dataframe.The columns you'd like to overwrite exist in the SUBAREAS section of the inp file. So, as an example, you could modify parameters in your model by doing something like this: