uwtools.api.schism

API access to the uwtools schism driver.

class uwtools.api.schism.SCHISM(cycle, config=None, dry_run=False, key_path=None, schema_file=None, controller=None)

An assets driver for SCHISM.

Parameters:
  • cycle (datetime) – The cycle.

  • 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.

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

  • controller (list[str] | None) – Key(s) leading to 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 cycle

The cycle.

classmethod driver_name()

The name of this driver.

Return type:

str

namelist_file()

Render the namelist from the template file.

namelist_schema(config_keys=None, schema_keys=None)

Return the (sub)schema for validating the driver’s namelist content.

Parameters:
  • config_keys (list[str] | None) – Keys leading to the namelist block in the driver config.

  • schema_keys (list[str] | None) – Keys leading to the namelist-validating (sub)schema.

Return type:

dict

provisioned_rundir()

Run directory provisioned with all required content.

property rundir: Path

The path to the component’s run directory.

classmethod schema()

Return the driver’s internal schema.

Return type:

dict

taskname(suffix)

Return a common tag for task-related log messages.

Parameters:

suffix (str) – Log-string suffix.

Return type:

str

validate()

Validate the UW driver config.

uwtools.api.schism.execute(task, cycle, config=None, batch=False, dry_run=False, graph_file=None, key_path=None, schema_file=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).

  • cycle (datetime) – The cycle.

  • 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.

  • schema_file (str | Path | None) – The JSON Schema file to use for validation.

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

Returns:

True if task completes without raising an exception.

Return type:

bool

uwtools.api.schism.graph()

Return Graphviz DOT code for the most recently executed task.

Return type:

str

uwtools.api.schism.schema()

Return the driver’s schema.

Return type:

dict

uwtools.api.schism.tasks()

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

Return type:

dict[str, str]