Main Function

CrossSection

Class

CrossSection(label[, height, width, unit, ...])

main class A Class that should help to generate custom cross-section shapes for the SWMM software.

Methods

__init__(label[, height, width, unit, ...])

Initialise the cross-section class

identifier

height

absolute height of the CS

width

absolute width of the CS

get_width()

get absolute width of cross-section

add(x_or_expr[, y])

add part of cross-section

set_double_cross_section()

make the cross-section as a double section (=Doppelprofil)

shape_description

list of functions to describe the cross-section shape

get_points()

create absolute point coordinates and write it into points

Figures

profile_axis(ax[, relative, half, fill, ...])

plot the shape curve on an axes

profile_figure([relative, half, fill])

create a plot of the cross-section

Shape parameters

b_w_t(hi)

width of the cross-section at a certain height

l_u_t(hi)

wetted perimeter in the partial-filled cross-section at a certain water level height

area_t(hi)

flow area in the partial-filled cross-section at a certain water level height

r_hyd_t(hi)

hydraulic radius in the partial-filled cross-section at a certain water level height

area_v

flow area of the full-filled cross-section

r_hyd_v

hydraulic radius of the full-filled cross-section

l_u_v

wetted perimeter of the full-filled cross-section

velocity_t(hi, slope, k)

velocity in a partial-filled channel at a certain water level height

velocity_v(slope, k)

velocity in a full-filled channel

flow_t(hi, slope, k)

flow in a partial-filled channel at a certain water level height

flow_v(slope, k)

flow in a full-filled channel

h_t(Q_t, slope, k)

get the height of the water level based on the known flow

swmm_api Functions

from_curve(curve[, height])

create an object with the data of the swmm curve data as relative coordinates

to_curve()

create a SWMM curve object with the data of the swmm-shape_generator-CrossSection

CrossSectionHolding

Class

CrossSectionHolding(label[, description, ...])

cross section class for Holding Graz

class shape_generator.shape_generator.CrossSection(label, height=None, width=None, unit=None, double=False, accuracy=3, simplify=True)[source]

main class A Class that should help to generate custom cross-section shapes for the SWMM software.

label

name/label/number of the cross-section

Type

str

shape

descriptions of the cross-section as commands in a list

Type

list

accuracy

number of decimal points to use for the export

Type

int

unit

unit of entered values

Type

str

double

if the cross-section two separate cross-sections

Type

bool

points

points of the final cross-section

Type

list

simplify

if the ramer-douglas algorithm should be used to simplify curve

Type

bool

__init__(label, height=None, width=None, unit=None, double=False, accuracy=3, simplify=True)[source]

Initialise the cross-section class

Parameters
  • label (str) – name/label/number of the cross-section

  • height (float) – absolute height of the CS

  • width (Optional[float]) – absolute width of the CS (optional) can be estimated

  • unit (Optional[str]) – enter unit to add the unit in the plots

  • simplify (bool) – if the ramer-douglas algorithm should be used to simplify curve

property height

absolute height of the CS

Returns

absolute height of the CS

Return type

float

property width

absolute width of the CS

Returns

absolute width of the CS

Return type

float

get_width()[source]

get absolute width of cross-section

Returns

width of cross-section

Return type

float

get_height()[source]

get absolute height of cross-section

Returns

height of cross-section

Return type

float

set_double_cross_section()[source]

make the cross-section as a double section (=Doppelprofil)

add(x_or_expr, y=None)[source]

add part of cross-section

can be a:

  • function/expression

  • point (x,y) coordinates

  • boundary condition (x or y) of a surrounding function = only x or y is given and the other is None

  • slope (x=slope, y=unit of slope)

Parameters
  • x_or_expr (Optional[float , None, CustomExpr]) –

    • float : x coordinate or x-axis boundary or slope if any str keyword is used in argument y

    • CustomExpr : Expression/function for the cross-section part, i.e.: shape_generator.Circle, Slope, Vertical, Horizontal

    • None : if a y-axis boundary is given

  • y (Optional[float,str]) –

    y coordinate of unit of slope

    • float : x coordinate or x-axis boundary

    • None : if a x-axis boundary is given or an expression in x_or_expr

    • str : argument x is a slope

      • slope : ready to use slope 1 / \(\Delta\) y

      • °slope : slope as an angle in degree (°)

      • %slope : slope in percentage (%)

property shape_description

list of functions to describe the cross-section shape

Returns

description of the cross-section shape

Return type

list

get_points()[source]

create absolute point coordinates and write it into points

To create a list[tuple] of all the points to describe the cross-section. This function replaces the Expressions given in add to points with x and y coordinates and writes them into the points attribute.

Returns

absolute point coordinates

Return type

list[list[float,float]]

profile_axis(ax, relative=False, half=False, fill=False, marker='.', ls='-', **kwargs)[source]

plot the shape curve on an axes

Parameters
  • ax (matplotlib.pyplot.Axes) – plot axes

  • relative (bool) – if the plot should be in relative size

  • half (bool) – if ony the half curve should be plotted

  • fill (bool) – if the curve should be fill on the inside

  • marker (str) – marker of the curve

  • ls (str) – line-style of the curve

  • **kwargs – plot keyword arguments

