Skip to content

Commit

Permalink
fix: use abs path to realization as ngen arg
Browse files Browse the repository at this point in the history
  • Loading branch information
aaraney committed Jul 31, 2024
1 parent 2b9bb2a commit 9c53530
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions python/ngen_cal/src/ngen/cal/ngen.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,21 +240,25 @@ def set_defaults(cls, values: Dict):
Returns:
Dict: validated key/value pairs with default values set for known keys
"""
parallel = values.get('parallel')
partitions = values.get('partitions')
binary = values.get('binary')
args = values.get('args')
catchments = values.get('catchments')
nexus = values.get('nexus')
realization = values.get('realization')
hydrofabric = values.get('hydrofabric')
parallel: int | None = values.get('parallel')
partitions: Path | None = values.get('partitions')
assert "binary" in values, f"binary must be present: {values}"
binary: str = values['binary']
args: str | None = values.get('args')
catchments: Path | None = values.get('catchments')
nexus: Path | None = values.get('nexus')
assert "realization" in values, f"realization must be present: {values}"
realization: Path = values['realization']
hydrofabric: Path | None = values.get('hydrofabric')

custom_args = False
if args is None:
if hydrofabric is not None:
args = '{} "all" {} "all" {}'.format(hydrofabric.resolve(), hydrofabric.resolve(), realization.name)
args = '{} "all" {} "all" {}'.format(hydrofabric.resolve(), hydrofabric.resolve(), realization.resolve())
else:
args = '{} "all" {} "all" {}'.format(catchments.resolve(), nexus.resolve(), realization.name)
assert catchments is not None, f"catchments must be present: {values}"
assert nexus is not None, f"nexus must be present: {values}"
args = '{} "all" {} "all" {}'.format(catchments.resolve(), nexus.resolve(), realization.resolve())
values['args'] = args
else:
custom_args = True
Expand Down

0 comments on commit 9c53530

Please sign in to comment.