Skip to content

Latest commit

 

History

History
64 lines (50 loc) · 2.97 KB

add_variable_documentation.rst

File metadata and controls

64 lines (50 loc) · 2.97 KB

How to document your variables

FAST-OAD can associate a description to each variable. Such description will be put as comment in datafiles, or displayed along with other variable information, like in command line (see :ref:`get-variable-list`).

The description of a variable can be defined in two ways:

OpenMDAO natively allows to define the description of a variable when declaring it.

FAST-OAD will retrieve this information (the description has to be defined once, even if the variable is declared at several locations).

If you want to add description to your variables in a more centralized way, FAST-OAD will look for files named variable_descriptions.txt that are dedicated to that.

The file content is expected to process one variable per line, containing the variable name and its description, separated by ||, as in following example:

my:variable||The description of my:variable, as long as needed, but on one line.
# Comments are allowed
my:other:variable || Another description (surrounding spaces are ignored)

FAST-OAD will search such files:

In practice, here you can see what description files will be consider, depending on their location:

my_modules/
├── __init__.py
├── subpackage1
│   ├── __init__.py
│   ├── model.py                      <- contains a class decorated with
│   │                                    RegisterOpenMDAOSystem
│   └── variable_descriptions.txt     <- this file will be loaded
├── subpackage2
│   ├── __init__.py
│   ├── propulsion_model.py           <- contains a class decorated with
│   │                                    RegisterOpenPropulsion
│   └── variable_descriptions.txt     <- this file will be loaded
├── util
│   ├── __init__.py
│   ├── utility_module.py             <- no registering done here
│   └── variable_descriptions.txt     <- this file will NOT be loaded
└── variable_descriptions.txt     <- this file will be loaded because it is in root folder/package