Skip to content

Commit

Permalink
Cosmotic changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
danielabdi-noaa committed Jun 18, 2022
1 parent 291618b commit 23d332e
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 65 deletions.
3 changes: 1 addition & 2 deletions ush/calculate_cost.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,7 @@ def calculate_cost(config_fn):
class Testing(unittest.TestCase):
def test_calculate_cost(self):
USHDIR = os.path.dirname(os.path.abspath(__file__))
config_fn = os.path.join(USHDIR, "config.community.sh")
params = calculate_cost(config_fn)
params = calculate_cost(None)
self.assertCountEqual(params, [36, 1987440, 36, 28689])

def setUp(self):
Expand Down
8 changes: 4 additions & 4 deletions ush/create_model_configure_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,10 @@ def create_model_configure_file(
print_info_msg(
dedent(
f"""
The variable \"settings\" specifying values to be used in the \"{MODEL_CONFIG_FN}\"
file has been set as follows:
#-----------------------------------------------------------------------
settings =\n"""
The variable \"settings\" specifying values to be used in the \"{MODEL_CONFIG_FN}\"
file has been set as follows:
#-----------------------------------------------------------------------
settings =\n"""
)
+ settings_str,
verbose=VERBOSE,
Expand Down
16 changes: 8 additions & 8 deletions ush/get_crontab_contents.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ def add_crontab_line():
crontab_backup_fp = os.path.join(EXPTDIR, f"crontab.bak.{time_stamp}")
print_info_msg(
f'''
Copying contents of user cron table to backup file:
crontab_backup_fp = \"{crontab_backup_fp}\"''',
Copying contents of user cron table to backup file:
crontab_backup_fp = \"{crontab_backup_fp}\"''',
verbose=VERBOSE,
)

Expand All @@ -109,18 +109,18 @@ def add_crontab_line():

print_info_msg(
f'''
The following line already exists in the cron table and thus will not be
added:
CRONTAB_LINE = \"{CRONTAB_LINE}\"'''
The following line already exists in the cron table and thus will not be
added:
CRONTAB_LINE = \"{CRONTAB_LINE}\"'''
)

else:

print_info_msg(
f'''
Adding the following line to the user's cron table in order to automatically
resubmit SRW workflow:
CRONTAB_LINE = \"{CRONTAB_LINE}\"''',
Adding the following line to the user's cron table in order to automatically
resubmit SRW workflow:
CRONTAB_LINE = \"{CRONTAB_LINE}\"''',
verbose=VERBOSE,
)

Expand Down
22 changes: 11 additions & 11 deletions ush/link_fix.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,24 +228,24 @@ def link_fix(verbose, file_group):
if res is None:
print_err_msg_exit(
f"""
The resolution could not be extracted from the current file's name. The
full path to the file (fp) is:
fp = \"{fp}\"
This may be because fp contains the * globbing character, which would
imply that no files were found that match the globbing pattern specified
in fp."""
The resolution could not be extracted from the current file's name. The
full path to the file (fp) is:
fp = \"{fp}\"
This may be because fp contains the * globbing character, which would
imply that no files were found that match the globbing pattern specified
in fp."""
)
else:
res = res[0]

if (i > 0) and (res != res_prev):
print_err_msg_exit(
f"""
The resolutions (as obtained from the file names) of the previous and
current file (fp_prev and fp, respectively) are different:
fp_prev = \"{fp_prev}\"
fp = \"{fp}\"
Please ensure that all files have the same resolution."""
The resolutions (as obtained from the file names) of the previous and
current file (fp_prev and fp, respectively) are different:
fp_prev = \"{fp_prev}\"
fp = \"{fp}\"
Please ensure that all files have the same resolution."""
)

i = i + 1
Expand Down
8 changes: 5 additions & 3 deletions ush/python_utils/define_macos_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ def check_darwin(cmd):
if err != 0:
print_err_msg_exit(
f"""
For Darwin-based operating systems (MacOS), the '{cmd}' utility is required to run the UFS SRW Application.
Reference the User's Guide for more information about platform requirements.
Aborting."""
For Darwin-based operating systems (MacOS), the '{cmd}' utility is required
to run the UFS SRW Application. Reference the User's Guide for more information
about platform requirements.
Aborting."""
)
return True

Expand Down
20 changes: 10 additions & 10 deletions ush/set_FV3nml_ens_stoch_seeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,16 @@ def set_FV3nml_ens_stoch_seeds(cdate):
print_err_msg_exit(
dedent(
f"""
Call to python script set_namelist.py to set the variables in the FV3
namelist file that specify the paths to the surface climatology files
failed. Parameters passed to this script are:
Full path to base namelist file:
FV3_NML_FP = \"{FV3_NML_FP}\"
Full path to output namelist file:
fv3_nml_ensmem_fp = \"{fv3_nml_ensmem_fp}\"
Namelist settings specified on command line (these have highest precedence):
settings =
{settings_str}"""
Call to python script set_namelist.py to set the variables in the FV3
namelist file that specify the paths to the surface climatology files
failed. Parameters passed to this script are:
Full path to base namelist file:
FV3_NML_FP = \"{FV3_NML_FP}\"
Full path to output namelist file:
fv3_nml_ensmem_fp = \"{fv3_nml_ensmem_fp}\"
Namelist settings specified on command line (these have highest precedence):
settings =
{settings_str}"""
)
)

Expand Down
11 changes: 0 additions & 11 deletions ush/set_extrn_mdl_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,6 @@ def set_extrn_mdl_params():
export_vars(env_vars=env_vars)


#
# -----------------------------------------------------------------------
#
# Call the function defined above.
#
# -----------------------------------------------------------------------
#
if __name__ == "__main__":
set_extrn_mdl_params()


class Testing(unittest.TestCase):
def test_extrn_mdl_params(self):
set_extrn_mdl_params()
Expand Down
32 changes: 16 additions & 16 deletions ush/set_ozone_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ def set_ozone_param(ccpp_phys_suite_fp):
else:
print_err_msg_exit(
f'''
Unknown or no ozone parameterization
specified in the CCPP physics suite file (ccpp_phys_suite_fp):
ccpp_phys_suite_fp = \"{ccpp_phys_suite_fp}\"
ozone_param = \"{ozone_param}\"'''
Unknown or no ozone parameterization
specified in the CCPP physics suite file (ccpp_phys_suite_fp):
ccpp_phys_suite_fp = \"{ccpp_phys_suite_fp}\"
ozone_param = \"{ozone_param}\"'''
)
#
# -----------------------------------------------------------------------
Expand Down Expand Up @@ -154,29 +154,29 @@ def set_ozone_param(ccpp_phys_suite_fp):

msg = dedent(
f"""
After setting the file name of the ozone production/loss file in the
FIXgsm directory (based on the ozone parameterization specified in the
CCPP suite definition file), the array specifying the mapping between
the symlinks that need to be created in the cycle directories and the
files in the FIXam directory is:
After setting the file name of the ozone production/loss file in the
FIXgsm directory (based on the ozone parameterization specified in the
CCPP suite definition file), the array specifying the mapping between
the symlinks that need to be created in the cycle directories and the
files in the FIXam directory is:
"""
"""
)
msg += dedent(
f"""
CYCLEDIR_LINKS_TO_FIXam_FILES_MAPPING = {list_to_str(CYCLEDIR_LINKS_TO_FIXam_FILES_MAPPING)}
"""
CYCLEDIR_LINKS_TO_FIXam_FILES_MAPPING = {list_to_str(CYCLEDIR_LINKS_TO_FIXam_FILES_MAPPING)}
"""
)
print_info_msg(msg, verbose=VERBOSE)

else:

print_err_msg_exit(
f'''
Unable to set name of the ozone production/loss file in the FIXgsm directory
in the array that specifies the mapping between the symlinks that need to
be created in the cycle directories and the files in the FIXgsm directory:
fixgsm_ozone_fn_is_set = \"{fixgsm_ozone_fn_is_set}\"'''
Unable to set name of the ozone production/loss file in the FIXgsm directory
in the array that specifies the mapping between the symlinks that need to
be created in the cycle directories and the files in the FIXgsm directory:
fixgsm_ozone_fn_is_set = \"{fixgsm_ozone_fn_is_set}\"'''
)

EXPORTS = ["CYCLEDIR_LINKS_TO_FIXam_FILES_MAPPING", "FIXgsm_FILES_TO_COPY_TO_FIXam"]
Expand Down

0 comments on commit 23d332e

Please sign in to comment.