Subject: WEAP API automate gw node where transmission link loses water to Posted: 3/3/2022 Viewed: 5621 times
Using the WEAP API through Python:
Is there a way I can automate setting the gw node the transmission link loses water to? I am able to automatically set the percentage like e.g. in 10% in the example below. However, how can I set the “to Groundwater” node the transmission link loses water to? Or is this not possible?
self.WEAP.Branch('Supply and Resources\Transmission Links\to AI_11\from Withdrawal Node 5').Variables('Loss to Groundwater').Expression = 10
Mr. Jack Sieber
Subject: Re: WEAP API automate gw node where transmission link loses water to Posted: 3/3/2022 Viewed: 5615 times
This is currently no way using the WEAP API to set or change which groundwater node is linked to a reach. I hope to add this capability in a future version of WEAP.
Jack
Mr. Doug Chalmers
Subject: Re: WEAP API automate gw node where transmission link loses water to Posted: 2/5/2025 Viewed: 516 times
To provide an update, we have since enhanced WEAP to now be able to link groundwater objects to river reaches using API. The latest versions of WEAP have a function for "ConnectedGroundwater". Please see the WEAP Help for "Branch API" and scroll down to ConnectedGroundwater. The help gives the following examples:
' List all nodes or reaches that have connections to groundwater
FOR EACH Br IN WEAP.Branches
SET GWNode = Br.ConnectedGroundwater
IF GWNode.ID > 0 THEN
PRINT Br.FullName & " IS CONNECTED TO " & GWNode.Fullname
END IF
NEXT
' Connect Central Reservoir to North Aquifer
WEAP.Branch("Central Reservoir").ConnectedGroundwater = "North Aquifer"
' Connect Central Reservoir to the first groundwater node
WEAP.Branch("Central Reservoir").ConnectedGroundwater = WEAP.GroundwaterNodes(1)
' Remove GW connection from Central Reservoir
WEAP.Branch("Central Reservoir").ConnectedGroundwater = ""
Topic "WEAP API automate gw node where transmission link loses water to"