Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an output method for the chgres_cube driver #674

Merged
merged 4 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/uwtools/drivers/chgres_cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,5 +110,14 @@ def driver_name(cls) -> str:
"""
return STR.chgrescube

@property
def output(self) -> dict[str, list[str]]:
"""
Returns a description of the file(s) created when this component runs.
"""
output_types = ["atm", "sfc"]
paths = [f"{self.rundir}/out.{t}.tile7.nc" for t in output_types]
return {"NetCDFfiles": paths}
Byrnetp marked this conversation as resolved.
Show resolved Hide resolved


set_driver_docstring(ChgresCube)
10 changes: 4 additions & 6 deletions src/uwtools/tests/drivers/test_chgres_cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@

import f90nml # type: ignore
from iotaa import refs
from pytest import fixture, mark, raises
from pytest import fixture, mark

from uwtools.drivers.chgres_cube import ChgresCube
from uwtools.drivers.driver import Driver
from uwtools.exceptions import UWNotImplementedError
from uwtools.logging import log
from uwtools.scheduler import Slurm
from uwtools.tests.support import logged, regex_logged
Expand Down Expand Up @@ -107,7 +106,6 @@ def leadtime():
"_scheduler",
"_validate",
"_write_runscript",
"output",
"run",
],
)
Expand Down Expand Up @@ -150,9 +148,9 @@ def test_ChgresCube_namelist_file_missing_base_file(caplog, driverobj):


def test_ChgresCube_output(driverobj):
with raises(UWNotImplementedError) as e:
assert driverobj.output
assert str(e.value) == "The output() method is not yet implemented for this driver"
files = ["out.atm.tile7.nc", "out.sfc.tile7.nc"]
expected = {"NetCDFfiles": [str(driverobj.rundir / file) for file in files]}
assert driverobj.output == expected


def test_ChgresCube_provisioned_rundir(driverobj):
Expand Down
Loading