Deltares / HYDROLIB-core

Core code around the I/O of the DHYDRO-suite
https://deltares.github.io/HYDROLIB-core/
MIT License
25 stars 4 forks source link

Unknown mdu sections in FMModel #237

Closed SCLaan closed 2 years ago

SCLaan commented 2 years ago

Describe the bug In hydrolib.core.io.mdu.models.FMModel, the following sections in the mdu are not recognized:

This causes the ValidationError: _extra fields not permitted (type=valueerror.extra)

To Reproduce test.mdu.txt Steps to reproduce the behavior: from hydrolib.core.io.mdu.models import FMModel model_path = Path(r'') fm = FMModel(filepath=model_path)

Expected behavior No ValidationError when reading the mdu file. Optionally a warning for unkown sections that still have to be implemented.

Version info (please complete the following information):

priscavdsluis commented 2 years ago

As discussed with @arthurvd, some of the keywords and sections are not "official", they are not mentioned in the D-Flow FM manual as supported features. However, they are part of the functionality that the kernel provides, so we decided that we will probably add the missing keywords and sections to the manual so that the kernel and hydrolib-core can officialy support them.

The reason why we are strict with extra sections in the MDU, is to gain more insight into users' models, like we have now with this issue.

arthurvd commented 2 years ago

Discussed this with @SCLaan:

Definition of [grw] fields: All optional:

Definition of [particles] fields: All optional:

BeardedPlatypus commented 2 years ago

@arthurvd I am pretty sure sections which are set to None are automatically skipped as part of the serialize (see this, which skips empty sections when converting the FM model to a Document). So this should work out of the box (I hope).

LisaWeijers commented 2 years ago

I see this was marked as done in July. Is anything known about when 0.4.0 will be released? I run into this issue a lot (grw pops up a lot!) and would love to see this fixed soon.

priscavdsluis commented 2 years ago

Hi @LisaWeijers, I think hydrolib-core release is planned in oktober/november. So that might be a little too long to wait for you. As we also got a request to release sooner from other users, I will discuss it with @arthurvd when he gets back from his holiday. I think it should be possible to release a stable version earlier.

In the mean time (if it blocks your work) you could try to use an installation from the main branch.

LisaWeijers commented 2 years ago

Thanks for the info, good to know, I will consider that alternative!