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

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

Open
mark-chung opened this issue Mar 22, 2023 · 6 comments
Assignees
Labels

Comments

@mark-chung
Copy link

mark-chung commented Mar 22, 2023

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 mark-chung changed the title How to access Description of Pattern in .inp? How to access Description of Pattern in .inp, and how to replace multipliers of Pattern? Mar 22, 2023
@ucchejbb
Copy link

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

@mark-chung
Copy link
Author

mark-chung commented Mar 23, 2023

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

@ucchejbb
Copy link

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

@mark-chung
Copy link
Author

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

@ucchejbb
Copy link

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

@dbhart
Copy link
Collaborator

dbhart commented Jan 29, 2024

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.

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

No branches or pull requests

4 participants