The command line interface

PyTornado provides a command line tool which can be used to start a VLM analysis. The executable is called pytornado. If you simply run pytornado in a terminal without any arguments, a simple help page will be printed.

usage: pytornado 0.5.4 [-h]
                       [-r <Settings file> | --cpacs2json <CPACS file> | --make-example | --list-example-from-db | --make-example-from-db <Aircraft name>]
                       [-v | -d | -q] [-c | --clean-only]

optional arguments:
  -h, --help            show this help message and exit
  -r <Settings file>, --run <Settings file>
                        Settings file (entry point for pytornado)
  --cpacs2json <CPACS file>
                        Convert a CPACS file to native JSON format
  --make-example        Generate a minimal working example
  --list-example-from-db, --ldb
                        List example aircraft in the database
  --make-example-from-db <Aircraft name>, --mdb <Aircraft name>
                        Pick an aircraft from the database and generate a
                        project directory
  -v, --verbose
  -d, --debug
  -q, --quiet
  -c, --clean           remove old project files
  --clean-only          clean and exit

Pointing to a settings file (–run)

Perhaps the most important argument is --run (or short -r). This argument must be followed by a file path to the PyTornado settings file. Notice that you used this argument in the first tutorial (Getting started) where the settings file was located at settings/template.json.

pytornado --run settings/template.json

Hint

You can provide the settings file path as any relative or absolute file path. PyTornado will automatically detect the project directory. Of course, the other project subdirectories including the aircraft and state files must exist in a structure described in Project directory.

Logging

Logging information can be printed to the terminal screen and written to a log file. Arguments determine the amount of printed information. The argument -debug or --d will print the most amount of information, -verbose or --v will ignore less relevant information and -quiet or --q will only print errors. By default, PyTornado is quiet.

Note

Error messages will always be printed (even in quiet mode).

Cleaning up previous result files

Sometimes, it can be useful to remove result files from previous analyses. Instead of removing files by hand, pytornado provides arguments to clean up from previous analyses. If you pass the flag --clean or -c result files from all previous analyses will be removed before a new VLM analysis is started. Note that only files in the directories _results and _plots are affected.

If you do not want to start a new analysis you can use --clean-only which will remove old result files but not invoke a new VLM analysis.

Hint

Note that you can combine several arguments like this:

pytornado -cvr settings/template.json

PyTornado will first clean up the _results and _plots directories (if there are files from previous analyses) and then a VLM will be started in verbose mode.

Creating a template project

If you start with a new project, PyTornado allows you to easily generate a clean project directory including minimalistic working example (see also Getting started).

pytornado --make-example

Converting CPACS to JSON

PyTornado’s native JSON format has a simpler and flatter structure than CPACS. Sometimes, it may be more convenient to edit the aircraft definition using the JSON format rather than CPACS. A CPACS file can easily be converted to JSON. Change into a project directory (see Project directory) with a CPACS file in the aircraft subdirectory. Now you may run:

pytornado --cpacs2json aircraft/CPACS_file.xml

The CPACS file aircraft/CPACS_file.xml will be loaded and a new file aircraft/CPACS_file.json will be created. Notice that the file extension of the new file is .json.

Warning

An existing file aircraft/CPACS_file.json will be overwritten.

To use the new JSON file instead of CPACS you will have to edit your main settings file (Settings file).

General notes

Note

Besides the command line interface PyTornado also provides a Python API through which analyses can be setup.