Python scripting of sewer network geometry - General - Delft3D Flexible Mesh
At this page you can post questions or start discussions on general topics related to Delft3D Flexible Mesh.
Please select a proper category below (if possible), to post your message or reply to an existing post. Please add tags to your posts to simplify searching.
** PLEASE TAG YOUR POST! **
Python scripting of sewer network geometry
I have started exploring python scriptability of Sobek 3. I am importing from a SHP-file to generate a network. First I have created nodes and channel objects as well as added that to branches and the network itself. Everything has worked and is correct in plan view.
When trying to define branch geometries I run in to difficulties though. I first add a cross-section to the branch and then try to set the geometry type which I cannot get my head around:
# checking for egg-shape channel elif int(feature.Attributes.TryGetValue("Profilart")[:2]) == 1: crossSection = CreateBranchObjectOnBranchUsingChainage(BranchObjectType.Culvert, str(feature.Attributes.TryGetValue("Profilart")), channel, 7) crossSection.GeometryType.Egg
Setting GeometryType throws an error. The following import statements have been included in the header:
from Libraries.MapFunctions import CreateLineGeometry, CreatePointGeometry from Libraries.MapFunctions import GetShapeFileFeatures, GetShapeFileCoordinateSystem from Libraries.StandardFunctions import * from Libraries.NetworkFunctions import * from Libraries.SobekWaterFlowFunctions import * from Libraries.StandardFunctions import *
Any advise is highly welcome.
After reconsulting the documentation I have managed to import the correct library and to attached a culvert object to a channel as follows:
from DelftTools.Hydro import CulvertGeometryType
# create cross section for channel # checking for circular channel if int(feature.Attributes.TryGetValue("Profilart")[:2]) == 0: diameter = float(feature.Attributes.TryGetValue("ProfBreite"))/1000 inlet = float(feature.Attributes.TryGetValue("SohleZu")) outlet = float(feature.Attributes.TryGetValue("SohleAb")) id = str(feature.Attributes.TryGetValue("ProfBez")) name = str(startNode.Id) + "-" + str(endNode.Id) + "_Round" culvert = CreateBranchObjectOnBranchUsingChainage(BranchObjectType.Culvert, id, channel, channel.Length/2) culvert.GeometryType = CulvertGeometryType.Round culvert.Diameter = diameter configureCulvert( culvert, channel.Length, inlet, outlet)
Unfortunately when trying to test run, Sobek 3 is complaining that channel objects do not have a cross-section attached to it. My current setup is that a network has branches and each branch has a channel. Since I want to simulate a closed sewer system and I cannot find any closed cross-sections I attached conduits between nodes. It does not work though. My ultimate goal is to test
RainfallRunoff->2D area->lateral inflow into->1D sewer network->outlet to 2D area
Any assistance is highly appreciated.