WNTR icon indicating copy to clipboard operation
WNTR copied to clipboard

How to access Description of Pattern in .inp, and how to replace multipliers of Pattern?

Open mark-chung opened this issue 1 year ago • 6 comments

Summary I have an .inp file. From EPANET I could see pattern names and respective descriptions as shown below.

  1. 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'?
  2. How can I replace the multipliers of a Pattern using Python? Is there a function equivalent to 'Load' feature in EPANET?

Example Capture

mark-chung avatar Mar 22 '23 02:03 mark-chung

@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.

ucchejbb avatar Mar 22 '23 11:03 ucchejbb

Thanks for your reply @ucchejbb ! I have tried, but the description 'Reservoir_1' was not shown in the output. Can anyone please advice? Capture

mark-chung avatar Mar 23 '23 00:03 mark-chung

@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 avatar Mar 24 '23 11:03 ucchejbb

@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 avatar Mar 27 '23 05:03 mark-chung

@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).

ucchejbb avatar Mar 27 '23 11:03 ucchejbb

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.

dbhart avatar Jan 29 '24 18:01 dbhart