Skip to content

Configure option syntax now only uses dashes #358

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 27 additions & 11 deletions cime_config/cam_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,10 @@ def __init__(self, case, case_log):
"To specify the Kessler and Held-Suarez suites as ",
"run time options, use '--physics-suites kessler;held_suarez_1994'."]

#--------------------------
# Set physics_suites string
#--------------------------

self.create_config("physics_suites", phys_desc,
user_config_opts.physics_suites)

Expand Down Expand Up @@ -585,7 +589,7 @@ def parse_config_opts(cls, config_opts, test_mode=False):
[('analytic_ic', False), ('dyn', 'se'), ('dyn_kind', 'REAL64'), ('phys_kind', 'REAL64'), ('physics_suites', 'kessler')]

5. Check that parse_config_opts works as expected when given both a string and logical argument:
>>> config_opts = ConfigCAM.parse_config_opts("--physics-suites kessler --dyn se --analytic_ic")
>>> config_opts = ConfigCAM.parse_config_opts("--physics-suites kessler --dyn se --analytic-ic")
>>> vargs = vars(config_opts)
>>> [(x, vargs[x]) for x in sorted(vargs)]
[('analytic_ic', True), ('dyn', 'se'), ('dyn_kind', 'REAL64'), ('phys_kind', 'REAL64'), ('physics_suites', 'kessler')]
Expand All @@ -609,26 +613,38 @@ def parse_config_opts(cls, config_opts, test_mode=False):
epilog="Allowed values of "+cco_str)

#Add argument options:
parser.add_argument("--physics-suites", "-physics-suites", type=str,
required=True, metavar='<CCPP_SDFs>',
parser.add_argument("--physics-suites",
type=str,
required=True,
metavar='<CCPP_SDFs>',
help="""Semicolon-separated list of Physics Suite
Definition Files (SDFs)""")

parser.add_argument("--dyn", "-dyn", metavar='<dycore>',
type=str, required=False, default="",
parser.add_argument("--dyn",
type=str,
required=False,
metavar='<dycore>',
default="",
help="""Name of dycore""")

parser.add_argument("--analytic_ic", "-analytic_ic",
action='store_true', required=False,
parser.add_argument("--analytic-ic",
action='store_true',
required=False,
help="""Flag to turn on Analytic Initial
Conditions (ICs).""")

parser.add_argument("--dyn_kind", "-dyn_kind",
type=str, required=False, default="REAL64",
parser.add_argument("--dyn-kind",
type=str,
required=False,
metavar='<kind string>',
default="REAL64",
help="""Fortran kind used in dycore for type real.""")

parser.add_argument("--phys_kind", "-phys_kind",
type=str, required=False, default="REAL64",
parser.add_argument("--phys-kind",
type=str,
required=False,
metavar='<kind string>',
default="REAL64",
help="""Fortran kind used in physics for type real.""")

popts = [opt for opt in config_opts.split(" ") if opt]
Expand Down
6 changes: 3 additions & 3 deletions cime_config/config_component.xml
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,10 @@

<!-- Simple models -->
<value compset="_CAM%ADIAB">--physics-suites adiabatic</value>
<value compset="_CAM%TJ16">--physics-suites tj2016 --analytic_ic</value>
<value compset="_CAM%TJ16">--physics-suites tj2016 --analytic-ic</value>
<!-- <value compset="_CAM%KESSLER">-phys kessler -chem terminator -analytic_ic</value> -->
<value compset="_CAM%KESSLER">--physics-suites kessler --analytic_ic</value>
<value compset="_CAM%HS94">--physics-suites held_suarez_1994 --analytic_ic</value>
<value compset="_CAM%KESSLER">--physics-suites kessler --analytic-ic</value>
<value compset="_CAM%HS94">--physics-suites held_suarez_1994 --analytic-ic</value>
<value compset="_CAM%PHYSTEST">--dyn none --physics-suites adiabatic</value>

<!-- Aquaplanet -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
./xmlchange CAM_LINKED_LIBS=" "
./xmlchange --append CAM_CONFIG_OPTS="--analytic_ic"
./xmlchange --append CAM_CONFIG_OPTS="--analytic-ic"
2 changes: 1 addition & 1 deletion test/unit/test_cam_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def __init__(self):
"COMP_ATM" : "cam",
"EXEROOT" : "/some/made-up/path",
"CASEROOT" : "/another/made-up/path",
"CAM_CONFIG_OPTS" : "-dyn none --physics-suites mango;papaya",
"CAM_CONFIG_OPTS" : "--dyn none --physics-suites mango;papaya",
"COMP_ROOT_DIR_ATM" : "/a/third/made-up/path",
"CAM_CPPDEFS" : "UNSET",
"NTHRDS_ATM" : 1,
Expand Down