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

Update docs with how users can add unknown keywords themselves #637

Open
tim-vd-aardweg opened this issue Apr 29, 2024 · 0 comments
Open

Comments

@tim-vd-aardweg
Copy link
Contributor

What is the need for this task.
The documentation should be updated with how users can add support for custom keywords that are not yet supported, for example:

class RandomSection(INIBasedModel):
    class Comments(INIBasedModel.Comments):
        randomkeyword: Optional[str] = Field("This is a random keyword", alias="randomKeyword")

    _header: Literal["Geometry"] = "RandomSection"
    comments: Comments = Comments()

    unknownkeywordinunknownsection: str = Field("default", alias="UnknownKeywordInUnknownSection")

class ExtendedGeometry(Geometry):
    newkeyword: int = Field(0, "newKeyword")
    unknownkeyword: int = Field(0, alias="unknownKeyword")
    unknownkeywordwithcomment: str = Field("", alias="unknownKeywordWithComment")

class ExtendedFMModel(FMModel):
    geometry: ExtendedGeometry = Field(default_factory=ExtendedGeometry)
    randomsection: RandomSection = Field(default_factory=RandomSection)

input_mdu = (
        test_input_dir / "dflowfm_individual_files" / "with_unknown_keywords.mdu"
)

model = ExtendedFMModel(input_mdu)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant