fastoad.io.xml.variable_io_base module

Defines how OpenMDAO variables are serialized to XML using a conversion table

class fastoad.io.xml.variable_io_base.VariableXmlBaseFormatter(translator: VarXpathTranslator)[source]

Bases: IVariableIOFormatter

Customizable formatter for variables

User must provide at instantiation a VarXpathTranslator instance that tells how variable names should be converted from/to XPath.

Note: XPath are always considered relatively to the root. Therefore, “foo/bar” should be provided to match following XML structure:

<root>
    <foo>
        <bar>
            "some value"
        </bar>
    </foo>
</root>
Parameters

translator – the VarXpathTranslator instance

xml_unit_attribute

The XML attribute key for specifying units

xml_io_attribute

The XML attribute key for specifying I/O status

read_variables(data_source: Union[str, IO]) VariableList[source]

Reads variables from provided data source file.

Parameters

data_source

Returns

a list of Variable instance

write_variables(data_source: Union[str, IO], variables: VariableList)[source]

Writes variables to defined data source file.

Parameters
  • data_source

  • variables