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

IniBasedModel should support multiple delimiters for whitespace-separated list values #729

Open
arthurvd opened this issue Jan 21, 2025 · 0 comments
Labels
type: bug Something isn't working

Comments

@arthurvd
Copy link
Member

Describe the bug
Some D-Flow FM MDU keywords are whitespace-separated list values and these are handled by the hydrolib.core.dflowfm.ini.util.get_split_string_on_delimiter_validator validator. This supports only one separator string, currently mostly " ".

For validating (i.e. loading) a model, we'd like to support multiple delimiters.
For serialization is OK to keep the current behavior: only one delimiter.

To Reproduce
Steps to reproduce the behavior:

  1. Use unit test test_mdu_file_with_network_is_read_correctly() with test model tests/data/input/e02/c11_korte-woerden-1d/dimr_model/dflowfm/FlowFM.mdu
  2. Change line
Cdbreakpoints     = 0.00063 7.23d-003

to

Cdbreakpoints     = 0.00063\t7.23d-003

(enter an actual tab character for \t)
3. Load the model
4. See validation appearing:

E               FlowFM.mdu -> wind -> CdBreakpoints -> 0
E                 value is not a valid float (type=type_error.float)

Expected behavior
For loading/validating: multiple separator strings should be possible, Multiple consecutive separators in input string should be treated as one.
For serializing, use only one separator string. Possible approach could be to allow a list of strings to be set (in get_list_delimiter()), all used by get_split_string_on_delimiter_validator for validation, and only the first list element used by _convert_value() for serialization.

Version info (please complete the following information):

  • OS: N/A (tested on Windows)
  • Version: 0.8.0
@arthurvd arthurvd added the type: bug Something isn't working label Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
Status: To do
Development

No branches or pull requests

1 participant