from mikeio1d import Res1D
= Res1D('../data/network.res1d')
res = Res1D('../data/catchments.res1d') res_catchments
Data structures
Location collections
Access location collections from a Res1D object. Each collection shows available quantities and location IDs.
- res.nodes
Location collections<
Quantities (1)
- Water level (m)
Derived Quantities (3)
- NodeFlooding
- NodeWaterDepth
- NodeWaterLevelAboveCritical
Quantities (1)
- Water level (m)
Derived Quantities (3)
- NodeFlooding
- NodeWaterDepth
- NodeWaterLevelAboveCritical
res.reaches
Location collections<
Quantities (2)
- Water level (m)
- Discharge (m^3/s)
Derived Quantities (6)
- ReachAbsoluteDischarge
- ReachFilling
- ReachFlooding
- ReachQQManning
- ReachWaterDepth
- ReachWaterLevelAboveCritical
Quantities (2)
- Water level (m)
- Discharge (m^3/s)
Derived Quantities (6)
- ReachAbsoluteDischarge
- ReachFilling
- ReachFlooding
- ReachQQManning
- ReachWaterDepth
- ReachWaterLevelAboveCritical
res_catchments.catchments
Location collections<
Single locations
Access a single location by indexing its respective collection with its unique ID. Each location shows available quantities and static properties.
-
+
'1'] res.nodes[
<Manhole: 1>
@@ -416,7 +416,7 @@ Single locations
Attributes (8)
- id: 1
- type: Manhole
- xcoord: -687934.6000976562
- ycoord: -1056500.69921875
- ground_level: 197.07000732421875
- bottom_level: 195.0500030517578
- critical_level: inf
- diameter: 1.0
Quantities (1)
- Water level (m)
Derived Quantities (3)
- NodeFlooding
- NodeWaterDepth
- NodeWaterLevelAboveCritical
-
+
'100l1'] res.reaches[
<Reach: 100l1>
@@ -430,7 +430,7 @@ Single locations
Attributes (9)
- name: 100l1
- length: 47.6827148432828
- start_chainage: 0.0
- end_chainage: 47.6827148432828
- n_gridpoints: 3
- start_node: 100
- end_node: 99
- height: 0.30000001192092896
- full_flow_discharge: 0.12058743359507902
Quantities (2)
- Water level (m)
- Discharge (m^3/s)
Derived Quantities (6)
- ReachAbsoluteDischarge
- ReachFilling
- ReachFlooding
- ReachQQManning
- ReachWaterDepth
- ReachWaterLevelAboveCritical
-
+
# gridpoint on reach 100l1 at chainage 23.841
'100l1']['23.841'] res.reaches[
@@ -456,13 +456,13 @@ Single locations
Gridpoints can also be indexed by number instead of chainage. For example:
-
+
'100l1'][0] # first gridpoint
res.reaches['100l1'][-1] # last gridpoint res.reaches[
-
+
'100_16_16'] res_catchments.catchments[
<Catchment: 100_16_16>
@@ -481,13 +481,13 @@ Single locations
Quantities
Quantities are the actual model results. Each single location or location collection has associated quantities.
-
+
res.nodes.WaterLevel
<QuantityCollection (119): Water level (m)>
-
+
'1'].WaterLevel res.nodes[
<Quantity: Water level (m)>
@@ -556,7 +556,7 @@ Quantities
Static attributes
Each location has a set of static attributes.
-
+
'1'].ground_level res.nodes[
197.07000732421875
@@ -566,7 +566,7 @@ Static attributes
Reading data
All result data for a single location or location collection can be read into a pandas DataFrame.
-
+
= res.reaches['100l1'].read()
df df.head()
@@ -619,7 +619,7 @@ Reading data
-
+
= res.reaches.read()
df df.head()
@@ -785,7 +785,7 @@ Reading data
GeoDataFrames
Locations collections can be extracted into a GeoDataFrame, both with and without quantities.
-
+
= res.reaches.to_geopandas()
gdf gdf.plot()
@@ -796,7 +796,7 @@ GeoDataFrames
-
+
= res.reaches.to_geopandas(agg='max')
gdf ='max_Discharge', linewidth=3, cmap='RdYlGn_r', legend=True) gdf.plot(column
diff --git a/user-guide/quantities.html b/user-guide/quantities.html
index 81ed4c44..6439f351 100644
--- a/user-guide/quantities.html
+++ b/user-guide/quantities.html
@@ -329,7 +329,7 @@ Quantities
-
+
from mikeio1d import Res1D
= Res1D('../data/network.res1d')
res = Res1D('../data/catchments.res1d') res_catchments
@@ -342,7 +342,7 @@ Data structures
Quantity
A quantity is a single quantity at a specific location. Quantities are accessed from a location object.
-
+
'101'].WaterLevel # single quantity (i.e. water level) at a single location (i.e. node 101) res.nodes[
<Quantity: Water level (m)>
@@ -352,7 +352,7 @@ Quantity
Quantity Collection
A quantity collection is a single quantity at multiple locations. Quantity collections are accessed from a location collection.
-
+
# single quantity (i.e. water level) at multiple locations (i.e. all nodes) res.nodes.WaterLevel
<QuantityCollection (119): Water level (m)>
@@ -363,7 +363,7 @@ Quantity Collection
Reading data
Quantities and quantity collections can be read into a pandas DataFrame with their read
method.
-
+
= res.nodes['101'].WaterLevel.read()
df df.head()
@@ -404,7 +404,7 @@ Reading data
-
+
= res.nodes.WaterLevel.read()
df df.head()
@@ -570,7 +570,7 @@ Reading data
Plotting data
Quantities and quantity collections can be plotted directly with their plot
method.
-
+
'101'].WaterLevel.plot() res.nodes[
@@ -580,7 +580,7 @@ Plotting data
-
+
=False) res.nodes.WaterLevel.plot(legend
@@ -594,7 +594,7 @@ Plotting data
Dynamic selections
Quantities or quantity collections can be conveniently combined into a single DataFrame with the ‘add’ method.
-
+
'101'].WaterLevel.add()
res.nodes['100'].WaterLevel.add()
res.nodes[= res.read()
@@ -643,7 +643,7 @@ df Dynamic selections
-
+
res.nodes.WaterLevel.add()
res.reaches.WaterLevel.add()= res.read()
diff --git a/user-guide/res1d.html b/user-guide/res1d.html
index e2c143d5..59921f58 100644
--- a/user-guide/res1d.html
+++ b/user-guide/res1d.html
@@ -354,7 +354,7 @@ df Supported file types<
Opening files
Network files can be opened by providing the path to a Res1D object.
-
+
from mikeio1d import Res1D
= Res1D('../data/network.res1d')
res res
@@ -366,7 +366,7 @@ Opening files
Exploring contents
An overview of the file contents can be obtained by calling the info
method.
-
+
res.info()
Start time: 1994-08-07 16:35:00
@@ -381,14 +381,14 @@ Exploring contents
The quantity IDs are accessible via the quantities
attribute.
-
+
res.quantities
['WaterLevel', 'Discharge']
Res1D results share a common time index, which can be accessed via the time_index
attribute.
-
+
res.time_index
DatetimeIndex([ '1994-08-07 16:35:00', '1994-08-07 16:36:01.870000',
@@ -409,7 +409,7 @@ Exploring contents
Reading all data
All data can be read into a pandas DataFrame by calling the read
method.
-
+
= res.read()
df df.head()
@@ -575,7 +575,7 @@ Reading all data
Accessing 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 the Res1D object.
-
+
res.reaches
<ResultReaches> (118)
@@ -589,7 +589,7 @@ Accessing locationsQuantities (2) - Water level (m)
- Discharge (m^3/s)
Derived Quantities (6)
- ReachAbsoluteDischarge
- ReachFilling
- ReachFlooding
- ReachQQManning
- ReachWaterDepth
- ReachWaterLevelAboveCritical
-
+
res.nodes
<ResultNodes> (119)
@@ -603,7 +603,7 @@ Accessing locationsQuantities (1) - Water level (m)
Derived Quantities (3)
- NodeFlooding
- NodeWaterDepth
- NodeWaterLevelAboveCritical
-
+
= Res1D('../data/catchments.res1d')
res_cat res_cat.catchments
@@ -622,7 +622,7 @@ Accessing locations
Modifying data
Limited functionality is provided for modifying result data. A common use case for this is hotstart files. Modifying static network data is not supported.
-
+
# Add 1m to the water level of the node with ID '1'.
= res.read(column_mode='timeseries')
df = df.copy()
@@ -631,7 +631,7 @@ df_modified Modifying data
='modified.res1d') res.modify(df_modified, file_path
-
+
import os
'modified.res1d') os.remove(
Single locations
Access a single location by indexing its respective collection with its unique ID. Each location shows available quantities and static properties.
-'1'] res.nodes[
Single locations
Attributes (8)
- id: 1
- type: Manhole
- xcoord: -687934.6000976562
- ycoord: -1056500.69921875
- ground_level: 197.07000732421875
- bottom_level: 195.0500030517578
- critical_level: inf
- diameter: 1.0
Quantities (1)
- Water level (m)
Derived Quantities (3)
- NodeFlooding
- NodeWaterDepth
- NodeWaterLevelAboveCritical
'100l1'] res.reaches[
Single locations
Attributes (9)
- name: 100l1
- length: 47.6827148432828
- start_chainage: 0.0
- end_chainage: 47.6827148432828
- n_gridpoints: 3
- start_node: 100
- end_node: 99
- height: 0.30000001192092896
- full_flow_discharge: 0.12058743359507902
Quantities (2)
- Water level (m)
- Discharge (m^3/s)
Derived Quantities (6)
- ReachAbsoluteDischarge
- ReachFilling
- ReachFlooding
- ReachQQManning
- ReachWaterDepth
- ReachWaterLevelAboveCritical
# gridpoint on reach 100l1 at chainage 23.841
'100l1']['23.841'] res.reaches[
Single locations
Gridpoints can also be indexed by number instead of chainage. For example:
-'100l1'][0] # first gridpoint
res.reaches['100l1'][-1] # last gridpoint res.reaches[
'100_16_16'] res_catchments.catchments[
Single locations
Quantities
Quantities are the actual model results. Each single location or location collection has associated quantities.
- res.nodes.WaterLevel
<QuantityCollection (119): Water level (m)>
'1'].WaterLevel res.nodes[
<Quantity: Water level (m)>
@@ -556,7 +556,7 @@ Quantities
Static attributes
Each location has a set of static attributes.
-'1'].ground_level res.nodes[
197.07000732421875
@@ -566,7 +566,7 @@ Static attributes
Reading data
All result data for a single location or location collection can be read into a pandas DataFrame.
-= res.reaches['100l1'].read()
df df.head()
Reading data
= res.reaches.read()
df df.head()
Reading data
GeoDataFrames
Locations collections can be extracted into a GeoDataFrame, both with and without quantities.
-= res.reaches.to_geopandas()
gdf gdf.plot()
GeoDataFrames
= res.reaches.to_geopandas(agg='max')
gdf ='max_Discharge', linewidth=3, cmap='RdYlGn_r', legend=True) gdf.plot(column
Quantities
from mikeio1d import Res1D
= Res1D('../data/network.res1d')
res = Res1D('../data/catchments.res1d') res_catchments
Data structures
Quantity
A quantity is a single quantity at a specific location. Quantities are accessed from a location object.
-'101'].WaterLevel # single quantity (i.e. water level) at a single location (i.e. node 101) res.nodes[
<Quantity: Water level (m)>
@@ -352,7 +352,7 @@ Quantity
Quantity Collection
A quantity collection is a single quantity at multiple locations. Quantity collections are accessed from a location collection.
-# single quantity (i.e. water level) at multiple locations (i.e. all nodes) res.nodes.WaterLevel
<QuantityCollection (119): Water level (m)>
@@ -363,7 +363,7 @@ Quantity Collection
Reading data
Quantities and quantity collections can be read into a pandas DataFrame with their read
method.
= res.nodes['101'].WaterLevel.read()
df df.head()
Reading data
= res.nodes.WaterLevel.read()
df df.head()
Reading data
Plotting data
Quantities and quantity collections can be plotted directly with their plot
method.
'101'].WaterLevel.plot() res.nodes[
Plotting data
=False) res.nodes.WaterLevel.plot(legend
Plotting data
Dynamic selections
Quantities or quantity collections can be conveniently combined into a single DataFrame with the ‘add’ method.
-'101'].WaterLevel.add()
res.nodes['100'].WaterLevel.add()
res.nodes[= res.read()
@@ -643,7 +643,7 @@ df Dynamic selections
res.nodes.WaterLevel.add()
res.reaches.WaterLevel.add()= res.read()
diff --git a/user-guide/res1d.html b/user-guide/res1d.html
index e2c143d5..59921f58 100644
--- a/user-guide/res1d.html
+++ b/user-guide/res1d.html
@@ -354,7 +354,7 @@ df Supported file types<
Opening files
Network files can be opened by providing the path to a Res1D object.
-
+
from mikeio1d import Res1D
= Res1D('../data/network.res1d')
res res
@@ -366,7 +366,7 @@ Opening files
Exploring contents
An overview of the file contents can be obtained by calling the info
method.
-
+
res.info()
Start time: 1994-08-07 16:35:00
@@ -381,14 +381,14 @@ Exploring contents
The quantity IDs are accessible via the quantities
attribute.
-
+
res.quantities
['WaterLevel', 'Discharge']
Res1D results share a common time index, which can be accessed via the time_index
attribute.
-
+
res.time_index
DatetimeIndex([ '1994-08-07 16:35:00', '1994-08-07 16:36:01.870000',
@@ -409,7 +409,7 @@ Exploring contents
Reading all data
All data can be read into a pandas DataFrame by calling the read
method.
-
+
= res.read()
df df.head()
@@ -575,7 +575,7 @@ Reading all data
Accessing 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 the Res1D object.
-
+
res.reaches
<ResultReaches> (118)
@@ -589,7 +589,7 @@ Accessing locationsQuantities (2) - Water level (m)
- Discharge (m^3/s)
Derived Quantities (6)
- ReachAbsoluteDischarge
- ReachFilling
- ReachFlooding
- ReachQQManning
- ReachWaterDepth
- ReachWaterLevelAboveCritical
-
+
res.nodes
<ResultNodes> (119)
@@ -603,7 +603,7 @@ Accessing locationsQuantities (1) - Water level (m)
Derived Quantities (3)
- NodeFlooding
- NodeWaterDepth
- NodeWaterLevelAboveCritical
-
+
= Res1D('../data/catchments.res1d')
res_cat res_cat.catchments
@@ -622,7 +622,7 @@ Accessing locations
Modifying data
Limited functionality is provided for modifying result data. A common use case for this is hotstart files. Modifying static network data is not supported.
-
+
# Add 1m to the water level of the node with ID '1'.
= res.read(column_mode='timeseries')
df = df.copy()
@@ -631,7 +631,7 @@ df_modified Modifying data
='modified.res1d') res.modify(df_modified, file_path
-
+
import os
'modified.res1d') os.remove(