dwind.cli#

Please see the [CLI documentation](../cli) for more details on using the CLI. Below is a summary of the available functionality best accessed through the CLI.

Modules

debug

Enables running dwind as a CLI tool, the primary interface for working with dwind.

collect

Enables running dwind as a CLI tool, the primary interface for working with dwind.

utils

Provides shared utilities among the CLI subcommand modules.

Run#

Debug#

Enables running dwind as a CLI tool, the primary interface for working with dwind.

Functions

job_summary(jobs[, chunks])

Print a table summary of the provided job id(s) and their final run status.

missing_agents(agents_file, results_file, ...)

Compare the agent "gid" field between the chunked agents and results files, and save the missing chunk index and agent gid as a 2-column CSV file.

missing_agents_from_chunks(dir_out[, chunks])

Compare the agent "gid" field between the chunked agents and results files, and save the missing chunk index and agent gid as a 1-column CSV file.

dwind.cli.debug.job_summary(jobs, chunks=None)[source]#

Print a table summary of the provided job id(s) and their final run status.

dwind.cli.debug.missing_agents(agents_file, results_file, dir_out)[source]#

Compare the agent “gid” field between the chunked agents and results files, and save the missing chunk index and agent gid as a 2-column CSV file.

dwind.cli.debug.missing_agents_from_chunks(dir_out, chunks=None)[source]#

Compare the agent “gid” field between the chunked agents and results files, and save the missing chunk index and agent gid as a 1-column CSV file.

Collect#

Enables running dwind as a CLI tool, the primary interface for working with dwind.

Functions

cleanup_agents(dir_out)

Deletes the temporary agent chunk files generated at runtime.

cleanup_results(dir_out)

Deletes the chunked results files generated at runtime.

combine_chunks(dir_out[, file_name, ...])

Combine the results of a multi-job run based on the run's TOML configuration.

dwind.cli.collect.cleanup_agents(dir_out)[source]#

Deletes the temporary agent chunk files generated at runtime.

Parameters:

dir_out (str) – The base output directory, which should be the same as that passed to the run command.

dwind.cli.collect.cleanup_results(dir_out)[source]#

Deletes the chunked results files generated at runtime.

Parameters:

dir_out (str) – The base output directory, which should be the same as that passed to the run command.

dwind.cli.collect.combine_chunks(dir_out, file_name=None, remove_results_chunks=True)[source]#

Combine the results of a multi-job run based on the run’s TOML configuration. Please note this has the potential to combine multiple runs as it does not respect the jobs ran during a single cycle.

Utilities#

Provides shared utilities among the CLI subcommand modules.

Functions

cleanup_chunks(dir_out, which)

Deletes the temporary agent chunk files, typically in /path/to/analysis_scenario/chunk_files/agents, and of the form agents_{ix}.pqt.

load_agents([file_name, location, sector, ...])

Load the agent file based on a filename or the location and sector to a Pandas DataFrame, and return the data frame.

print_status_table(summary[, id_col, ...])

Prints a nicely formatted pandas DataFrame to the console.

year_callback(ctx, param, value)

Typer helper to validate the year input.

dwind.cli.utils.cleanup_chunks(dir_out, which)[source]#

Deletes the temporary agent chunk files, typically in /path/to/analysis_scenario/chunk_files/agents, and of the form agents_{ix}.pqt.

Parameters:
  • dir_out (str | None) – The same dir_out passed to the run command. The chunk_files/agent_chunks will be automatically added to the path.

  • which (str) – One of “agents” or “results” to indicate which chunked files should be deleted.

Return type:

None

dwind.cli.utils.load_agents(file_name=None, location=None, sector=None, model_config=None, *, prepare=False)[source]#

Load the agent file based on a filename or the location and sector to a Pandas DataFrame, and return the data frame.

Parameters:
  • file_name (Path | None, optional) – Name of the agent file, if not auto-generating from the location and sector inputs. Defaults to None.

  • location (str | None, optional) – The name of the location or grouping, such as “colorado_larimer” or “priority1”. Defaults to None.

  • sector (str | None, optional) – The name of the section. Must be one of “btm” or “fom”. Defaults to None.

  • model_config (str | Path | None) – (str | Path, optional): The file name and path for the overarching model configuration containing SQL and file references, scenario configurations, and etc. Defaults to None.

  • prepare (bool, optional) – True if loading pre-chunked and prepared agent data, which should bypass the standard column checking for additional joins, by default False.

Returns:

The agent DataFrame.

Return type:

pd.DataFrame

dwind.cli.utils.print_status_table(summary, id_col='job', chunk_col=None, status_col='status')[source]#

Prints a nicely formatted pandas DataFrame to the console.

Parameters:
  • summary (pd.DataFrame) – Summary DataFrame of the job (id_col), chunk (chunk_col), and status (status_col).

  • id_col (str) – Name of the job ID column.

  • chunk_col (str) – Name of the chunk index column.

  • status_col (str) – Name of the final job status column.

Return type:

None

dwind.cli.utils.year_callback(ctx, param, value)[source]#

Typer helper to validate the year input.

Parameters:
  • ctx (typer.Context) – The Typer context.

  • param (typer.CallbackParam) – The Typer parameter.

  • value (int) – User input for the analysis year basis, must be one of 2022, 2024, or 2025.

Returns:

The input value, if it is a valid input.

Return type:

int

Raises:

typer.BadParameter – Raised if the input is not one of 2022, 2024, or 2025.