.. _ngw-node-dprepro:

=======
dprepro
=======

-----------
Description
-----------

DPrePro is a Python script distributed with Dakota that allows you to perform pre-processing
by adding template syntax to a text-based file. DPrePro performs many of the same functions
as APREPRO, and is optimized for use with Dakota parameters files.

Generally, DPrepro template syntax is of the form ``{a=1.0}`` where everything between and
including the curly braces represents the templatized value. At runtime, DPrePro replaces these
template expressions with live parameter values.

For further information, :ref:`refer to the main DPrePro page <interfaces:dprepro-and-pyprepro>`.

----------------
Node Usage Notes
----------------

Unlike other pre-processor nodes, users should directly pass file references of
existing Dakota input parameter files to this node through the dakotaParametersFile
input port, rather than using global workflow parameters that are broadly available.
It is still possible to rely on other methods of ingesting pre-processing variables,
but these methods are less efficient for the dprepro node.

----------
Properties
----------

- **templateFile**: The templatized file to be provided to DPrePro.
- **outputFile**: The destination file for DPrePro to send its processed output to.
- **inline**: Use this field to change the "brace" characters used for DPrePro expressions. The text in this
  field should take the form "OPENBRACE CLOSEBRACE", where OPENBRACE is the opening character, and
  CLOSEBRACE is the closing character, separated by a space. For example, you may put "[ ]" in this
  field to use square braces instead of the default curly braces.
- **dpreproPath**: The path to the DPrePro Python script. In most cases, it is not necessary to manually locate
  the script. After you open the Settings Editor for the dprepro node once, Next-Gen Workflow will try to
  automatically locate DPrePro at a handful of default locations.

-----------
Input Ports
-----------

- **templateFile**: The templatized file to be provided to DPrePro.
- **dakotaParametersFile**: A file reference to an already-existing Dakota input parameter file. This file is
  typically generated by Dakota at the moment of starting a new analysis driver iteration.

------------
Output Ports
------------

- **outputFile**: A file reference to your processed input file.
- **exitStatus**: The number value exit code produced by the DPrePro script. An exit code of 0 indicates success.
- **stdout**: dprepro's stdout stream.
- **stderr**: dprepro's stderr stream.
