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

AttributeError: 'SwmmExtract' object has no attribute 'TypeCheck' #15

Open
melissagqc opened this issue Dec 16, 2019 · 6 comments
Open
Assignees

Comments

@melissagqc
Copy link

(ostrich) C:\Git\pub\ostrich-swmm>ostrich-swmm run
OSTRICH input for subcat S1##PP1_1 had too many lid units, changing to max number 41
OSTRICH input for subcat S2##RB1_2 had too many lid units, changing to max number 65
OSTRICH input for subcat S2##PP1_2 had too many lid units, changing to max number 10
OSTRICH input for subcat S3##PP1_3 had too many lid units, changing to max number 70

... EPA-SWMM 5.1 (Build 5.1.13)

o Retrieving project data
o Simulation complete

... EPA-SWMM completed in 0.00 seconds.
Traceback (most recent call last):
File "C:\Users\gqc\Envs\ostrich\Scripts\ostrich-swmm-script.py", line 11, in
load_entry_point('ostrich-swmm==0.6.0', 'console_scripts', 'ostrich-swmm')()
File "build\bdist.win-amd64\egg\ostrich_swmm_main_.py", line 247, in main
File "build\bdist.win-amd64\egg\ostrich_swmm_main_.py", line 116, in run_cmd
File "build\bdist.win-amd64\egg\ostrich_swmm\run.py", line 43, in perform_run
File "build\bdist.win-amd64\egg\ostrich_swmm\extract.py", line 332, in perform_extraction_steps
File "build\bdist.win-amd64\egg\ostrich_swmm\extract.py", line 43, in perform_node_extraction
AttributeError: 'SwmmExtract' object has no attribute 'TypeCheck'

Args:
binary_output (swmmtoolbox.SwmmExtract): The output to extract from.
node_output_file (file): The file to output extracted data to.
node_names (Iterable): A list of node names to extract data for.
statistics (Iterable): A list of statistics to extract.
event_threshold_flow_rate (Number): The flow rate above which a node
is considered to have flow. Defaults to 0.
"""
# Get the indicies of the relevant data in the binary output.
node_type = binary_output.TypeCheck('node')
node_total_inflow_variable_index = next(
index
for index, name
in binary_output.varcode[node_type].items()
if name == 'Total_inflow'
)

@kmmacro
Copy link
Collaborator

kmmacro commented Dec 23, 2019

@melissagqc can you share what your config.json file looks like? Did you define the correct output file name?
https://github.com/ubccr/ostrich-swmm/blob/9553b9d84e3f5ac7d5de9024a7a3ce65d78d8015/templates/ostrich-swmm-config.json#L2

@kmmacro kmmacro self-assigned this Dec 23, 2019
@melissagqc
Copy link
Author

Yes, the output file name is correct.
This is the JSON File:
{
"binary_output_path": "swmm.out",
"input_template_path": "ModelTemplate.inp",
"input_parameters_path": "submodel_input_parameters.json",
"input_path": "swmm.inp",
"report_output_path": "swmm.rpt",
"summary_dir": ".",
"swmm_path": "swmm5",
"extract": {
"steps": [
{
"type": "node",
"enabled": true,
"output_path": "swmm_nodes.csv",
"statistics": [
"node_name",
"num_flow_events",
"total_flow_volume",
"total_flow_duration",
"first_flow_start",
"first_flow_end",
"first_flow_duration",
"first_flow_volume",
"last_flow_start",
"last_flow_end",
"last_flow_duration",
"last_flow_volume",
"max_volume_flow_start",
"max_volume_flow_end",
"max_volume_flow_duration",
"max_volume_flow_volume",
"max_duration_flow_start",
"max_duration_flow_end",
"max_duration_flow_duration",
"max_duration_flow_volume"
],
"nodes": [
],
"event_threshold_flow_rate": 0
}
]
}
}

@melissagqc
Copy link
Author

Sorry did not mean to close this issue

@melissagqc
Copy link
Author

The binary output file is being generated. I have attached it in the zip file.
image

This is the error we are getting when we run it in debug.
image

swmm.zip

@kmmacro
Copy link
Collaborator

kmmacro commented Jan 5, 2020

@melissagqc I think your issue is that you don't have anything defined for "nodes" in the json file, it is just an empty list.

You need to list one or more nodes that you want to extract results for:
"nodes": ["J1", "J2"],

Given those nodes, OSTRICH-SWMM will generate "swmm_nodes.csv", where the columns are the attributes under "statistics" and each row contains the values for each node in the "nodes" list.

kmmacro added a commit to kmmacro/ostrich-swmm that referenced this issue Jan 6, 2020
@kmmacro
Copy link
Collaborator

kmmacro commented Jan 6, 2020

@melissagqc In addition to editing your json file, it looks like this is an error coming from a newer version of swmmtoolbox. Please see the commit referenced above for a temporary fix. I plan to update all the packages to be Python 3 compatible soon.

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

No branches or pull requests

2 participants