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

CrossSection locations and ObservationCrossSections written by hydrolib-core contains unknown keyword locationtype #678

Closed
veenstrajelmer opened this issue Jul 8, 2024 · 0 comments · Fixed by #683
Labels
type: compatibility Changes needed to be compatible with the computational core

Comments

@veenstrajelmer
Copy link
Collaborator

veenstrajelmer commented Jul 8, 2024

Describe the bug
A crossLocFile (crossloc.ini) written by hydrolib-core contains the unknown keyword locationtype. This means the file cannot be read by HYDROLIB-core itself. This behaviour has also been found for ObservationCrossSections and should also be fixed there.

To Reproduce
Minimal code based on issue found in demo_dsd.ipynb. The file raising an error is crsloc.ini

from hydrolib.core.dflowfm import CrossLocModel
crsl_file = "crsloc.ini"
crsl_str = """
[General]
fileVersion = 1.01
fileType    = crossLoc

[CrossSection]
id           = 99
branchId     = 9
chainage     = 403.089709
shift        = 0.0
definitionId = 99
locationtype = 1d

[CrossSection]
id           = 99
branchId     = 9
chainage     = 403.089709
shift        = 0.0
definitionId = 99
locationtype = 1d
"""
with open(crsl_file, 'w') as f:
    f.write(crsl_str)

crossloc = CrossLocModel(crsl_file)

This raises:

ValidationError: 2 validation errors for CrossLocModel
crsloc.ini -> crosssection -> 0 -> __root__
  Unknown keywords are detected in section: 'CrossSection', '['locationtype']' (type=value_error)
crsloc.ini -> crosssection -> 1 -> __root__
  Unknown keywords are detected in section: 'CrossSection', '['locationtype']' (type=value_error)

Expected behavior
Not writing the locationtype property, so resulting in a valid crossloc.ini file that can be read with HYDROLIB-core again. Or maybe it is an allowed property, but in that case hydrolib-core should recognize it.

Version info (please complete the following information):

  • OS: Windows
  • Version main

Additional info
This did not happen yet in the latest release (0.7.0)

@tim-vd-aardweg tim-vd-aardweg changed the title crossLocFile written by hydrolib-core contains unknown keyword locationtype CrossSection locations and ObservationCrossSections written by hydrolib-core contains unknown keyword locationtype Jul 8, 2024
tim-vd-aardweg added a commit that referenced this issue Jul 9, 2024
@priscavdsluis priscavdsluis added the type: compatibility Changes needed to be compatible with the computational core label Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: compatibility Changes needed to be compatible with the computational core
Projects
Status: Done
2 participants