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

crosslocmodel cannot read file with single cross section #680

Open
veenstrajelmer opened this issue Jul 8, 2024 · 0 comments
Open

crosslocmodel cannot read file with single cross section #680

veenstrajelmer opened this issue Jul 8, 2024 · 0 comments

Comments

@veenstrajelmer
Copy link
Collaborator

veenstrajelmer commented Jul 8, 2024

Describe the bug
When providing a crosslocfile with a single cross section, hydrolib-core cannot read this since it is not a list. Related to #678.

To Reproduce

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
"""
with open(crsl_file, 'w') as f:
    f.write(crsl_str)

crossloc = CrossLocModel(crsl_file)

This raises

ValidationError: 1 validation error for CrossLocModel
crsloc.ini -> crosssection
  value is not a valid list (type=type_error.list)

Expected behavior
Also files with a single cross section should be properly read.

Version info (please complete the following information):

  • OS: Windows
  • Version 0.7.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: To do
Development

No branches or pull requests

1 participant