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

Merge comments and keywords #675

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

Merge comments and keywords #675

veenstrajelmer opened this issue Jul 5, 2024 · 0 comments

Comments

@veenstrajelmer
Copy link
Collaborator

Is your feature request related to a problem? Please describe.
In the hydrolib.core.dflowfm.mdu.models code, all mdu keywords are defined. The comments and keywords+type+default are defined separately, like so:

class General(INIGeneral):
"""The MDU file's `[General]` section with file meta data."""
class Comments(INIBasedModel.Comments):
program: Optional[str] = Field("Program.", alias="program")
version: Optional[str] = Field(
"Version number of computational kernel", alias="version"
)
filetype: Optional[str] = Field("File type. Do not edit this", alias="fileType")
fileversion: Optional[str] = Field(
"File version. Do not edit this.", alias="fileVersion"
)
autostart: Optional[str] = Field(
"Autostart simulation after loading MDU or not (0=no, 1=autostart, 2=autostartstop).",
alias="autoStart",
)
pathsrelativetoparent: Optional[str] = Field(
"Whether or not (1/0) to resolve file names (e.g. inside the *.ext file) relative to their direct parent, instead of to the toplevel MDU working dir",
alias="pathsRelativeToParent",
)
guiversion: Optional[str] = Field(
"DeltaShell FM suite version.", alias="guiVersion"
)
comments: Comments = Comments()
_header: Literal["General"] = "General"
program: str = Field("D-Flow FM", alias="program")
version: str = Field("1.2.94.66079M", alias="version")
filetype: Literal["modelDef"] = Field("modelDef", alias="fileType")
fileversion: str = Field("1.09", alias="fileVersion")
autostart: Optional[AutoStartOption] = Field(AutoStartOption.no, alias="autoStart")
pathsrelativetoparent: bool = Field(False, alias="pathsRelativeToParent")
guiversion: Optional[str] = Field(None, alias="guiVersion")

Describe the solution you'd like
From a maintenance point of view, it would be convenient to define the comments as part of the keyword, for instance by defining a class based on Field, containing an extra comment property. Furthermore (and alternatively), it would be great if all keywords (including type, default, GA/research status, comment and existing/deprecated status) could be moved to a json/csv file instead of being defined in the code. This would be a first step towards aligning the keywords between kernel/hydrolib-core/GUI.

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