Returns

plot axes

Return type

matplotlib.pyplot.Axes

profile_figure(relative=False, half=False, fill=False, **kwargs)[source]

create a plot of the cross-section

Parameters
  • relative (bool) – if the plot should be in relative size

  • half (bool) – if ony the half curve should be plotted

  • fill (bool) – if the curve should be fill on the inside

  • **kwargs – plot keyword arguments

Returns

figure of the plot

Return type

matplotlib.pyplot.Figure

b_w_t(hi)[source]

width of the cross-section at a certain height

(Wasseroberflächenbreite im teilgefüllten Querschnitt)

Parameters

hi (float | numpy.ndarray) – a certain height

Returns

width at the certain height

Return type

float | numpy.ndarray

l_u_t(hi)[source]

wetted perimeter in the partial-filled cross-section at a certain water level height

(benetzter Umfang im teilgefüllten Querschnitt)

Parameters

hi (float | numpy.ndarray) – a certain height

Returns

wetted perimeter at the certain height

Return type

float | numpy.ndarray

property l_u_v

wetted perimeter of the full-filled cross-section

(benetzter Umfang im vollgefüllten Querschnitt)

Returns

wetted perimeter

Return type

float | numpy.ndarray

area_t(hi)[source]

flow area in the partial-filled cross-section at a certain water level height

(Fließquerschnitt im teilgefüllten Querschnitt)

Parameters

hi (float | numpy.ndarray) – a certain height

Returns

flow area at the certain height

Return type

float | numpy.ndarray

property area_v

flow area of the full-filled cross-section

(Fließquerschnitt im vollgefüllten Querschnitt)

Returns

flow area

Return type

float | numpy.ndarray

r_hyd_t(hi)[source]

hydraulic radius in the partial-filled cross-section at a certain water level height

(hydraulischer Radius im teilgefüllten Querschnitt)

Parameters

hi (float | numpy.ndarray) – a certain height

Returns

hydraulic radius at the certain height

Return type

float | numpy.ndarray

property r_hyd_v

hydraulic radius of the full-filled cross-section

(hydraulischer Radius im vollgefüllten Querschnitt)

Returns

hydraulic radius

Return type

float | numpy.ndarray

velocity_v(slope, k)[source]

velocity in a full-filled channel

Parameters
  • slope (float) – absolute slope in m/m

  • k (float) – Betriebliche Rauigkeit in mm

Returns

full-filling velocity in m/s

Return type

float

References

DWA-A 110 Section 4.1.1 Vollfüllung

velocity_t(hi, slope, k)[source]

velocity in a partial-filled channel at a certain water level height

Parameters
  • hi (float) – water level = height in mm

  • slope (float) – absolute slope in m/m

  • k (float) – Betriebliche Rauigkeit in mm

Returns

velocity in m/s

Return type

float

References

DWA-A 110 Section 4.1.2 Teilfüllung

flow_t(hi, slope, k)[source]

flow in a partial-filled channel at a certain water level height

Parameters
  • hi (float) – water level = height in mm

  • slope (float) – absolute slope in m/m

  • k (float) – Betriebliche Rauigkeit in mm

Returns

flow rate in L/s

Return type

float

flow_v(slope, k)[source]

flow in a full-filled channel

Parameters
  • slope (float) – absolute slope in m/m

  • k (float) – Betriebliche Rauigkeit in mm

Returns

full-filled flow rate in L/s

Return type

float

h_t(Q_t, slope, k)[source]

get the height of the water level based on the known flow

Parameters
  • Q_t (float) – flow in L/s

  • slope (float) – absolute slope in m/m

  • k (float) – Betriebliche Rauhigkeit in mm

Returns

height of the water level

Return type

float

to_curve()[source]

create a SWMM curve object with the data of the swmm-shape_generator-CrossSection

classmethod from_curve(curve, height=100, *args, **kwargs)[source]

create an object with the data of the swmm curve data as relative coordinates

Parameters
  • curve (swmm_api.input_file.sections.Curve) – Curve object of the CURVES section in the inp-data file

  • height (float) – absolute height of the CS

  • *args – arguments, see CrossSection.__init__

  • **kwargs – keyword arguments, see CrossSection.__init__

Returns

of the shape coordinates

Return type

CrossSection

__init__(label[, description, add_dim, add_dn])

Initialise the cross-section class

Pre defined Cross Sections

standard(label[, description, height, ...])

standard cross section

box(label, height, width[, channel, bench, ...])

pre defined box (=Kasten) cross section

box_from_string(label, **kwargs)

create pre defined box (=Kasten) cross section with the string label.

from_point_cloud(relative_coordinates, ...)

get the cross sections from a point cloud where every point is relative to the lowers point in the cross section

class shape_generator.shape_generator_holding.CrossSectionHolding(label, description=None, add_dim=False, add_dn=None, **kwargs)[source]

cross section class for Holding Graz

add_dim

add the dimension (height x width) to the label and output filename

Type

bool

add_dn

add the channel diameter (DN …) to the label and output filename

Type

bool

