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 a leadtime argument to the chgres_cube driver. #641

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
12 changes: 7 additions & 5 deletions docs/sections/user_guide/cli/drivers/chgres_cube/run-help.out
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
usage: uw chgres_cube run --cycle CYCLE [-h] [--version] [--config-file PATH]
[--batch] [--dry-run] [--graph-file PATH]
[--key-path KEY[.KEY...]] [--schema-file PATH]
[--quiet] [--verbose]
usage: uw chgres_cube run --cycle CYCLE --leadtime LEADTIME [-h] [--version]
[--config-file PATH] [--batch] [--dry-run]
[--graph-file PATH] [--key-path KEY[.KEY...]]
[--schema-file PATH] [--quiet] [--verbose]

A run

Required arguments:
--cycle CYCLE
The cycle in ISO8601 format (e.g. 2024-05-23T18)
The cycle in ISO8601 format (e.g. 2024-10-31T18)
--leadtime LEADTIME
The leadtime as hours[:minutes[:seconds]]

Optional arguments:
-h, --help
Expand Down
2 changes: 1 addition & 1 deletion src/uwtools/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1206,7 +1206,6 @@ def _parse_args(raw_args: list[str]) -> tuple[Args, Checks]:
_add_subparser_for_driver, component, subparsers, with_batch=True, with_cycle=True
)
for component in [
STR.chgrescube,
STR.fv3,
STR.ioda,
STR.jedi,
Expand All @@ -1225,6 +1224,7 @@ def _parse_args(raw_args: list[str]) -> tuple[Args, Checks]:
with_leadtime=True,
)
for component in [
STR.chgrescube,
STR.upp,
]
}
Expand Down
4 changes: 2 additions & 2 deletions src/uwtools/drivers/chgres_cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
from iotaa import asset, task, tasks

from uwtools.config.formats.nml import NMLConfig
from uwtools.drivers.driver import DriverCycleBased
from uwtools.drivers.driver import DriverCycleLeadtimeBased
from uwtools.drivers.support import set_driver_docstring
from uwtools.strings import STR
from uwtools.utils.tasks import file


class ChgresCube(DriverCycleBased):
class ChgresCube(DriverCycleLeadtimeBased):
"""
A driver for chgres_cube.
"""
Expand Down
11 changes: 8 additions & 3 deletions src/uwtools/tests/drivers/test_chgres_cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,13 @@ def config(tmp_path):


@fixture
def driverobj(config, cycle):
return ChgresCube(config=config, cycle=cycle, batch=True)
def driverobj(config, cycle, leadtime):
return ChgresCube(config=config, cycle=cycle, leadtime=leadtime, batch=True)


@fixture
def leadtime():
return dt.timedelta(hours=24)


# Tests
Expand Down Expand Up @@ -165,4 +170,4 @@ def test_ChgresCube_runscript(driverobj):


def test_ChgresCube_taskname(driverobj):
assert driverobj.taskname("foo") == "20240201 18Z chgres_cube foo"
assert driverobj.taskname("foo") == "20240202 18:00:00 chgres_cube foo"
christinaholtNOAA marked this conversation as resolved.
Show resolved Hide resolved
Loading