Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndexError when parsing certain .rpt files #102

Closed
jolson6 opened this issue Sep 23, 2020 · 2 comments · Fixed by #104 or #105
Closed

IndexError when parsing certain .rpt files #102

jolson6 opened this issue Sep 23, 2020 · 2 comments · Fixed by #104 or #105

Comments

@jolson6
Copy link

jolson6 commented Sep 23, 2020

I am using the following code to read and parse the attached .inp and .rpt files:

model = swmmio.Model(inp_file_name)
elem_dict = {element: model.__getattribute__(element).geojson for element in element_types}

When running this code, I get the following error:

  File "/home/jolson/.virtualenvs/rest-api/lib/python3.6/site-packages/swmmio/utils/dataframes.py", line 89, in dataframe_from_rpt
    index_col=0, names=cols)
  File "/home/jolson/.virtualenvs/rest-api/lib/python3.6/site-packages/pandas/io/parsers.py", line 686, in read_csv
    return _read(filepath_or_buffer, kwds)
  File "/home/jolson/.virtualenvs/rest-api/lib/python3.6/site-packages/pandas/io/parsers.py", line 458, in _read
    data = parser.read(nrows)
  File "/home/jolson/.virtualenvs/rest-api/lib/python3.6/site-packages/pandas/io/parsers.py", line 1186, in read
    ret = self._engine.read(nrows)
  File "/home/jolson/.virtualenvs/rest-api/lib/python3.6/site-packages/pandas/io/parsers.py", line 2186, in read
    values = data.pop(self.index_col[i])
IndexError: list index out of range

It seems like the dataframe_from_rpt method has an issue parsing certain kinds of .rpt files. @jennwuu came up with some code to patch this and knows more about why it breaks.

I had to upload the files with a .txt extension to make GitHub happy.

example.rpt.txt
example.inp.txt

@jennwuu
Copy link
Contributor

jennwuu commented Sep 24, 2020

This report section create errors in dataframe_from_rpt function

  **********************
  Node Surcharge Summary
  **********************
  
  No nodes were surcharged.
  
  
  *********************
  Node Flooding Summary
  *********************
  
  No nodes were flooded.
  

@jennwuu
Copy link
Contributor

jennwuu commented Sep 24, 2020

In SWMM engine 5.1.013, there are new columns in Subcatchment Runoff:

  • Imperv Runoff
  • Perv Runoff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants