Skip to content

Commit

Permalink
added comment, minor variable name changes for consistency (remap_que…
Browse files Browse the repository at this point in the history
…stions.py, remap_command_line.py)
  • Loading branch information
gmao-rreichle committed Sep 15, 2023
1 parent f5594ed commit 553554e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
2 changes: 2 additions & 0 deletions pre/remap_restart/remap_command_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ def parse_args(program_description):
p_command.add_argument('-ocnmdlin', default='data', help='Ocean model of input restarts', choices=choices_omodel)
p_command.add_argument('-ocnmdlout', default='data', help='Ocean model for new restarts', choices=choices_omodel)


# Unlike remap_questions.py, command-line feature does not deduce Catch vs. CatchCN[40,45] for simplicity, thus requires input argument
choices_catchmodel = ['catch', 'catchcnclm40', 'catchcnclm45']
p_command.add_argument('-catch_model',default='catch', help='Catchment[CN] model', choices=choices_catchmodel)

Expand Down
26 changes: 14 additions & 12 deletions pre/remap_restart/remap_questions.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ def default_partition(x):

def ask_questions():

# define choices, messages, and validation lists that are common to multiple questions

choices_bc_ops = ['NL3', 'ICA', 'GM4', 'Other']
choices_bc_other = ['v06']

Expand All @@ -62,7 +64,7 @@ def ask_questions():

choices_ogrid_cpld = ['72x36', '360x200', '720x410', '1440x1080']

bc_message = f'''\nSelect boundary conditions (BCs) version of input restarts:
message_bc_ops = f'''\nSelect boundary conditions (BCs) version of input restarts:
BCs version | ADAS tags | GCM tags typically used with BCs version
-----------------|----------------------|-----------------------------------------
GM4: Ganymed-4_0 | 5_12_2 ... 5_16_5 | Ganymed-4_0 ... Heracles-5_4_p3
Expand All @@ -72,17 +74,17 @@ def ask_questions():
Other: Additional choices used in model or DAS development.
\n\n '''

other_bc_message = f'''\nSelect BCs version of input restarts:
message_bc_other = f'''\nSelect BCs version of input restarts:
v06: NL3 + JPL veg height + PEATMAP + MODIS snow alb\n\n'''

agrid_message = f'''Enter atmospheric grid of input restarts:
message_agrid = f'''Enter atmospheric grid of input restarts:
C12 C180 C1000 C270
C24 C360 C1440 C540
C48 C500 C2880 C1080
C90 C720 C5760 C2160 C1536\n'''

valid_agrid = ['C12','C180','C1000','C270','C24','C360','C1440','C540','C48','C500','C2880','C1080','C90','C720','C5760','C2160','C1536']
validate_agrid = ['C12','C180','C1000','C270','C24','C360','C1440','C540','C48','C500','C2880','C1080','C90','C720','C5760','C2160','C1536']

questions = [
{
Expand Down Expand Up @@ -129,8 +131,8 @@ def ask_questions():
{
"type": "text",
"name": "input:shared:agrid",
"message": agrid_message,
"validate": lambda text : text in valid_agrid,
"message": message_agrid,
"validate": lambda text : text in validate_agrid,
# if it is merra-2 or has_fvcore, agrid is deduced
"when": lambda x: not x['input:shared:MERRA-2'] and not fvcore_name(x),
},
Expand Down Expand Up @@ -173,9 +175,9 @@ def ask_questions():
{
"type": "text",
"name": "output:shared:agrid",
"message": agrid_message,
"message": message_agrid,
"default": 'C360',
"validate": lambda text : text in valid_agrid,
"validate": lambda text : text in validate_agrid,
},

{
Expand Down Expand Up @@ -221,23 +223,23 @@ def ask_questions():
{
"type": "select",
"name": "input:shared:bc_version",
"message": bc_message,
"message": message_bc_ops,
"choices": choices_bc_ops,
"when": lambda x: not x["input:shared:MERRA-2"],
},

{
"type": "select",
"name": "input:shared:bc_version",
"message": other_bc_message,
"message": message_bc_other,
"choices": choices_bc_other,
"when": lambda x: x["input:shared:bc_version"] == 'Other',
},

{
"type": "select",
"name": "output:shared:bc_version",
"message": bc_message,
"message": message_bc_ops,
"choices": choices_bc_ops,
"default": "NL3",
"when": lambda x: x["input:shared:MERRA-2"],
Expand All @@ -255,7 +257,7 @@ def ask_questions():
{
"type": "select",
"name": "output:shared:bc_version",
"message": other_bc_message,
"message": message_bc_other,
"choices": choices_bc_other,
"when": lambda x: x["output:shared:bc_version"] == 'Other' and x["input:shared:bc_version"] not in ['v06'],
},
Expand Down

0 comments on commit 553554e

Please sign in to comment.