Skip to content

Commit

Permalink
use ForcingData class as a type for the discharge, temperature, and…
Browse files Browse the repository at this point in the history
… salinity in the `SourceSink` class
  • Loading branch information
MAfarrag committed Jan 9, 2025
1 parent d246cd1 commit 89b55a0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion hydrolib/core/dflowfm/bc/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,7 @@ class RealTime(StrEnum):
"""str: Realtime data source, externally provided"""


ForcingData = Union[float, RealTime, ForcingModel]
ForcingData = Union[float, List[float], RealTime, ForcingModel]
"""Data type that selects from three different types of forcing data:
* a scalar float constant
* "realtime" keyword, indicating externally controlled.
Expand Down
10 changes: 4 additions & 6 deletions hydrolib/core/dflowfm/ext/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ class SourceSink(INIBasedModel):
A `[SourceSink]` block for use inside an external forcings file,
i.e., a [ExtModel][hydrolib.core.dflowfm.ext.models.SourceSink].
All lowercased attributes match with the lateral input as described in
All lowercased attributes match with the source-sink input as described in
[UM Sec.C.5.2.4](https://content.oss.deltares.nl/delft3dfm1d2d/D-Flow_FM_User_Manual_1D2D.pdf#subsection.C.5.2.4).
"""

Expand All @@ -210,13 +210,11 @@ class SourceSink(INIBasedModel):

zsource: Optional[Union[float, List[float]]] = Field(alias="zSource")
zsink: Optional[Union[float, List[float]]] = Field(alias="zSink")
discharge: Union[float, List[float]] = Field(alias="discharge")
discharge: ForcingData = Field(alias="discharge")
area: Optional[float] = Field(alias="Area")

salinitydelta: Optional[Union[List[float], float]] = Field(alias="SalinityDelta")
temperaturedelta: Optional[Union[List[float], float]] = Field(
alias="TemperatureDelta"
)
salinitydelta: Optional[ForcingData] = Field(alias="SalinityDelta")
temperaturedelta: Optional[ForcingData] = Field(alias="TemperatureDelta")
interpolationmethod: Optional[str] = Field(alias="interpolationMethod")
operand: Optional[Operand] = Field(Operand.override.value, alias="operand")

Expand Down

0 comments on commit 89b55a0

Please sign in to comment.