Skip to content

Reading marker of cross sections #22

Answered by gedaskir
hendryliu asked this question in Q&A
Discussion options

You must be logged in to vote

Here is an example script to do that:

import mikeio1d
from mikeio1d.res1d import Res1D

filename = "MyResults.res1d"
res1d = Res1D(filename)

reaches = list(res1d.data.Reaches)

for reach in reaches:
    grid_points = list(reach.GridPoints)

    for grid_point in grid_points:
        try:
            cross_section = grid_point.CrossSection

            points = list(cross_section.Points)
            left = points[cross_section.LeftLeveeBank]
            lowest = points[cross_section.LowestPoint]
            right = points[cross_section.RightLeveeBank]

            print("Gridpoint:", reach.Name, grid_point.Chainage)
            print("  Cross section ID:", cross_section.ID)
            print

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@hendryliu
Comment options

@JesperGr
Comment options

@ryan-kipawa
Comment options

Answer selected by gedaskir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants
Converted from issue

This discussion was converted from issue #20 on November 10, 2021 13:48.