uwtools.api.make_hgrid

API access to the uwtools make_hgrid driver.

class uwtools.api.make_hgrid.MakeHgrid(config=None, dry_run=False, key_path=None, batch=False, schema_file=None, controller=None)

A driver for make_hgrid.

Parameters:
  • config (dict | str | YAMLConfig | Path | None) – Path to config file (read stdin if missing or None).

  • dry_run (bool) – Run in dry-run mode?

  • key_path (list[str] | None) – Keys leading through the config to the driver’s configuration block.

  • batch (bool) – Run component via the batch system?

  • schema_file (Path | None) – Path to schema file to use to validate an external driver.

  • controller (str | None) – Name of block in config controlling run-time values.

property config: dict

A copy of the driver-specific config.

property config_full: dict

A copy of the original input config, dereferenced.

property driver_name: str

Returns the name of this driver.

provisioned_rundir()

Run directory provisioned with all required content.

run()

A run.

property rundir: Path

The path to the component’s run directory.

runscript()

The runscript.

taskname(suffix)

Returns a common tag for graph-task log messages.

Parameters:

suffix (str) – Log-string suffix.

Return type:

str

validate()

Validate the UW driver config.

uwtools.api.make_hgrid.execute(task, config=None, batch=False, dry_run=False, graph_file=None, key_path=None, stdin_ok=False)

Execute a task.

If batch is specified, a runscript will be written and submitted to the batch system. Otherwise, the executable will be run directly on the current system.

Parameters:
  • task (str) – The task to execute.

  • config (str | Path | None) – Path to config file (read stdin if missing or None).

  • batch (bool) – Submit run to the batch system?

  • dry_run (bool) – Do not run the executable, just report what would have been done.

  • graph_file (str | Path | None) – Write Graphviz DOT output here.

  • key_path (list[str] | None) – Path of keys to subsection of config file.

  • stdin_ok (bool) – OK to read from stdin?

Returns:

True if task completes without raising an exception.

Return type:

bool

uwtools.api.make_hgrid.graph()

Returns Graphviz DOT code for the most recently executed task.

Return type:

str

uwtools.api.make_hgrid.tasks()

Returns a mapping from task names to their one-line descriptions.

Parameters:

driver_class – Class of driver object to instantiate.

Return type:

dict[str, str]