Skip to content

Commit 3bcf078

Browse files
Add MPASSIT runcmd
1 parent cc87238 commit 3bcf078

File tree

2 files changed

+29
-5
lines changed

2 files changed

+29
-5
lines changed

src/uwtools/drivers/mpassit.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,8 @@ def namelist_file(self):
5050
"""
5151
The namelist file.
5252
"""
53-
fn = "fort.41"
54-
yield self.taskname(fn)
55-
path = self.rundir / fn
53+
path = self._input_config_path
54+
yield self.taskname(path.name)
5655
yield asset(path, path.is_file)
5756
base_file = self.config[STR.namelist].get(STR.basefile)
5857
yield file(Path(base_file)) if base_file else None
@@ -91,7 +90,7 @@ def output(self) -> dict[str, Path] | dict[str, list[Path]]:
9190
Returns a description of the file(s) created when this component runs.
9291
"""
9392
with TemporaryDirectory() as path:
94-
nml = Path(path, "fort.41")
93+
nml = Path(path, self._input_config_path.name)
9594
self.create_user_updated_config(
9695
config_class=NMLConfig,
9796
config_values=self.config[STR.namelist],
@@ -100,3 +99,20 @@ def output(self) -> dict[str, Path] | dict[str, list[Path]]:
10099
)
101100
namelist = get_nml_config(nml)
102101
return {"path": self.rundir / namelist["config"]["output_file"]}
102+
103+
# Private helper methods
104+
105+
@property
106+
def _input_config_path(self) -> Path:
107+
"""
108+
Path to the input config file.
109+
"""
110+
return self.rundir / "mpassit.nml"
111+
112+
@property
113+
def _runcmd(self) -> str:
114+
"""
115+
The full command-line component invocation.
116+
"""
117+
executable = self.config[STR.execution][STR.executable]
118+
return "%s %s" % (executable, self._input_config_path.name)

src/uwtools/tests/drivers/test_mpassit.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def test_MPASSIT_files_copied_and_linked(config, cycle, key, leadtime, task, tes
6060

6161

6262
def test_MPASSIT_namelist_file(driverobj, logged, ready_task):
63-
dst = driverobj.rundir / "fort.41"
63+
dst = driverobj._input_config_path
6464
assert not dst.is_file()
6565
with patch.object(mpassit, "file", new=ready_task):
6666
path = Path(driverobj.namelist_file().ref)
@@ -93,3 +93,11 @@ def test_MPASSIT_provisioned_rundir(driverobj, ready_task):
9393
driverobj.provisioned_rundir()
9494
for m in mocks:
9595
mocks[m].assert_called_once_with()
96+
97+
98+
def test_MPASSIT__input_config_path(driverobj, tmp_path):
99+
assert driverobj._input_config_path == tmp_path / "mpassit.nml"
100+
101+
102+
def test_MPASSIT__runcmd(driverobj):
103+
assert driverobj._runcmd == "/path/to/mpassit mpassit.nml"

0 commit comments

Comments
 (0)