Skip to content

Commit bc0dcea

Browse files
Chris Blantonilaflott
authored andcommitted
Retrieve pp input dir from fre yaml, pass to analysis script engine call
1 parent bb4e3dd commit bc0dcea

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

fre/analysis/plugins/esnb.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def __init__(self):
1414
self.description = "Wrapper to access analysis framework for ESNB scripts"
1515
self.title = "ESNB"
1616

17-
def run_analysis(self, config, name, date_range, scripts_dir, output_dir, output_yaml):
17+
def run_analysis(self, config, name, date_range, scripts_dir, output_dir, output_yaml, pp_dir):
1818
"""Runs the ESNB analysis specified in the yaml and the runtime options
1919
2020
Args:
@@ -24,6 +24,7 @@ def run_analysis(self, config, name, date_range, scripts_dir, output_dir, output
2424
scripts_dir: Path to a directory to save intermediate scripts
2525
output_dir: Path to a directory to save figures
2626
output_yaml: Path to use as an structured output yaml file
27+
pp_dir: Path to input postprocessed files
2728
"""
2829

2930
# save notebook to scripts_dir
@@ -48,9 +49,14 @@ def run_analysis(self, config, name, date_range, scripts_dir, output_dir, output
4849
}
4950

5051
# create case_settings dictionary
52+
split_date = date_range.split(",")
53+
case_settings = {
54+
'PP_DIR': pp_dir,
55+
'date_range': split_date
56+
}
5157

5258
# write the python script that runs the notebook
53-
python_script = esnb.engine.canopy_launcher(run_settings, verbose=True)
59+
python_script = esnb.engine.canopy_launcher(run_settings, case_settings, verbose=True)
5460
fre_logger.debug(f"ESNB python wrapper saved to '{python_script}'")
5561

5662
# run the python script

fre/analysis/plugins/subtools.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def plugin_requirements(name):
127127
return _plugin_object(name).requires()
128128

129129

130-
def run_plugin(script_type, name, config, date_range, scripts_dir, output_dir, output_yaml):
130+
def run_plugin(script_type, name, config, date_range, scripts_dir, output_dir, output_yaml, pp_dir):
131131
"""Runs the plugin's analysis.
132132
133133
Args:
@@ -136,8 +136,9 @@ def run_plugin(script_type, name, config, date_range, scripts_dir, output_dir, o
136136
png_dir: Directory where the output figures will be stored.
137137
config: Dictionary of configuration values.
138138
catalog: Path to the catalog of reference data.
139+
pp_dir: Directory to input pp files
139140
140141
Returns:
141142
A list of png figure files that were created by the analysis.
142143
"""
143-
return _plugin_object(script_type).run_analysis(config, name, date_range, scripts_dir, output_dir, output_yaml)
144+
return _plugin_object(script_type).run_analysis(config, name, date_range, scripts_dir, output_dir, output_yaml, pp_dir)

fre/analysis/subtools.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,10 @@ def run_analysis(yaml, name, date_range, scripts_dir, output_dir, output_yaml):
9494
config_yaml = safe_load(file_)
9595
specific_config = config_yaml["analysis"][name]["specific_config"]
9696
script_type = config_yaml["analysis"][name]["script_type"]
97+
pp_dir = config_yaml["directories"]["pp_dir"]
9798

9899
# Run the analysis.
99-
figure_paths = run_plugin(script_type, name, specific_config, date_range, scripts_dir, output_dir, output_yaml)
100+
figure_paths = run_plugin(script_type, name, specific_config, date_range, scripts_dir, output_dir, output_yaml, pp_dir)
100101

101102

102103
def uninstall_analysis_package(name, library_directory=None):

0 commit comments

Comments
 (0)