From 9c53530fe597b839ebaa0ce36f398b259f716c1f Mon Sep 17 00:00:00 2001 From: Austin Raney Date: Wed, 31 Jul 2024 16:17:19 -0400 Subject: [PATCH] fix: use abs path to realization as ngen arg --- python/ngen_cal/src/ngen/cal/ngen.py | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/python/ngen_cal/src/ngen/cal/ngen.py b/python/ngen_cal/src/ngen/cal/ngen.py index 43cf55f9..c77afa95 100644 --- a/python/ngen_cal/src/ngen/cal/ngen.py +++ b/python/ngen_cal/src/ngen/cal/ngen.py @@ -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