src.output_manager module

class src.output_manager.AbstractOutputManager(case)[source]

Bases: abc.ABC

Interface for any OutputManager.

_abc_impl = <_abc_data object>
src.output_manager.html_templating_dict(pod)[source]

Get the dict of recognized substitutions to perform in HTML templates.

class src.output_manager.HTMLSourceFileMixin[source]

Bases: object

Convienience method to define location of HTML templates in one place.

property CASE_TEMP_HTML

Temporary top-level html file for case that gets appended to as PODs finish.

html_src_file(file_name)[source]

Get full path to a framework-supplied HTML template or other part of the output page.

static pod_html_template_file_name(pod)[source]

Name of the POD’s HTML template file.

POD_HTML(pod)[source]

Path to POD’s HTML output file in the working directory.

write_data_log_file()[source]

Writes *.data.log file to output containing info on data files used.

class src.output_manager.HTMLPodOutputManager(pod, output_mgr)[source]

Bases: src.output_manager.HTMLSourceFileMixin

make_pod_html()[source]

Perform templating on POD’s html results page(s).

A wrapper for append_html_template(). Looks for all html files in POD_CODE_DIR, templates them, and copies them to POD_WK_DIR, respecting subdirectory structure (see doc for recursive_copy()).

convert_pod_figures(src_subdir, dest_subdir)[source]

Convert all vector graphics in POD_WK_DIR/subdir to .png files using ghostscript.

All vector graphics files (identified by extension) in any subdirectory of POD_WK_DIR/src_subdir are converted to .png files by running ghostscript in a subprocess. Ghostscript is included in the _MDTF_base conda environment. Afterwards, any bitmap files (identified by extension) in any subdirectory of POD_WK_DIR/src_subdir are moved to POD_WK_DIR/dest_subdir, preserving and subdirectories (see doc for recursive_copy().)

Parameters
  • src_subdir – Subdirectory tree of POD_WK_DIR to search for vector graphics files.

  • dest_subdir – Subdirectory tree of POD_WK_DIR to move converted bitmap files to.

cleanup_pod_files()[source]

Copy and remove remaining files to POD_WK_DIR.

In order, this 1) copies any bitmap figures in any subdirectory of POD_OBS_DATA to POD_WK_DIR/obs (needed for legacy PODs without digested observational data), 2) removes vector graphics if requested, 3) removes netCDF scratch files in POD_WK_DIR if requested.

Settings are set at runtime, when ConfigManager is initialized.

make_output()[source]

Top-level method to make POD-specific output, post-init. Split off into its own method to make subclassing easier.

In order, this 1) creates the POD’s HTML output page from its included template, replacing CASENAME and other template variables with their current values, and adds a link to the POD’s page from the top-level HTML report; 2) converts the POD’s output plots (in PS or EPS vector format) to a bitmap format for webpage display; 3) Copies all requested files to the output directory and deletes temporary files.

class src.output_manager.HTMLOutputManager(case)[source]

Bases: src.output_manager.AbstractOutputManager, src.output_manager.HTMLSourceFileMixin

OutputManager that collects all the PODs’ output as HTML pages.

_PodOutputManagerClass

alias of HTMLPodOutputManager

_html_file_name = 'index.html'
property _tarball_file_path

Update the top level index.html page with a link to this POD’s results.

This simply appends one of two html fragments to index.html: pod_result_snippet.html if the POD completed successfully, or pod_error_snippet.html if an exception was raised during the POD’s setup or execution.

Check for missing files linked to from POD’s html page.

See documentation for LinkVerifier. This method calls LinkVerifier to check existence of all files linked to from the POD’s own top-level html page (after templating). If any files are missing, an error message listing them is written to the run’s index.html (located in src/html/pod_missing_snippet.html).

make_html(cleanup=True)[source]

Add header and footer to CASE_TEMP_HTML.

backup_config_files()[source]

Record settings in file config_save.json for rerunning.

make_tar_file()[source]

Make tar file of web/bitmap output.

copy_to_output()[source]

Copy all files to the specified output directory.

make_output()[source]

Top-level method for doing all output activity post-init. Spun into a separate method to make subclassing easier.

_abc_impl = <_abc_data object>