Share
 
 

Infowater.output.manager Class

infowater.output.manager.Manager(path)

Infowater.output.manager Class contains multiple methods to interact with InfoWater Pro results data.

After importing the class, create output objects by calling it with the path to your desired output files. Refer to Start Scripting for more details.

  • Parameters: path (str) – Path to the output file
  • Returns: Manager for InfoWater Pro output file
  • Return type: Manager

Examples

>>> from infowater.output.manager import Manager
>>> outman = Manager("C:\\Users\\Public\\Documents\\InfoWater Pro\\Examples\\Net1.OUT\\SCENARIO\\BASE\\HYDQUA.OUT")

find_nearest_time(time)

Find the nearest output time and its index.

  • Parameters: time (float) – Time
  • Returns: Index and value of the nearest output time
  • Return type: tuple

Examples

In the following example, the user requests the nearest output time to "6.18" on an output object with hourly data. The nearest output time is "6.0", representing the 6th hour, and the index of this time is 7.

>>> outman = Manager("HYDQUA.OUT")
>>> outman.find_nearest_time(6.18)
(7, 6.0)

get_all_range_data(element_type, field)

Get all the range data for the specified element field.

  • Parameters:
    • element_type (ElementType | str) – Element type
    • field (str | int) – Field name or index
  • Returns: List of range data lists
  • Return type: list

Examples

In the following example, the method extracts all the range output data for junction pressures. The output consists of a list of lists, in the following format:

[[Max pressure at each junction], [Time of max for each junction], [Min pressure at each junction], [Time of min for each junction], [Average pressure at each junction]]

>>> outman.get_all_range_data("Junction", "Pressure")
[[308.23333740234375, 291.031494140625, 289.81304931640625, 292.4063720703125, 288.49713134765625, 291.4931640625, 296.08990478515625, 284.44830322265625, 272.8939208984375], [23.0, 23.0, 7.0, 7.0, 23.0, 23.0, 23.0, 23.0, 23.0], [251.8485107421875, 251.8485107421875, 260.7398681640625, 264.58203125, 258.95306396484375, 264.3402099609375, 269.21612548828125, 255.4371337890625, 244.5521240234375], [13.0, 13.0, 14.0, 14.0, 13.0, 13.0, 13.0, 13.0, 13.0], [288.8804931640625, 276.3491516113281, 276.96966552734375, 280.3660888671875, 276.39874267578125, 279.9580078125, 284.6310729980469, 272.4742736816406, 261.0697937011719]]

get_element_list(element_type)

Get the list of elements for the specified element type.

  • Parameters: element_type (ElementType | str) – Element type
  • Returns: List of elements
  • Return type: list

Examples

The following example returns a list with the names of each of the pumps. Note that the index of each pump name will correspond with the index of values returned from methods that return data for each pump.

>>> outman.get_element_list("Pump")
['Pump_1','Pump_2']

get_range_data(element_type, field, item)

Get the range data for the specified element field and range item.

  • Parameters:
    • element_type (ElementType | str) – Element type
    • field (str | int) – Field name or index
    • item (str | int) – Item name or index
  • Returns: List of range data
  • Return type: list

Examples

The following example creates a list of the average flow for each pipe in the model.

>>> avg_pipe_flows = outman.get_range_data("Pipe","Flow","Avg")
>>> print(avg_pipe_flows)
[2.7711575031280518, 2.08132266998291, 1.8888665437698364, 0.8666349649429321, 0.5828988552093506, 0.1100732684135437, 0.33287426829338074, 0.30400240421295166, 0.1415996104478836, 0.32867902517318726, 0.22412824630737305, 0.08120140433311462, 2.7711575031280518, 2.7711575031280518]

get_snap_data(element_type, field, time_index)

Get the snap data for the specified element field and time.

  • Parameters:
    • element_type (ElementType | str) – Element type
    • field (str | int) – Field name or index
    • time_index (int) – Time index
  • Returns: List of snap data
  • Return type: list

Examples

The following example returns a list of the pressures at each junction for the 7th timestep.

>>> outman.get_snap_data("Junction","Pressure",7)
[278.2781982421875, 278.2781982421875, 289.81304931640625, 292.4063720703125, 285.38275146484375, 290.7698974609375, 295.64581298828125, 281.8668212890625, 270.98175048828125]

get_time_data(element_type, element_id, field)

Get the time data for the specified element and field.

  • Parameters:
    • element_type (ElementType | str) – Element type
    • element_id (str) – Element ID
    • field (str | int) – Field name or index
  • Returns: List of time data
  • Return type: list

Examples

The following example returns the time series of demand for the Junction with ID "21".

>>> outman.get_time_data("Junction", "21", "Demand")
[0.33420151472091675, 0.33420151472091675, 0.33420151472091675, 0.33420151472091675, 0.33420151472091675, 0.33420151472091675, 0.33420151472091675, 0.33420151472091675, 0.33420151472091675, 0.33420151472091675, 0.33420151472091675, 0.33420151472091675, 0.33420151472091675, 0.33420151472091675, 0.33420151472091675, 0.33420151472091675, 0.33420151472091675, 0.33420151472091675, 0.33420151472091675, 0.33420151472091675, 0.33420151472091675, 0.33420151472091675, 0.33420151472091675, 0.33420151472091675, 0.33420151472091675]

get_time_list()

Get the list of output times.

  • Returns: List of output times
  • Return type: list

Examples

>>> times = outman.get_time_list()
>>> print(times)
[0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0, 24.0]

Was this information helpful?