pytuflow.TCF.write

Contents

pytuflow.TCF.write#

TCF.write(inc='auto')#

Write the object to file. From the TCF class, other control files will also be written if their dirty attribute is returned as True.

Parameters:

inc (str, optional) –

The increment method to use. The options are:

  • "auto" - (default) automatically increment the file name by adding +1 to the number at the end of the file name. If the file name does not contain a number, it will be added as “001”. The increment number from the calling class will be used when writing children. E.g. if the TCF is automatically incremented to “100”, the TGC increment number will be set to “100” regardless of the current number in the TGC file name.

  • [str] - a user defined suffix to add to the file name. This will replace the existing suffix number if the user provides a string representation of a number, otherwise it will be appended to the end of the file name.

  • "inplace" - overwrites the existing file without changing the file name. If called from the TCF, the children control files and databases can still be incremented up to the TCF increment number.

  • None - if set to None, no incrementing will take place and the file will be written without

    changing the file name, including children control files and databases. This is very similar to the “inplace” option, but will not increment the file name of children control files and databases.

Returns:

The control file that was written.

Return type:

ControlFileBuildState

Examples

1! Control File
2Solution Scheme == HPC
3Hardware == GPU
4SGS == On

The following code updates the hardware command to CPU and then writes the update to disk inplace such that it overwrites the existing control file:

>>> control_file = ... # assume this is the loaded control file object
>>> hardware_inp = control_file.find_input('Hardware')[0]
>>> hardware_inp.rhs = 'CPU'
>>> control_file.write('inplace')