All Topics | Topic: “script to set up reach linkage to grounwater node”
Author Message
Mr. Miroslav Kandera
Subject: script to set up reach linkage to grounwater node   
Posted: 2/15/2023 Viewed: 6909 times

hello,

because i am currently working on linking few hundreds of reaches to different groundwater nodes, i tried but wasnt able to find script to set link of reach at river to groundwater. In "inflows and outflows" section, the "groundwater inflow/outflow volume and outflow fraction" need to have selected groundwater node to which they are connected to, in field called "from Groundwater".

just for example, i thought it would look somewhat like one bellow, but none of those i tried work

WEAP.Branch("Supply and Resources\River\River X\Reaches\Below reach y").Variables("Groundwater Inflow Volume").ConnectedGroundwater = "Groundwater z"

yet i am not sure what or if there is command like "ConnectedGroundwater" for these variables to set it via script.

Thank you.

M.
Mr. Doug Chalmers
Subject: Re: script to set up reach linkage to grounwater node   
Posted: 2/5/2025 Viewed: 3941 times

For those wondering, 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: “script to set up reach linkage to grounwater node”