How to extract left and right bank top elevations from Res1D #60
Unanswered
moinabyssinia
asked this question in
Q&A
Replies: 1 comment
-
Hi, Bank elevations are accessible from a res1D file, albeit not so conveniently currently. They exist on reaches, at a specific 'H grid point', within its cross section member. Here's a rough example of how one could query this info: from mikeio1d import Res1D
from mikeio1d.dotnet import pythonnet_implementation as impl
import pandas as pd
res = Res1D("NetworkRiver.res1d")
def get_elevation_from_cross_section_point_id(cross_section, point_id):
try:
return cross_section.Points[point_id].Z
except:
return None
reach_data = []
for id, reaches in res.result_network.reaches.items():
if not isinstance(reaches, list):
reaches = [reaches]
for reach in reaches:
grid_points = getattr(reach, "GridPoints", None)
if not grid_points:
continue
for grid_point in grid_points:
grid_point = impl(grid_point)
cross_section = getattr(grid_point, "CrossSection", None)
if not cross_section:
continue
cross_section = impl(grid_point.CrossSection)
cross_section_items = ["LeftLeveeBank", "LeftLowFlowBank", "RightLowFlowBank", "RightLeveeBank"]
cross_section_item_indices = [getattr(cross_section, item, None) for item in cross_section_items]
cross_section_item_elevations = [get_elevation_from_cross_section_point_id(cross_section, idx) for idx in cross_section_item_indices]
left_levee_bank, left_low_flow_bank, right_low_flow_bank, right_levee_bank = cross_section_item_elevations
reach_data.append(
{
"reach_id": id,
"gridpoint_chainage": grid_point.Chainage,
"cross_section_id": cross_section.ID,
"cross_section_left_levee_bank": left_levee_bank,
"cross_section_left_low_flow_bank": left_low_flow_bank,
"cross_section_right_low_flow_bank": right_low_flow_bank,
"cross_section_right_levee_bank": right_levee_bank,
}
)
pd.DataFrame(reach_data) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I would like to extract the top left and right bank elevation in order to plot the profile of the water level.
I used MIKEIO 1D to collect that information but the top left/right bank elevation is not in the res1D file but when using MIKE View to plot the profile, we see the top left/right bank elevations.
Is there a way to extract that from res1D?
Beta Was this translation helpful? Give feedback.
All reactions