from mikeio1d import Xns11
= Xns11("../data/mikep_cs_demo.xns11")
xns xns.xsections
<CrossSectionCollection 103>
<CrossSectionCollection 103>
cross_section | |||
---|---|---|---|
location_id | chainage | topo_id | |
basin_left1 | 2.004 | 1 | <CrossSection: basin_left1, 2.004, 1> |
33.774 | 1 | <CrossSection: basin_left1, 33.774, 1> | |
80.945 | 1 | <CrossSection: basin_left1, 80.945, 1> | |
122.042 | 1 | <CrossSection: basin_left1, 122.042, 1> | |
166.107 | 1 | <CrossSection: basin_left1, 166.107, 1> |
markers | marker_labels | x | z | resistance | |
---|---|---|---|---|---|
0 | 0.000 | 59.508 | 25.0 | ||
1 | 2.062 | 59.624 | 25.0 | ||
2 | 1 | Left Levee Bank (1) | 4.124 | 59.754 | 25.0 |
3 | 6.186 | 59.607 | 25.0 | ||
4 | 14.435 | 58.882 | 25.0 |
marker | marker_label | x | z | |
---|---|---|---|---|
0 | 1 | Left Levee Bank (1) | 4.124 | 59.754 |
1 | 2 | Lowest Point (2) | 72.914 | 52.803 |
2 | 3 | Right Levee Bank (3) | 195.897 | 57.989 |
level | flow_area | radius | storage_width | additional_storage_area | resistance | conveyance_factor | |
---|---|---|---|---|---|---|---|
0 | 52.803000 | 0.000000 | 0.000000 | 0.000000 | 0.0 | 25.0 | 0.000000 |
1 | 52.944857 | 0.160191 | 0.075849 | 2.743476 | 0.0 | 25.0 | 0.717592 |
2 | 53.086714 | 0.790062 | 0.165260 | 6.136873 | 0.0 | 25.0 | 5.948131 |
3 | 53.228571 | 3.633195 | 0.171565 | 29.866016 | 0.0 | 25.0 | 28.044487 |
4 | 53.370429 | 9.264321 | 0.249458 | 50.128968 | 0.0 | 25.0 | 91.780854 |
<CrossSection: basin_left1, 122.042, 1>
cross_section | |||
---|---|---|---|
location_id | chainage | topo_id | |
basin_left1 | 2.004 | 1 | <CrossSection: basin_left1, 2.004, 1> |
33.774 | 1 | <CrossSection: basin_left1, 33.774, 1> | |
80.945 | 1 | <CrossSection: basin_left1, 80.945, 1> | |
122.042 | 1 | <CrossSection: basin_left1, 122.042, 1> | |
166.107 | 1 | <CrossSection: basin_left1, 166.107, 1> | |
184.886 | 1 | <CrossSection: basin_left1, 184.886, 1> | |
210.212 | 1 | <CrossSection: basin_left1, 210.212, 1> | |
264.614 | 1 | <CrossSection: basin_left1, 264.614, 1> | |
284.638 | 1 | <CrossSection: basin_left1, 284.638, 1> | |
341.152 | 1 | <CrossSection: basin_left1, 341.152, 1> | |
413.617 | 1 | <CrossSection: basin_left1, 413.617, 1> | |
481.451 | 1 | <CrossSection: basin_left1, 481.451, 1> |
# Similar to above, but using the 'sel' method.
xns.xsections.sel(location_id='basin_left1').to_dataframe()
cross_section | |||
---|---|---|---|
location_id | chainage | topo_id | |
basin_left1 | 2.004 | 1 | <CrossSection: basin_left1, 2.004, 1> |
33.774 | 1 | <CrossSection: basin_left1, 33.774, 1> | |
80.945 | 1 | <CrossSection: basin_left1, 80.945, 1> | |
122.042 | 1 | <CrossSection: basin_left1, 122.042, 1> | |
166.107 | 1 | <CrossSection: basin_left1, 166.107, 1> | |
184.886 | 1 | <CrossSection: basin_left1, 184.886, 1> | |
210.212 | 1 | <CrossSection: basin_left1, 210.212, 1> | |
264.614 | 1 | <CrossSection: basin_left1, 264.614, 1> | |
284.638 | 1 | <CrossSection: basin_left1, 284.638, 1> | |
341.152 | 1 | <CrossSection: basin_left1, 341.152, 1> | |
413.617 | 1 | <CrossSection: basin_left1, 413.617, 1> | |
481.451 | 1 | <CrossSection: basin_left1, 481.451, 1> |
xns_custom = Xns11()
xns_custom.add_xsection(xs)
xns_custom.write("my_custom.xns11")
xns_custom.xsections.to_dataframe()
cross_section | |||
---|---|---|---|
location_id | chainage | topo_id | |
my_reach | 100.000 | my_topo | <CrossSection: my_reach, 100.000, my_topo> |
# Subset an existing Xns11 file
subset = xns.xsections.sel(location_id='basin_left1')
xns_subset = Xns11.from_cross_section_collection(subset)
xns_subset.write("my_subset.xns11")
xns_subset.xsections.to_dataframe()
cross_section | |||
---|---|---|---|
location_id | chainage | topo_id | |
basin_left1 | 2.004 | 1 | <CrossSection: basin_left1, 2.004, 1> |
33.774 | 1 | <CrossSection: basin_left1, 33.774, 1> | |
80.945 | 1 | <CrossSection: basin_left1, 80.945, 1> | |
122.042 | 1 | <CrossSection: basin_left1, 122.042, 1> | |
166.107 | 1 | <CrossSection: basin_left1, 166.107, 1> | |
184.886 | 1 | <CrossSection: basin_left1, 184.886, 1> | |
210.212 | 1 | <CrossSection: basin_left1, 210.212, 1> | |
264.614 | 1 | <CrossSection: basin_left1, 264.614, 1> | |
284.638 | 1 | <CrossSection: basin_left1, 284.638, 1> | |
341.152 | 1 | <CrossSection: basin_left1, 341.152, 1> | |
413.617 | 1 | <CrossSection: basin_left1, 413.617, 1> | |
481.451 | 1 | <CrossSection: basin_left1, 481.451, 1> |
markers | marker_labels | x | z | resistance | |
---|---|---|---|---|---|
0 | 0.000 | 59.508 | 25.0 | ||
1 | 2.062 | 59.624 | 25.0 | ||
2 | 1 | Left Levee Bank (1) | 4.124 | 59.754 | 25.0 |
3 | 6.186 | 59.607 | 25.0 | ||
4 | 14.435 | 58.882 | 25.0 |
markers | marker_labels | x | z | resistance | |
---|---|---|---|---|---|
0 | 0.000 | 1059.508 | 25.0 | ||
1 | 2.062 | 1059.624 | 25.0 | ||
2 | 1 | Left Levee Bank (1) | 4.124 | 1059.754 | 25.0 |
3 | 6.186 | 1059.607 | 25.0 | ||
4 | 14.435 | 1058.882 | 25.0 |
from mikeio1d.cross_sections import Marker
xs.set_marker(Marker.LEFT_LOW_FLOW_BANK, x=70)
xs.set_marker(Marker.RIGHT_LOW_FLOW_BANK, x=74)
xs.markers
marker | marker_label | x | z | |
---|---|---|---|---|
0 | 1 | Left Levee Bank (1) | 4.124 | 1059.754 |
1 | 2 | Lowest Point (2) | 72.914 | 1052.803 |
2 | 3 | Right Levee Bank (3) | 195.897 | 1057.989 |
3 | 4 | Left Low Flow Bank (4) | 71.119 | 1053.263 |
4 | 5 | Right Low Flow Bank (5) | 74.003 | 1053.357 |