diff --git a/src/uwtools/drivers/mpas.py b/src/uwtools/drivers/mpas.py index 0fb9988cb..b752f7841 100644 --- a/src/uwtools/drivers/mpas.py +++ b/src/uwtools/drivers/mpas.py @@ -48,7 +48,7 @@ def namelist_file(self): yield asset(path, path.is_file) yield None duration = timedelta(hours=self._driver_config["length"]) - str_duration = str(duration).replace(" days, ", "") + str_duration = str(duration).replace(" days, ", "_") try: namelist = self._driver_config["namelist"] except KeyError as e: diff --git a/src/uwtools/tests/drivers/test_mpas.py b/src/uwtools/tests/drivers/test_mpas.py index 257a352ba..2bafee2fc 100644 --- a/src/uwtools/tests/drivers/test_mpas.py +++ b/src/uwtools/tests/drivers/test_mpas.py @@ -135,7 +135,22 @@ def test_MPAS_namelist_file(caplog, driverobj): path = Path(refs(driverobj.namelist_file())) assert dst.is_file() assert logged(caplog, f"Wrote config to {path}") - assert isinstance(f90nml.read(dst), f90nml.Namelist) + nml = f90nml.read(dst) + assert isinstance(nml, f90nml.Namelist) + + +def test_MPAS_namelist_file_long_duration(caplog, config, cycle): + log.setLevel(logging.DEBUG) + config["mpas"]["length"] = 120 + driverobj = MPAS(config=config, cycle=cycle) + dst = driverobj._rundir / "namelist.atmosphere" + assert not dst.is_file() + path = Path(refs(driverobj.namelist_file())) + assert dst.is_file() + assert logged(caplog, f"Wrote config to {path}") + nml = f90nml.read(dst) + assert isinstance(nml, f90nml.Namelist) + assert nml["nhyd_model"]["config_run_duration"] == "5_0:00:00" def test_MPAS_namelist_file_fails_validation(caplog, driverobj):