Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
fae07b7
refactor: migrate import functionality to fm2prof/imports package wit…
kdberends Jul 24, 2026
99a2528
removed deprecated classes
kdberends Jul 24, 2026
2a72888
added test data for mlnbk case
kdberends Jul 24, 2026
9e9f744
refactor: introduce source-agnostic ModelData pipeline with dtype-saf…
kdberends Jul 28, 2026
a915792
updated legacy pickle data
kdberends Jul 28, 2026
3b57280
added importer for csv elevation file
kdberends Jul 28, 2026
4a43f7d
ran upgrade on\ lock-file
kdberends Jul 29, 2026
35c7c24
fix dependency issues
kdberends Jul 29, 2026
6f8bcb4
added test for data processing and reducing cognitive complexity of b…
kdberends Jul 29, 2026
131e837
fixed some issues following copilot review
kdberends Jul 29, 2026
c12e09f
#158 updated documentation with new optional field and input files se…
kdberends Jul 31, 2026
3188174
updated input text to more general delimited text instead of csv, txt
kdberends Jul 31, 2026
096e57a
added test config for elevation only case
kdberends Jul 31, 2026
fb1dded
added acceptance test-case for elevation only case
kdberends Jul 31, 2026
ba7300e
#159 added automatic source detection
kdberends Jul 31, 2026
f9f9ab6
#159 added build model data test case
kdberends Jul 31, 2026
25514d2
#159 build_model_data now works with elevation only data, without reg…
kdberends Jul 31, 2026
11aaaa2
#159 initialisation now checks for hydraulics and edge data
kdberends Jul 31, 2026
6363e53
#159 match projection crs of data and cross-section input file
kdberends Jul 31, 2026
5aebbf7
#159 cross-section generation and finalisation now works with elevati…
kdberends Jul 31, 2026
66afdd3
fixed bug with path resolving to cwd instead of relative to ini file
kdberends Jul 31, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/notebooks/cross_section_data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@
"import matplotlib.pyplot as plt\n",
"\n",
"variable = 'bedlevel' # other variables to plot: bedlevel, section, region, area\n",
"x = data.get('fm_data').get('x')\n",
"y = data.get('fm_data').get('y')\n",
"z = data.get('fm_data').get(variable)\n",
"x = data.get('model_data').get('x')\n",
"y = data.get('model_data').get('y')\n",
"z = data.get('model_data').get(variable)\n",
"\n",
"fig, ax = plt.subplots(1)\n",
"sc = ax.scatter(x/1000, y/1000, c=z)\n",
Expand Down Expand Up @@ -162,7 +162,7 @@
"\n",
"variable = 'velocity' # try also: waterlevel, waterdepth\n",
"\n",
"z = data.get('fm_data').get(variable)\n",
"z = data.get('model_data').get(variable)\n",
"fig, ax = plt.subplots(1)\n",
"\n",
"sc = ax.scatter(x/1000, y/1000, c=z.iloc[6])\n",
Expand Down
12 changes: 9 additions & 3 deletions docs/user_docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,23 @@ with open('fm2prof/configurationfile_template.json', 'r') as f:
for section_name, section_content in config["sections"].items():
print(f"### " + section_name.capitalize())
for key_value, key_content in section_content.items():
optional = key_content.get('optional')

print (f"#### {key_value}")
print (f"""

{key_content.get('hint')}



| Input | Value |
|----------|:-------------:|
| Type | {key_content.get('type')} |
| Default value |{key_content.get('value')}|

""")
| Default value |{key_content.get('value')}|""")
if optional is not None:
print (f"| Optional |{optional}|\n")
else:
print("\n")


```
1 change: 1 addition & 0 deletions docs/user_docs/elevation_only.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Generating
58 changes: 58 additions & 0 deletions docs/user_docs/input_files.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Input Files

FM2PROF requires two mandatory input files and accepts two optional files.

| File | Required |
|------|----------|
| 2D map output | Yes |
| Cross-section locations | Yes |
| Region polygon | No |
| Section polygon | No |



## 2D map output

The 2D model output file. Two formats are currently supported:

**NetCDF (`*_map.nc`)** — output from a D-Flow FM 2D simulation. Contains mesh geometry (face coordinates, bed levels, flow areas) and hydraulic results (water levels, water depths, velocities, Chézy roughness).

**CSV** — a comma-separated file with a header row. The following columns are required:

| Column | Description |
|--------|-------------|
| `POINT_X` | Face centroid x-coordinate |
| `POINT_Y` | Face centroid y-coordinate |
| `POINT_Z` | Bed level |
| `Shape_Area` | Face area |

A CSV source contains geometry only; no hydraulic results are available. This will impact the output. See [Cross-sections from geometry alone](elevation_only.md) for more information on creating input and the generated output.

Configured via `2DMapOutput` in the ini file.


## Cross-section locations

A file defining the 1D cross-section locations onto which the 2D data is projected. Each record specifies a unique identifier, representative length, branch identifier, chainage, and (x, y) coordinates.

Configured via `CssFile` in the ini file.



## Region polygon (optional)

A GeoJSON polygon file that divides the model domain into named regions. Each region is processed independently during the nearest-neighbour classification step, so that cross-sections in one region do not attract 2D points from another.

If omitted, all 2D faces are classified to the nearest cross-section without regional constraints.

Configured via `RegionPolygonFile` in the ini file.



## Section polygon (optional)

A GeoJSON polygon file that assigns 2D faces and edges to roughness sections (e.g. main channel, floodplain). Labels defined in this file are used directly as section identifiers in the output roughness files.

If omitted, section classification is derived automatically from the spatial variance of the Chézy roughness field.

Configured via `SectionPolygonFile` in the ini
16 changes: 10 additions & 6 deletions fm2prof/configurationfile_template.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,27 @@
{
"2DMapOutput": {
"type": "str",
"hint": "Output file from FM2D model (.net file)",
"value": ""
"hint": "Supported input file containing 2D data (*.nc, *.csv)",
"value": "",
"optional": false
},
"CrossSectionLocationFile": {
"type": "str",
"hint": ".csv or .txt file (, as delimiter) that contains four columns: X_coordinate,Y_coordinate,BranchName,Length,Chainage.",
"value": ""
"hint": "delimited text file that contains four columns: X_coordinate,Y_coordinate,BranchName,Length,Chainage.",
"value": "",
"optional": false
},
"RegionPolygonFile": {
"type": "str",
"hint": "User defined polygons in json format",
"value": ""
"value": "",
"optional": true
},
"SectionPolygonFile": {
"type": "str",
"hint": "User defined polygons in json format",
"value": ""
"value": "",
"optional": true
}
},
"parameters": {
Expand Down
Loading
Loading