Skip to content
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

Converter for legacy profile files to cross section files #487

Open
arthurvd opened this issue Mar 29, 2023 · 1 comment · May be fixed by #488
Open

Converter for legacy profile files to cross section files #487

arthurvd opened this issue Mar 29, 2023 · 1 comment · May be fixed by #488
Assignees
Labels
type: feature Brand new functionality

Comments

@arthurvd
Copy link
Member

Is your feature request related to a problem? Please describe.
hydrolib-core currently supports cross section location and definition files in the .ini format.
However, several model schematizations exist that still use the legacy "profloc/profdef" files.
It would be nice to able to easily switch to the new format.

Describe the solution you'd like

  • A python script that converts profloc + profdef files into crsloc/crsdef.ini files
  • Should be callable as a function and as a standalone script
  • Input arguments are:
    • either the profloc + profdef + (optionally!) profdefxyz files
    • or an .mdu file, from which the prof* files will be detected
  • the legacy formats do not need to become available as Pydantic model classes, a simple file reader inside this utility will suffice.
  • Error must be given if user input is wrong
  • Error must be given if some fields in user input are not (yet) supported in converter

Additional context
Format definition of legacy files:
profloc.xyz

  • in fact a sample file (hydrolib.core.dflowfm.XYZModel)
  • the third (z) column should contain numbers, whose integer value corresponds with the PROFNR= profile definition numbers in a profdef.txt

profdef.txt

  • Comment lines start with *
  • Data lines contain a space-separated list of key=value terms
  • Valid keys:
    • PROFNR=<N>, profile id, with N positive integer. Referenced by z-column in profloc.xyz file
    • TYPE=<itype>, profile type, one of:
      • TYPE=1 : PIPE
      • TYPE=2 : RECTAN , HYDRAD = AREA / PERIMETER ALSO SPECIFY: HEIGHT=
      • TYPE=3 : RECTAN , HYDRAD = 1D ANALYTIC CONVEYANCE = WATERDEPTH ALSO SPECIFY: HEIGHT=
      • TYPE=4 : V-SHAPE , HYDRAD = AREA / PERIMETER ALSO SPECIFY: HEIGHT=
      • TYPE=5 : V-SHAPE , HYDRAD = 1D ANALYTIC CONVEYANCE ALSO SPECIFY: HEIGHT=
      • TYPE=6 : TRAPEZOID, HYDRAD = AREA / PERIMETER ALSO SPECIFY: HEIGHT= BASE=
      • TYPE=7 : TRAPEZOID, HYDRAD = 1D ANALYTIC CONVEYANCE ALSO SPECIFY: HEIGHT= BASE=
      • TYPE=100: YZPROF , HYDRAD = AREA / PERIMETER
      • TYPE=101: YZPROF , HYDRAD = 1D ANALYTIC CONVEYANCE METHOD
      • TYPE=200: XYZPROF , HYDRAD = AREA / PERIMETER
      • TYPE=201: XYZPROF , HYDRAD = 1D ANALYTIC CONVEYANCE METHOD
    • WIDTH=<w> with w a positive float equals the (top) width
    • HEIGHT=<h> with h a positive float equals the height
    • ZMIN=<z> with z a float equals the absolute bed level of the cross section
    • BASE=<wb> with wb a positive float equals the base width
    • TALUD=<s> with s a positive float equals the talud slope. Used when BASE is omitted for trapezoid type.
    • FRCTP=<ifrctp> with ifrctp the integer friction type on this cross section (See translation below)
    • FRCCF=<cf> with cf a positive float equals the friction coefficient

Translation friction types:
0: Chezy
1: Manning
2: WallLawNikuradse (a.k.a. White-Colebrook Delft3D-style)
3: WhiteColebrook

profdefxyz.pliz

  • in fact a polyline file (hydrolib.core.dflowfm.PolyFile)
  • multiple polylines in single file
  • polyline label equals PROFNR=<N>, should match with profdef.txt file
  • x,y,z columns simply form a xyz profile geometry
@arthurvd arthurvd added the type: feature Brand new functionality label Mar 29, 2023
@arthurvd arthurvd self-assigned this Mar 29, 2023
@arthurvd
Copy link
Member Author

CC @willem4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature Brand new functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants