From 23bda51df6c00f8e141b82c1df7312132d4b8ca7 Mon Sep 17 00:00:00 2001 From: George McCabe <23407799+georgemccabe@users.noreply.github.com> Date: Tue, 26 Jul 2022 11:45:14 -0600 Subject: [PATCH] bugfix #1706 fix PhaseDiagram use case to avoid writing into INPUT_BASE (#1708) --- .../s2s_mjo/UserScript_obsERA_obsOnly_PhaseDiagram.conf | 4 ++-- .../save_input_files_txt.py | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/parm/use_cases/model_applications/s2s_mjo/UserScript_obsERA_obsOnly_PhaseDiagram.conf b/parm/use_cases/model_applications/s2s_mjo/UserScript_obsERA_obsOnly_PhaseDiagram.conf index bb8168e9b4..e4617cf895 100644 --- a/parm/use_cases/model_applications/s2s_mjo/UserScript_obsERA_obsOnly_PhaseDiagram.conf +++ b/parm/use_cases/model_applications/s2s_mjo/UserScript_obsERA_obsOnly_PhaseDiagram.conf @@ -50,7 +50,7 @@ FCST_RUN = False # Input and Output Directories for the OBS OLR Files and output text file containing the file list OBS_PDTIME_FMT = %Y%m%d-%H%M%S OBS_PDTIME_INPUT_TEMPLATE = {valid?fmt=%Y%m%d-%H%M%S} -OBS_PDTIME_OUTPUT_DIR = {INPUT_BASE}/model_applications/s2s_mjo/UserScript_obsERA_obsOnly_PhaseDiagram/ +OBS_PDTIME_OUTPUT_DIR = {OUTPUT_BASE}/model_applications/s2s_mjo/UserScript_obsERA_obsOnly_PhaseDiagram/ OBS_PDTIME_OUTPUT_TEMPLATE = time_list_lead{lead?fmt=%HHH}.txt @@ -75,7 +75,7 @@ SCRIPT_OUTPUT_BASE = {OUTPUT_BASE} PLOT_INDEX = RMM # Input Directories -OBS_PHASE_DIAGRAM_INPUT_DIR = {OBS_PDTIME_OUTPUT_DIR} +OBS_PHASE_DIAGRAM_INPUT_DIR = {INPUT_BASE}/model_applications/s2s_mjo/UserScript_obsERA_obsOnly_PhaseDiagram # Input filename template OBS_PHASE_DIAGRAM_INPUT_FILE = rmm.1x.txt diff --git a/parm/use_cases/model_applications/s2s_mjo/UserScript_obsERA_obsOnly_PhaseDiagram/save_input_files_txt.py b/parm/use_cases/model_applications/s2s_mjo/UserScript_obsERA_obsOnly_PhaseDiagram/save_input_files_txt.py index 69a7e65d09..b8954f9569 100755 --- a/parm/use_cases/model_applications/s2s_mjo/UserScript_obsERA_obsOnly_PhaseDiagram/save_input_files_txt.py +++ b/parm/use_cases/model_applications/s2s_mjo/UserScript_obsERA_obsOnly_PhaseDiagram/save_input_files_txt.py @@ -6,6 +6,11 @@ input_file = sys.argv[1] output_file = sys.argv[2] +output_dir = os.path.dirname(output_file) +if not os.path.exists(output_dir): + print(f'Creating output dir: {output_dir}') + os.makedirs(output_dir) + filelist = open(output_file,'a+') filelist.write(input_file + '\n') filelist.close()