Open JPL-BELG opened 1 year ago
This is a relevant issue that was only partly addressed by issue #579 and PR #580. The ENopen
function in v2.3 dev
now allows a partly constructed network (i.e., with unconnected nodes and no tanks or reservoirs) to be accepted. But input files with other format errors, such as duplicate ID names, undefined link end nodes, missing parameter values or illegal numerical tokens, will still cause ENopen to fail. Here are some suggestions that would allow ENopen to accommodate such errors without failing (while writing an error message to the report file as is currently done):
ENaddnode
and ENaddlink
.Again, each of these conditions would be flagged with a message added to the Status Report. Did I miss anything?
Thanks @LRossman for the answer and comments. Sorry I didn’t see previous issues related to the same topic.
I sometimes encounter another case where an error can occur : when a custom section (enclosed in brackets) is present in the INP file with a keyword not allowed in EPANET (that can occur when I receive an INP file created by a third-party software creating a special section in its INP file format to store additional data). “As usual”, EPANET opens the INP file (with a 201 error message) but ENOpen report 201 and 200 error codes and does not open it.
Example : imagine that you have additional data added to pumps inside an [ADP] section inserted just after the [PUMP] section in the INP file. 1) Messages sent by EPANET when importing the INP file : Error 201 at line 3478: [PUMPS] [ADP] 2) Messages sent by the Toolkit with ENOpen : Error 201: syntax error in [PUMPS] section: [ADP] Error 200: one or more errors in input file
Of course the extra-sections can be manually deleted but it is easier if the ENopen function could directly manage the issue.
Thanks.
I often need to open a INP text file including one or more “errors” (for example : models under construction with uncompleted data). 1) When opening it in EPANET stand-alone, there is no problem to open and display it in the map even if the file is very uncompleted. Errors occur only when trying to run the model (errors can be seen in the report file). 2) Using the toolkit, it seems that the only way to open the same INP file is to use the ENopen function. It immediately returns an error code. The error messages appearing in the report file are the same as in EPANET stand-alone. After that error message, it unfortunately seems impossible to use any other toolkit function to access data, such as ENgetnodevalue or any else function.
I don’t believe that there are available parsing functions in the Toolkit to read INP files with errors. My question : is it not possible to let the ENopen function returning a warning code in place of an error code, letting the user access data even if they are not completed/fully correct?
Thank you for your opinion and advices.