From ce84290df1653d4a3c801b855e80fbda2c7281f7 Mon Sep 17 00:00:00 2001 From: Jesse Nusbaumer Date: Tue, 16 Jul 2024 15:12:46 -0600 Subject: [PATCH 1/4] Add new optional 'ts_output_dir' config variable to allow for user to control time series generator output location." --- cupid/run.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/cupid/run.py b/cupid/run.py index d934cc7..f70ee8b 100755 --- a/cupid/run.py +++ b/cupid/run.py @@ -110,6 +110,18 @@ def run( for component, comp_bool in component_options.items(): if comp_bool: + + # set time series output directory: + #----- + ts_output_dir = [os.path.join(global_params["CESM_output_dir"], + timeseries_params["case_name"], + f"/{component}/proc/tseries/")] + + if "ts_output_dir" in timeseries_params: + ts_output_dir = [os.path.join(timeseries_params["ts_output_dir"], + f"{component}/proc/tseries/")] + #----- + # fmt: off # pylint: disable=line-too-long cupid.timeseries.create_time_series( @@ -119,7 +131,7 @@ def run( [timeseries_params["case_name"]], timeseries_params[component]["hist_str"], [global_params["CESM_output_dir"]+"/"+timeseries_params["case_name"]+f"/{component}/hist/"], - [global_params["CESM_output_dir"]+"/"+timeseries_params["case_name"]+f"/{component}/proc/tseries/"], + ts_output_dir, # Note that timeseries output will eventually go in # /glade/derecho/scratch/${USER}/archive/${CASE}/${component}/proc/tseries/ timeseries_params["ts_done"], From 595e4d62487775f6a90b7344546deaecd45f961d Mon Sep 17 00:00:00 2001 From: Jesse Nusbaumer Date: Tue, 16 Jul 2024 15:51:53 -0600 Subject: [PATCH 2/4] Apply changes found by pre-commit. --- cupid/run.py | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/cupid/run.py b/cupid/run.py index f70ee8b..e0c5d00 100755 --- a/cupid/run.py +++ b/cupid/run.py @@ -112,15 +112,23 @@ def run( if comp_bool: # set time series output directory: - #----- - ts_output_dir = [os.path.join(global_params["CESM_output_dir"], - timeseries_params["case_name"], - f"/{component}/proc/tseries/")] + # ----- + ts_output_dir = [ + os.path.join( + global_params["CESM_output_dir"], + timeseries_params["case_name"], + f"/{component}/proc/tseries/", + ), + ] if "ts_output_dir" in timeseries_params: - ts_output_dir = [os.path.join(timeseries_params["ts_output_dir"], - f"{component}/proc/tseries/")] - #----- + ts_output_dir = [ + os.path.join( + timeseries_params["ts_output_dir"], + f"{component}/proc/tseries/", + ), + ] + # ----- # fmt: off # pylint: disable=line-too-long From 42bd1db6b4ee54f1915665a3f9500ed0e062f6e4 Mon Sep 17 00:00:00 2001 From: Jesse Nusbaumer Date: Tue, 16 Jul 2024 16:16:17 -0600 Subject: [PATCH 3/4] Apply os.path.join method to remaining directories in time series generator. --- cupid/run.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cupid/run.py b/cupid/run.py index e0c5d00..fda75b1 100755 --- a/cupid/run.py +++ b/cupid/run.py @@ -117,7 +117,7 @@ def run( os.path.join( global_params["CESM_output_dir"], timeseries_params["case_name"], - f"/{component}/proc/tseries/", + f"{component}", "proc", "tseries", ), ] @@ -125,7 +125,7 @@ def run( ts_output_dir = [ os.path.join( timeseries_params["ts_output_dir"], - f"{component}/proc/tseries/", + f"{component}", "proc", "tseries", ), ] # ----- From 91c1698345ad9c15c87c5d80a4c8fa66a8015139 Mon Sep 17 00:00:00 2001 From: Jesse Nusbaumer Date: Wed, 17 Jul 2024 16:38:48 -0600 Subject: [PATCH 4/4] Apply review requests. --- cupid/run.py | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/cupid/run.py b/cupid/run.py index fda75b1..0686bda 100755 --- a/cupid/run.py +++ b/cupid/run.py @@ -113,21 +113,17 @@ def run( # set time series output directory: # ----- - ts_output_dir = [ - os.path.join( - global_params["CESM_output_dir"], - timeseries_params["case_name"], - f"{component}", "proc", "tseries", - ), - ] - if "ts_output_dir" in timeseries_params: - ts_output_dir = [ - os.path.join( + ts_output_dir = os.path.join( timeseries_params["ts_output_dir"], f"{component}", "proc", "tseries", - ), - ] + ) + else: + ts_output_dir = os.path.join( + global_params["CESM_output_dir"], + timeseries_params["case_name"], + f"{component}", "proc", "tseries", + ) # ----- # fmt: off @@ -139,7 +135,7 @@ def run( [timeseries_params["case_name"]], timeseries_params[component]["hist_str"], [global_params["CESM_output_dir"]+"/"+timeseries_params["case_name"]+f"/{component}/hist/"], - ts_output_dir, + [ts_output_dir], # Note that timeseries output will eventually go in # /glade/derecho/scratch/${USER}/archive/${CASE}/${component}/proc/tseries/ timeseries_params["ts_done"],