-
Notifications
You must be signed in to change notification settings - Fork 8
prof_to_cross utility #488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
arthurvd
wants to merge
11
commits into
main
Choose a base branch
from
feat/487_prof_to_cross
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
987f168
First version of prof_to_cross utility
arthurvd 2eee1af
Working version of conversion, including all profdef and xyz data.
arthurvd 324478e
Fix prof_to_cross docs + include in mkdocs config
arthurvd 445af72
Move prof_to_cross to hydrolib/tools + more docs
arthurvd 6dfcfd4
Add option --outfiles
arthurvd 14728bd
Add two example testcases + unit tests + fix discovered bugs
arthurvd 6e14abf
Merge branch 'main' into feat/487_prof_to_cross
priscavdsluis 0781a22
Add friction support to converter.
arthurvd f8bb9b3
Merge branch 'feat/487_prof_to_cross' of https://github.com/Deltares/…
arthurvd ed8ff78
Support ZMIN in profdef as shift in crsloc.
arthurvd 16b149b
Document the new support for friction and zmin.
arthurvd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| prof_to_cross | ||
| ============= | ||
| *Convert D-Flow FM legacy profile files to cross section files.* | ||
|
|
||
| Directly jump to [Commandline usage](#Commandline-usage). | ||
|
|
||
| # Background | ||
| 1D cross section specification in a D-Flow FM model used to go via two or three prof* files, | ||
| the ones specified in the MDU file under `[geometry]` via `ProflocFile`, `ProfdefFile` | ||
| and optionally `ProfdefxyzFile`. They contain the location/placement and the type/geometry description, respectively. | ||
|
|
||
| Similar input is still needed, but now is officially supported via .ini files. | ||
| These are the ones now specified in the MDU file under `[geometry]` via `CrsLocFile` and `CrsDefFile`. | ||
|
|
||
| ## Automatic conversion choices | ||
| prof_to_cross makes the following automatic conversion choices. | ||
| ### Location | ||
| Location continues to be specified via original *x,y* coordinate, no branchId is available. | ||
|
|
||
| Vertical absolute placement (`ZMIN` in profile *definition* file) only has a basic conversion | ||
| (as direct `shift` in crosssection *location* file). | ||
|
|
||
| ### Type + conveyance | ||
| The following table lists the mapping from old to new cross section types: | ||
|
|
||
| |Profdef TYPE|meaning|type in crsdef.ini|conveyanceType in crsdef.ini| | ||
| | :--- | :--- | :--- | :--- | | ||
| |1|`PIPE`|`circle`|N/A| | ||
| |2|`RECTAN , HYDRAD = AREA / PERIMETER`|`rectangle`|N/A| | ||
| |3|`RECTAN , HYDRAD = 1D ANALYTIC CONVEYANCE`|`rectangle`|N/A| | ||
| |4|`V-SHAPE , HYDRAD = AREA / PERIMETER`|`yz`|`lumped`| | ||
| |5|`V-SHAPE , HYDRAD = 1D ANALYTIC CONVEYANCE`|`yz`|`segmented`| | ||
| |6|`TRAPEZOID, HYDRAD = AREA / PERIMETER`|`yz`|`lumped`| | ||
| |7|`TRAPEZOID, HYDRAD = 1D ANALYTIC CONVEYANCE`|`yz`|`segmented`| | ||
| |100|`YZPROF , HYDRAD = AREA / PERIMETER`|`yz`|`lumped`| | ||
| |101|`YZPROF , HYDRAD = 1D ANALYTIC CONVEYANCE METHOD`|`yz`|`segmented`| | ||
| |200|`XYZPROF , HYDRAD = AREA / PERIMETER`|`xyz`|`lumped`| | ||
| |201|`XYZPROF , HYDRAD = 1D ANALYTIC CONVEYANCE METHOD`|`xyz`|`segmented`| | ||
|
|
||
| ### Friction | ||
| The following table lists the mapping from old to new friction types: | ||
|
|
||
| |Profdef FRCTP|frictionType in crsdef.ini | ||
| | :--- | :--- | | ||
| |`0`|`Chezy`| | ||
| |`1`|`Manning`| | ||
| |`2`|`WallLawNikuradse` (a.k.a. White-Colebrook Delft3D-style)| | ||
| |`3`|`WhiteColebrook`| | ||
|
|
||
|
|
||
| # Commandline usage: | ||
| ```bash | ||
| usage: python hydrolib/tools/prof_to_cross.py [-h] [--version] [--verbose] \ | ||
| [--mdufile MDUFILE] \ | ||
| [--proffiles [PROFFILE [PROFFILE ...]]] \ | ||
| [--outfiles CRSLOCFILE CRSDEFFILE] | ||
| ``` | ||
|
|
||
| ## Arguments | ||
|
|
||
| |short|long|default|help| | ||
| | :--- | :--- | :--- | :--- | | ||
| |`-h`|`--help`||show this help message and exit| | ||
| |`-v`|`--version`||show program's version number and exit| | ||
| ||`--verbose`||also print diagnostic information| | ||
| |`-m`|`--mdufile`|`None`|automatically take profile filenames from MDUFILE| | ||
| |`-p`|`--proffiles`|`None`|2 or 3 profile files: PROFLOCFILE PROFDEFFILE [PROFDEFXYZFILE]| | ||
| |`-o`|`--outfiles` |`crsloc.ini crsdef.ini`|save cross section locations and definitions to specified filenames| | ||
|
|
||
| # Python usage: | ||
| ```python | ||
| from hydrolib.tools import prof_to_cross | ||
|
|
||
| # Option 1: via MDU file: | ||
| prof_to_cross.prof_to_cross_from_mdu('FlowFM.mdu') | ||
|
|
||
| # Option 2: directly via profile files: | ||
| prof_to_cross.prof_to_cross('profloc.xyz', 'profdef.txt', 'profdefxyz.pliz') | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # Introduction to tools | ||
|
|
||
| HYDROLIB-core also contains utility tools built on top of the core I/O functionality. | ||
| These small tools may help with model conversion and inspection. | ||
|
|
||
| * **[prof_to_cross](prof_to_cross.md)** - Convert D-Flow FM legacy profdef/profloc files to cross section files. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
|
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.