Getting started

Res1D

Res1D is the main interface for accessing data on a Network.

from mikeio1d import Res1D
res = Res1D('../data/network.res1d')
res
<mikeio1d.Res1D>

Locations

Locations are where model results exist in the network. The main location types are nodes, reaches, and catchments. Each of these location types are accessible via a Res1D object.

res.nodes
<ResultNodes> (119)
Quantities (1)
  • Water level (m)
Derived Quantities (3)
  • NodeFlooding
  • NodeWaterDepth
  • NodeWaterLevelAboveCritical

Specific locations are accessible via their unique ID.

res.nodes['101']
<Manhole: 101>
Attributes (8)
  • id: 101
  • type: Manhole
  • xcoord: -687859.5004882812
  • ycoord: -1056308.700012207
  • ground_level: 196.67999267578125
  • bottom_level: 195.92999267578125
  • critical_level: inf
  • diameter: 1.0
Quantities (1)
  • Water level (m)
Derived Quantities (3)
  • NodeFlooding
  • NodeWaterDepth
  • NodeWaterLevelAboveCritical

Quantities

Quantities are the actual model results, which can be read into a pandas DataFrame or plotted directly.

df = res.nodes['101'].WaterLevel.read()
df.head()
WaterLevel:101
1994-08-07 16:35:00.000 195.931503
1994-08-07 16:36:01.870 195.931595
1994-08-07 16:37:07.560 195.931625
1994-08-07 16:38:55.828 195.931656
1994-08-07 16:39:55.828 195.931656
res.nodes['101'].WaterLevel.plot()

Quantity collections enable reading many results at once.

df = res.reaches.Discharge.read()
df.describe().T.head()
count mean std min 25% 50% 75% max
Discharge:100l1:23.8414 110.0 0.014078 0.026875 0.000006 0.000636 0.001032 0.005988 0.099751
Discharge:101l1:33.218 110.0 -0.000034 0.005649 -0.022655 0.000004 0.000005 0.000022 0.019202
Discharge:102l1:5.46832 110.0 0.069058 0.100331 -0.011316 0.003062 0.017987 0.096062 0.326383
Discharge:103l1:13.0327 110.0 -0.000011 0.001084 -0.006748 0.000002 0.000017 0.000337 0.001056
Discharge:104l1:17.2065 110.0 0.000005 0.000002 0.000003 0.000005 0.000005 0.000005 0.000025

Xns11

Xns11 is the main interface for accessing cross section data.

from mikeio1d import Xns11

xns = Xns11('../data/mikep_cs_demo.xns11')
xns.xsections['basin_left1','122.042','1'].plot(with_marker_labels=False)

xns.xsections['basin_left1','122.042','1'].processed.head()
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

Additional resources