# Reporting¶

Model.report(style, *args, filename=None, tempfile=False, **kwargs)

Generate a model report.

Larch is capable of generating reports in five basic formats: text, xhtml, docx, and latex. This function serves as a pass-through, to call the report generator of the given style, and optionally to save the results to a file.

Parameters: Other Parameters: style (['txt', 'docx', 'latex', 'html', 'xml']) – The style of output. Both ‘html’ and ‘xml’ will call the xhtml generator, with the only difference being the output type, with html generating a finished [x]html document and xml generating an etree for further processing by Python directly. filename (str or None) – If given, then a new stack file is created by util.filemanager.open_stack(), the output is generated in this file, and the file-like object is returned. tempfile (bool) – If True then a new util.TemporaryFile is created, the output is generated in this file, and the file-like object is returned. throw_exceptions (bool) – If True, exceptions are thrown if raised while generating the report. If False (the default) tracebacks are printed directly into the report for each section where an exception is raised. Setting this to True can be useful for testing. LarchError – If both filename and tempfile evaluate as True.
class larch.report.Category(name, *members)

Defines categories of parameters to be used in report generation.

Parameters: name (str) – A descriptive category name that will be used to label the category in a report. members (tuple) – The various members of this category, which can be parameter names (as str), or other [sub-]Category objects.
class larch.report.Rename(name, *members)

Defines an alternate display name for parameters to be used in report generation.

Often the names of parameters actually used in the estimation process are abbreviated or arcane, especially if some aspect of the source data or legacy models are older and not compatible with longer and more descriptive names. But modern report generation can be enhanced by using those longer and more descriptive names. This function allows a descriptive name to be attached to one or more parameters; attaching the same name to different parameters allows those parameters to be linked together and appear on the same line of multi-model reports.

Parameters: name (str) – A descriptive name that will be used to label the parameter in a report. members (tuple) – The various members of this category, which should be parameter names.

Reporting Styles