__init__(label, description=None, add_dim=False, add_dn=None, **kwargs)[source]

Initialise the cross-section class

Parameters
  • label (str) – name/label/number of the cross-section

  • description (Optional[str]) – optional description of the cross-section

  • add_dim (bool) – if the dimensions should be added to out_filename used for the export

  • add_dn (Optional[float]) – if the channel dimension should be added to out_filename used for the export enter the diameter as float

  • **kwargs (object) – see __init__

Keyword Arguments
  • description (Optional[str]) – optional description of the cross section

  • height (float) – absolute height of the CS

  • width (Optional[float]) – absolute width of the CS (optional) can be calculated

  • working_directory (str) – directory where the files get saved

  • unit (Optional[str]) – enter unit to add the unit in the plots

classmethod standard(label, description=None, height=nan, width=None, r_channel=None, r_roof=None, r_wall=None, slope_bench=None, r_round=None, r_wall_bottom=None, h_bench=None, pre_bench=None, w_channel=None, **kwargs)[source]

standard cross section

Parameters
  • label (str) – see __init__

  • description (str) – see __init__

  • height (float) – see __init__

  • width (float) – see __init__

  • r_channel (float) – radius of the dry-weather channel (=Trockenwetter Rinne)

  • w_channel (float) – half width of the channel, only in combination with r_channel active

  • pre_bench (float) – slope of the upper end of the channel in degree, only in combination with

  • active (r_wall) –

  • r_round (float) – radius of the rounding of the edges, only in combination with r_channel active

  • h_bench (float) – height where the bench begins, only in combination with r_channel active

  • slope_bench (float) – slope of the bench (=Berme) in degree, or slope of the rainwater-floor (

  • =Regenwetterrinne)

  • r_roof (float) – radius of the roof (=Decke)

  • r_wall (float) – radius of the sidewall (=Seitenwand), only in combination with r_roof active

  • r_wall_bottom (float) – radius of the bottom sidewall (=untere Seitenwand), only in combination with

  • active

  • **kwargs (object) – see __init__

Keyword Arguments
  • working_directory (str) – directory where the files get saved

  • unit (Optional[str]) – enter unit to add the unit in the plots

Returns

standard cross section

Return type

CrossSectionHolding

Examples

see Standard cross section

standard cross section

Standard cross section

english

deutsch

channel

Trockenwetter-Rinne

roof

Firste/Decke

wall

Seitenwand

bench

Berme

classmethod box(label, height, width, channel=None, bench=None, roof=None, rounding=0.0, **kwargs)[source]

pre defined box (=Kasten) cross section

Parameters
  • label (str) – see __init__

  • height (float) – see __init__

  • width (float) – see __init__

  • channel (Optional[float]) – diameter of the dry weather channel

  • bench (Optional[float]) –

    bench (=Berme)

    • '': flache Berme

    • 'R': V-förmiges Profil

    • 'H': Schräge Verschneidung

  • roof (Optional[float]) –

    roof (=Decke)

    • '': gerade

    • 'B': Bogen

    • 'K': Kreis

  • rounding (Optional[float]) – rounding of the edges

  • **kwargs (object) – see __init__

Keyword Arguments
  • description (Optional[str]) – optional longer name of the cross section

  • working_directory (str) – directory where the files get saved

  • unit (Optional[str]) – enter unit to add the unit in the plots

Returns

pre defined box (=Kasten) cross section

Return type

CrossSectionHolding

Examples

see Examples for box shaped profiles

classmethod box_from_string(label, **kwargs)[source]

create pre defined box (=Kasten) cross section with the string label.

This function takes the information from the label and pass them to the box - function.

Parameters
Keyword Arguments
  • height (float) – see __init__

  • width (float) – see __init__

  • rounding (Optional[float]) – rounding of the edges

  • description (Optional[str]) – optional longer name of the cross section

  • working_directory (str) – directory where the files get saved

  • unit (Optional[str]) – enter unit to add the unit in the plots

Returns

pre defined box (=Kasten) cross section

Return type

CrossSectionHolding

Examples

see Examples for box shaped profiles

Kasten-Profile

Kasten-Profile

classmethod from_point_cloud(relative_coordinates, *args, **kwargs)[source]

get the cross sections from a point cloud where every point is relative to the lowers point in the cross section

Parameters
  • relative_coordinates (list[tuple[float, float]] | numpy.array) – list of height- and width tuple with the origin in the lowest point of the cross section

  • *args – arguments, see __init__

  • **kwargs – keyword arguments, see __init__

Keyword Arguments
  • label (str) – main name/label/number of the cross section

  • description (Optional[str]) – optional longer name of the cross section

  • height (float) – absolute height of the CS

  • width (Optional[float]) – absolute width of the CS (optional) can be calculated

  • working_directory (str) – directory where the files get saved

  • unit (Optional[str]) – enter unit to add the unit in the plots

  • add_dim (bool) – if the dimensions should be added to out_filename used for the export

  • add_dn (Optional[float]) – if the channel dimension should be added to out_filename used for the export enter the diameter as float

Returns

of the point cloud

Return type

CrossSectionHolding

point cloud

Point cloud