Skip to content

Commit

Permalink
merge changes from the base branch
Browse files Browse the repository at this point in the history
  • Loading branch information
MAfarrag committed Dec 12, 2024
2 parents 1d4b3c8 + 037cbc3 commit 4c02cd9
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 34 deletions.
19 changes: 4 additions & 15 deletions hydrolib/tools/ext_old_to_new/main_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,21 +133,11 @@ def _read_old_file(extoldfile: PathOrStr) -> ExtOldModel:
"""Read a legacy D-Flow FM external forcings file (.ext) into an
ExtOldModel object.
- The `read_old_file` method instantiates an ExternalForcingConverter object with an ExtOldModel object and
a default set of new external forcing, initial field and structure models.
- The new models will be created in the same directory as the old external forcing file.
- The new external forcing file will be named new-external-forcing.ext, the new initial conditions file will be
named new-initial-conditions.ext and the new structure file will be named new-structure.ext.
- However the user can change the paths to the new models by using the ``ext_model``, ``inifield_model`` and
``structure_model`` setters. The new models will be created in the specified paths.
- the user can also set the paths to the new models using the `converter.ext_model.filepath= "mypath.ext"`.
Args:
extoldfile (PathOrStr): path to the external forcings file (.ext)
Returns:
ExternalForcingConverter: object with the old external forcing model and new external forcing, initial field
"""
ExtOldModel: object with all forcing blocks."""
global _verbose
if not isinstance(extoldfile, Path):
extoldfile = Path(extoldfile)
Expand Down Expand Up @@ -299,10 +289,9 @@ def ext_old_to_new_from_mdu(
else workdir / structurefile
)

converter = ExternalForcingConverter.read_old_file(extoldfile)
converter.ext_model = extfile
converter.inifield_model = inifieldfile
converter.structure_model = structurefile
converter = ExternalForcingConverter(
extoldfile, extfile, inifieldfile, structurefile
)

# The actual conversion:
ext_model, inifield_model, structure_model = converter.update(postfix)
Expand Down
54 changes: 35 additions & 19 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,32 +27,48 @@ strenum = "^0"

[tool.poetry.dev-dependencies]
pytest = "^8.0"
pytest-cov = "^5.0"
black = "^24.3"
isort = "^5.8"
devtools = "^0.6.1"
mkdocs = "^1.2"
mkdocs-material = "^8.0"
mkdocstrings = "^0.16"
mkdocs-autorefs = "^0.3, !=0.3.1"
mkdocs-macros-plugin = "^0.6.3"
mkdocs-table-reader-plugin = "^0.6.1"
mkdocs-jupyter = "^0.21.0"
pymdown-extensions = "^9.1"
commitizen = "^2.17"
flake8 = "^3.9.2"
mypy = "^0.910"
pytest-cov = "^6.0"
devtools = "^0.12.2"
commitizen = "^4.0"
mypy = "^1.13"
openpyxl = "^3.0.9"
mike = "^1.1.2"
mike = "^2.1.3"
jinja2 = "^3.0"
markupsafe = "<2.1"
markupsafe = "<3.0.2"
jupyter = "^1.0.0"
ipykernel = "^6.15.0"
# matplotlib >=3.8 supports numpy 2.0
matplotlib = "^3.8"
# xarray >=2024.6.0 supports numpy 2.0, but consider looser version if adding it as actual package dependencies
xarray = ">=2024.6.0"
flake8-pyproject = "*"

[tool.poetry.group.docs.dependencies]
mkdocs = "^1.2"
mkdocs-material = "^9.5"
mkdocstrings = "^0.27.0"
pymdown-extensions = "^10.12"
mkdocs-autorefs = "^1.2"
mkdocs-macros-plugin = "^1.3.7"
mkdocs-table-reader-plugin = "^3.1.0"
mkdocs-jupyter = "^0.25.1"

[tool.poetry.group.pre-commit.dependencies]
coverage = {extras = ["toml"], version = "^7.6.1"}
safety = "^3.2.9"
pre-commit = "^4.0.1"
black = "^24.8.0"
flake8 = "^7.1.1"
flake8-bandit = "^4.1.1"
flake8-bugbear = "^24.10.31"
flake8-docstrings = "^1.6.0"
flake8-rst-docstrings = "^0.3.0"
flake8-pyproject = "^1.2.3"
isort = "^5.8"
pep8-naming = "*"
darglint = "^1.8.1"
reorder-python-imports = "^3.8.2"
pre-commit-hooks = "^5.0.0"
pre-commit-commit-msg-hooks = "^0.1.0"

[tool.commitizen]
name = "cz_conventional_commits"
Expand Down Expand Up @@ -89,7 +105,7 @@ exclude = '''
'''

[tool.flake8]
ignore = ["E501", "W503"]
ignore = ["E501", "W503", "E731"]
per-file-ignores = [
'__init__.py:F401',
]
Expand Down

0 comments on commit 4c02cd9

Please sign in to comment.