WNTR
WNTR copied to clipboard
How to access Description of Pattern in .inp, and how to replace multipliers of Pattern?
Summary I have an .inp file. From EPANET I could see pattern names and respective descriptions as shown below.
- How can I access the description of pattern using Python? Is there a way to extract the description ('Reservoir_1') from Pattern name 'RS_1'?
- How can I replace the multipliers of a Pattern using Python? Is there a function equivalent to 'Load' feature in EPANET?
Example
@mark-chung You can view patterns using 'get_pattern'.
To just see the array of pattern multipliers you can use the following. wn.get_pattern('RS_1').multipliers
If you don't put the .multipliers you can see other information stored with the pattern.
Thanks for your reply @ucchejbb ! I have tried, but the description 'Reservoir_1' was not shown in the output. Can anyone please advice?
@mark-chung you can run "wn.pattern_name_list" to see a list of all available pattern names. My example only pulls out the specific "RS_1". But you just need to insert the appropriate name into wn.get_pattern('pattern_name') to access its information.
@ucchejbb Thanks for comment! I have no issue listing the available pattern names. Just wondering, why in EPANET I could see 'Description' of pattern (please see image in first comment). In the example, within EPANET, the pattern 'RS_1' has a description 'Reservoir_1'. When I use WNTR wn.get_pattern('RS_1'), I only could see pattern name and multiplierarray, but couldn't see the description 'Reservoir_1'. Could this be a limitation of WNTR, that some information in .inp file that could be seen in EPANET, but couldn't be retrieved from WNTR model?
@mark-chung Sorry for my confusion. I thought you were just trying to access the pattern. @kaklise @dbhart Any thoughts on this? I don't recall how to access this information (or if you can).
The name of the pattern goes in the comments above the pattern definition. EPANET GUI keeps this information - the toolkit doesn't. So, we have not pulled in that data to store it on the patterns in wntr. This is true of most of the comments that are allowed in EPANET - WNTR does not store them and you can't access through the EPANET toolkit.