Skip to content

Commit

Permalink
swell_static_files_user in config now used in appropriate tasks (GEOS…
Browse files Browse the repository at this point in the history
  • Loading branch information
mranst committed Sep 11, 2024
1 parent b62be29 commit c2a77f4
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/swell/tasks/generate_b_climatology.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from swell.tasks.base.task_base import taskBase
from swell.utilities.shell_commands import run_subprocess, run_track_log_subprocess
from swell.utilities.run_jedi_executables import jedi_dictionary_iterator
from swell.utilities.file_system_operations import check_if_files_exist_in_path

# --------------------------------------------------------------------------------------------------

Expand Down Expand Up @@ -239,7 +240,18 @@ def execute(self):
window_offset = self.config.window_offset()
window_type = self.config.window_type()
background_error_model = self.config.background_error_model()

swell_static_files_user = self.config.swell_static_files_user(None)
self.swell_static_files = self.config.swell_static_files()

# Use static_files_user if present in config and contains files
# -------------------------------------------------------------
if swell_static_files_user is not None:
self.logger.info('swell_static_files_user specified, checking for files')
if check_if_files_exist_in_path(self.logger, swell_static_files_user):
self.logger.info(f'Using swell static files in {swell_static_files_user}')
self.swell_static_files = swell_static_files_user

self.horizontal_resolution = self.config.horizontal_resolution()
self.vertical_resolution = self.config.vertical_resolution()

Expand Down
10 changes: 10 additions & 0 deletions src/swell/tasks/get_geos_restart.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

from swell.tasks.base.task_base import taskBase
from swell.utilities.file_system_operations import copy_to_dst_dir
from swell.utilities.file_system_operations import check_if_files_exist_in_path

# --------------------------------------------------------------------------------------------------

Expand All @@ -24,8 +25,17 @@ def execute(self):

self.logger.info('Obtaining GEOS restarts for the coupled simulation')

swell_static_files_user = self.config.swell_static_files_user(None)
self.swell_static_files = self.config.swell_static_files()

# Use static_files_user if present in config and contains files
# -------------------------------------------------------------
if swell_static_files_user is not None:
self.logger.info('swell_static_files_user specified, checking for files')
if check_if_files_exist_in_path(self.logger, swell_static_files_user):
self.logger.info(f'Using swell static files in {swell_static_files_user}')
self.swell_static_files = swell_static_files_user

# Create forecast_dir and INPUT
# ----------------------------
if not os.path.exists(self.forecast_dir('INPUT')):
Expand Down
11 changes: 11 additions & 0 deletions src/swell/tasks/prep_geos_run_dir.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

from swell.tasks.base.task_base import taskBase
from swell.utilities.file_system_operations import copy_to_dst_dir
from swell.utilities.file_system_operations import check_if_files_exist_in_path

# --------------------------------------------------------------------------------------------------

Expand All @@ -33,7 +34,17 @@ def execute(self):
In GEOS speak, it creates the "scratch" directory.
"""

swell_static_files_user = self.config.swell_static_files_user(None)
self.swell_static_files = self.config.swell_static_files()

# Use static_files_user if present in config and contains files
# -------------------------------------------------------------
if swell_static_files_user is not None:
self.logger.info('swell_static_files_user specified, checking for files')
if check_if_files_exist_in_path(self.logger, swell_static_files_user):
self.logger.info(f'Using swell static files in {swell_static_files_user}')
self.swell_static_files = swell_static_files_user

# TODO: exp. directory location requires better handling
self.geos_exp_dir = os.path.join(self.swell_static_files, 'geos', 'run_dirs',
self.config.geos_experiment_directory())
Expand Down
13 changes: 12 additions & 1 deletion src/swell/tasks/stage_jedi.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from swell.tasks.base.task_base import taskBase
from swell.utilities.filehandler import *
from swell.utilities.exceptions import *

from swell.utilities.file_system_operations import check_if_files_exist_in_path

# --------------------------------------------------------------------------------------------------

Expand All @@ -31,7 +31,18 @@ def execute(self):

# Extract potential template variables from config
horizontal_resolution = self.config.horizontal_resolution()

swell_static_files_user = self.config.swell_static_files_user(None)
swell_static_files = self.config.swell_static_files()

# Use static_files_user if present in config and contains files
# -------------------------------------------------------------
if swell_static_files_user is not None:
self.logger.info('swell_static_files_user specified, checking for files')
if check_if_files_exist_in_path(self.logger, swell_static_files_user):
self.logger.info(f'Using swell static files in {swell_static_files_user}')
swell_static_files = swell_static_files_user

vertical_resolution = self.config.vertical_resolution()
gsibec_configuration = self.config.gsibec_configuration(None)

Expand Down
4 changes: 4 additions & 0 deletions src/swell/tasks/task_questions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,11 @@ swell_static_files_user:
default_value: None
prompt: What is the path to the user provided Swell Static Files directory?
tasks:
- GenerateBClimatology
- GenerateBClimatologyByLinking
- GetGeosRestart
- PrepGeosRunDir
- StageJedi
type: string

total_processors:
Expand Down

0 comments on commit c2a77f4

Please sign in to comment.