File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ import re
2+ import os
3+ from pathlib import Path
4+ import yaml
5+
6+ # set up logging
7+ import logging
8+ logging .basicConfig (level = logging .INFO )
9+ fre_logger = logging .getLogger (__name__ )
10+
11+ def get_components (yamlfile ):
12+ """Retrieve active pp components from the yaml
13+
14+ Arguments:
15+ yamlfile (str): Filepath to the yaml
16+ """
17+ fre_logger .debug (f"Yaml file: { yamlfile } " )
18+ components = []
19+
20+ with open (yamlfile ) as file_ :
21+ yaml_ = yaml .safe_load (file_ )
22+
23+ for component in yaml_ ["postprocess" ]["components" ]:
24+ if component ['switch' ] is True :
25+ components .append (component ["type" ])
26+
27+ # we want to return a list, but some other scripts are expecting a space-separated string
28+ #return(components)
29+ return (" " .join (components ))
Original file line number Diff line number Diff line change 4646{# The combined yaml is the definitive configuration source #}
4747{% set YAML = EXPERIMENT + '.yaml' %}
4848
49+ {# Retrieve active pp components from the yaml #}
50+ {% set PP_COMPONENTS = YAML | get_components %}
51+
4952[meta ]
5053 title = " Postprocessing Example 1"
5154 description = """
You can’t perform that action at this time.
0 commit comments