natcap.invest.cli

Single entry point for all InVEST applications.

class natcap.invest.cli.SelectModelAction(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)

Bases: argparse.Action

Given a possibly-ambiguous model string, identify the model to run.

This is a subclass of argparse.Action and is executed when the argparse interface detects that the user has attempted to select a model by name.

natcap.invest.cli.build_model_list_json()

Build a json object of relevant information for the CLI.

The json object returned uses the human-readable model names for keys and the values are another dict containing the internal python name of the model and the aliases recognized by the CLI.

Returns

A string representation of the JSON object.

natcap.invest.cli.build_model_list_table()

Build a table of model names, aliases and other details.

This table is a table only in the sense that its contents are aligned into columns, but are not separated by a delimited. This table is intended to be printed to stdout.

Returns

A string representation of the formatted table.

natcap.invest.cli.export_to_python(target_filepath, model, args_dict=None)
natcap.invest.cli.main(user_args=None)

CLI entry point for launching InVEST runs.

This command-line interface supports two methods of launching InVEST models from the command-line:

  • through its GUI

  • in headless mode, without its GUI.

Running in headless mode allows us to bypass all GUI functionality, so models may be run in this way without having GUI packages installed.