Skip to content

Commit

Permalink
feat: Support the old style external forcings file
Browse files Browse the repository at this point in the history
Refs: #369
  • Loading branch information
priscavdsluis authored Apr 14, 2023
1 parent fcad1ed commit cbb80af
Show file tree
Hide file tree
Showing 16 changed files with 1,872 additions and 36 deletions.
7 changes: 7 additions & 0 deletions docs/reference/extold.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# External forcings file
The external forcing .ext file contains the forcing data for a [D-Flow FM](glossary.md#d-flow-fm) model.
This includes open boundaries, lateral discharges and meteorological forcings.
The documentation below only concerns the 'old' format (`ExtForceFile` in the MDU file).

## Model
::: hydrolib.core.dflowfm.extold.models
1 change: 1 addition & 0 deletions hydrolib/core/dflowfm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from .common import *
from .crosssection import *
from .ext import *
from .extold import *
from .friction import *
from .gui import *
from .inifield import *
Expand Down
4 changes: 2 additions & 2 deletions hydrolib/core/dflowfm/common/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from .models import LocationType
from .models import LocationType, Operand

__all__ = ["LocationType"]
__all__ = ["LocationType", "Operand"]
20 changes: 20 additions & 0 deletions hydrolib/core/dflowfm/common/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,23 @@ class LocationType(str, Enum):

all = "all"
"""str: Denotes that both 1D and 2D locations may be selected."""


class Operand(str, Enum):
"""
Enum class containing the valid values for the operand
attribute in several subclasses of AbstractIniField and ExtOldForcing.
"""

override = "O"
"""Existing values are overwritten with the provided values."""
append = "A"
"""Provided values are used where existing values are missing."""
add = "+"
"""Existing values are summed with the provided values."""
mult = "*"
"""Existing values are multiplied with the provided values."""
max = "X"
"""The maximum values of the existing values and provided values are used."""
min = "N"
"""The minimum values of the existing values and provided values are used."""
19 changes: 19 additions & 0 deletions hydrolib/core/dflowfm/extold/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from .models import (
ExtOldExtrapolationMethod,
ExtOldFileType,
ExtOldForcing,
ExtOldMethod,
ExtOldModel,
ExtOldQuantity,
ExtOldTracerQuantity,
)

__all__ = [
"ExtOldExtrapolationMethod",
"ExtOldForcing",
"ExtOldModel",
"ExtOldQuantity",
"ExtOldFileType",
"ExtOldMethod",
"ExtOldTracerQuantity",
]
23 changes: 23 additions & 0 deletions hydrolib/core/dflowfm/extold/common_io.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from typing import List

ORDERED_FORCING_FIELDS: List[str] = [
"QUANTITY",
"FILENAME",
"VARNAME",
"SOURCEMASK",
"FILETYPE",
"METHOD",
"EXTRAPOLATION_METHOD",
"MAXSEARCHRADIUS",
"OPERAND",
"VALUE",
"FACTOR",
"IFRCTYP",
"AVERAGINGTYPE",
"RELATIVESEARCHCELLSIZE",
"EXTRAPOLTOL",
"PERCENTILEMINMAX",
"AREA",
"NUMMIN",
]
"""List[str]: List of the ordered fields names in a forcing block."""
Loading

0 comments on commit cbb80af

Please sign in to comment.