Skip to content

Commit

Permalink
Merge branch 'feature/wjiang/command_line' of github.com:GEOS-ESM/GEO…
Browse files Browse the repository at this point in the history
…S_Util into feature/wjiang/command_line
  • Loading branch information
weiyuan-jiang committed Nov 14, 2023
2 parents b3c2682 + bea49ba commit cbf0b84
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 37 deletions.
26 changes: 13 additions & 13 deletions pre/remap_restart/remap_catchANDcn.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,25 +47,25 @@ def remap(self):

print("\nRemapping " + model + ".....\n")

cwdir = os.getcwd()
bindir = os.path.dirname(os.path.realpath(__file__))
in_bc_base = config['input']['shared']['bc_base']
in_bc_version = config['input']['shared']['bc_version']
out_bc_base = config['output']['shared']['bc_base']
out_bc_version= config['output']['shared']['bc_version']
out_dir = config['output']['shared']['out_dir']
expid = config['output']['shared']['expid']
in_wemin = config['input']['surface']['wemin']
out_wemin = config['output']['surface']['wemin']
surflay = config['output']['surface']['surflay']
in_tilefile = config['input']['surface']['catch_tilefile']
cwdir = os.getcwd()
bindir = os.path.dirname(os.path.realpath(__file__))
in_bc_base = config['input']['shared']['bc_base']
in_bc_version = config['input']['shared']['bc_version']
out_bc_base = config['output']['shared']['bc_base']
out_bc_version = config['output']['shared']['bc_version']
out_dir = config['output']['shared']['out_dir']
expid = config['output']['shared']['expid']
in_wemin = config['input']['surface']['wemin']
out_wemin = config['output']['surface']['wemin']
surflay = config['output']['surface']['surflay']
in_tilefile = config['input']['surface']['catch_tilefile']

if not in_tilefile :
agrid = config['input']['shared']['agrid']
ogrid = config['input']['shared']['ogrid']
omodel = config['input']['shared']['omodel']
stretch = config['input']['shared']['stretch']
bc_geomdir = get_geomdir(in_bc_base, in_bc_version, agrid, ogrid, omodel, stretch)
bc_geomdir = get_geomdir(in_bc_base, in_bc_version, agrid, ogrid, omodel, stretch)
in_tilefile = glob.glob(bc_geomdir + '/*.til')[0]

agrid = config['output']['shared']['agrid']
Expand Down
4 changes: 2 additions & 2 deletions pre/remap_restart/remap_command_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ def parse_args(program_description):
p_command.add_argument('-np', action='store_true', help="No prompt. Overwrite config files without prompting questions")
p_command.add_argument('-lbl', action='store_true', help="Label output restarts with bc_versions and resolutions")
p_command.add_argument('-noagcm_import_rst', action='store_true', help="Do not remap agcm_import_rst file")
p_command.add_argument('-in_bc_base', default="", help="Boundary conditions base directory (without bc_version and resolution infomation) for input restart")
p_command.add_argument('-out_bc_base', default="", help="Boundary conditions base directory (without bc_version and resolution infomation) for new restarts")
p_command.add_argument('-in_bc_base', default="", help="Boundary conditions base dir (w/o bc_version and resolution info) for input restarts")
p_command.add_argument('-out_bc_base',default="", help="Boundary conditions base dir (w/o bc_version and resolution info) for new restarts")
p_command.add_argument('-zoom', help= "Zoom parameter (search radius) for input surface restarts")

p_command.add_argument('-qos', default="debug", help="SLURM quality-of-service", choices=['debug', 'allnccs'])
Expand Down
4 changes: 2 additions & 2 deletions pre/remap_restart/remap_params.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ input:
# (coupled) ocean model: data, MOM5, MOM6
omodel: data
agrid:
bc_version: none
bc_base:
bc_version: none
expid:
ogrid:
rst_dir:
Expand All @@ -35,8 +35,8 @@ output:
# (coupled) ocean model: data, MOM5, MOM6
omodel: data
agrid:
bc_version: none
bc_base:
bc_version: none
expid:
ogrid:
out_dir:
Expand Down
10 changes: 5 additions & 5 deletions pre/remap_restart/remap_questions.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def ask_questions():
{
"type": "confirm",
"name": "input:shared:MERRA-2",
"message": "Remap archived MERRA-2 restarts?\n",
"message": "Remap archived MERRA-2 restarts? (NCCS/Discover only; elsewhere, select 'N' and complete full config; requires nc4 restarts.)\n",
"default": False,
},
{
Expand Down Expand Up @@ -304,14 +304,14 @@ def ask_questions():
"type": "path",
"name": "input:shared:bc_base",
"message": "\nEnter BCs base directory for input restarts: \n",
"when": lambda x: 'Customize ' in x.get('input:shared:bc_base'),
"when": lambda x: 'Custom ' in x.get('input:shared:bc_base'),
},
# dummy (invisible) question to retrieve input:shared:bc_base
{
"type": "text",
"name": "input:shared:bc_base",
"message": "retrieve and echo bcs",
# always return false, so questions never shows but changes ogrid
# always return false, so questions never shows
"when": lambda x: echo_bcs(x, 'input')
},

Expand All @@ -327,14 +327,14 @@ def ask_questions():
"type": "path",
"name": "output:shared:bc_base",
"message": "\nEnter BCs base directory for new restarts: \n",
"when": lambda x: 'Customize ' in x.get('output:shared:bc_base'),
"when": lambda x: 'Custom ' in x.get('output:shared:bc_base'),
},
# dummy (invisible) question to retrieve output:shared:bc_base
{
"type": "text",
"name": "output:shared:bc_base",
"message": "retrieve and echo bcs",
# always return false, so questions never shows but changes ogrid
# always return false, so questions never shows
"when": lambda x: echo_bcs(x, 'output')
},

Expand Down
10 changes: 5 additions & 5 deletions pre/remap_restart/remap_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

# top-level directory for BCs (machine-dependent)

choices_bc_base =[ "DISCOVER : /discover/nobackup/projects/gmao/bcs_shared/fvInput/ExtData/esm/tiles",
"NAS : /nobackup/gmao_SIteam/ModelData/bcs_shared/fvInput/ExtData/esm/tiles",
"Customize : " ]
choices_bc_base =[ "NCCS/Discover : /discover/nobackup/projects/gmao/bcs_shared/fvInput/ExtData/esm/tiles",
"NAS : /nobackup/gmao_SIteam/ModelData/bcs_shared/fvInput/ExtData/esm/tiles",
"Custom " ]

# define "choices", "message" strings, and "validate" lists that are used multiple times
# (and related definitions, even if they are used just once).
Expand Down Expand Up @@ -497,9 +497,9 @@ def get_topodir(bc_base, bc_version, agrid, ogrid, model, stretch):
agrid_name = gridStr.split('_')[0]
bc_topo = ''
if 'GM4' == bc_version:
bc_topo = bc_base+ '/'+ bc_version + '/TOPO/TOPO_'+agrid_name
bc_topo = bc_base + '/' + bc_version + '/TOPO/TOPO_' + agrid_name
else:
bc_topo = bc_base+ '/'+ bc_version + '/TOPO/TOPO_'+agrid_name + '/smoothed'
bc_topo = bc_base + '/' + bc_version + '/TOPO/TOPO_' + agrid_name + '/smoothed'

return bc_topo

Expand Down
4 changes: 2 additions & 2 deletions pre/remap_restart/tests/amip_c180Toc90.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ input:
agrid: C180
# (coupled) ocean model: data, MOM5, MOM6
omodel: data
bc_version: NL3
bc_base: /discover/nobackup/projects/gmao/bcs_shared/fvInput/ExtData/esm/tiles
bc_version: NL3
expid: JM_v10.22.2_L072_C180_AMIP
ogrid: 1440X720
rst_dir: /discover/nobackup/projects/gmao/SIteam/Remapping_Test_Cases/amip_c180Toc90/inputs/
Expand All @@ -31,8 +31,8 @@ output:
stretch: false
# (coupled) ocean model: data, MOM5, MOM6
omodel: data
bc_version: NL3
bc_base: /discover/nobackup/projects/gmao/bcs_shared/fvInput/ExtData/esm/tiles
bc_version: NL3
expid: C90CS_JM_v10.22.2_L072_C180_AMIP
ogrid: C90
out_dir: $NOBACKUP/REMAP_TESTS/amip_c180Toc90/
Expand Down
4 changes: 2 additions & 2 deletions pre/remap_restart/tests/c180Toc360.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ input:
# (coupled) ocean model: data, MOM5, MOM6
omodel: data
agrid: C180
bc_version: NL3
bc_base: /discover/nobackup/projects/gmao/bcs_shared/fvInput/ExtData/esm/tiles
bc_version: NL3
expid: Jason-3_4_NL_REAMIP_MERRA2_C180
ogrid: 1440X720
rst_dir: /discover/nobackup/projects/gmao/SIteam/Remapping_Test_Cases/c180Toc360/inputs/
Expand All @@ -31,8 +31,8 @@ output:
stretch: false
# (coupled) ocean model: data, MOM5, MOM6
omodel: data
bc_version: NL3
bc_base: /discover/nobackup/projects/gmao/bcs_shared/fvInput/ExtData/esm/tiles
bc_version: NL3
expid: C360CS_Jason-3_4_NL_REAMIP_MERRA2_C180
ogrid: C360
out_dir: $NOBACKUP/REMAP_TESTS/c360Toc24/
Expand Down
4 changes: 2 additions & 2 deletions pre/remap_restart/tests/c24Toc12.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ input:
# (coupled) ocean model: data, MOM5, MOM6
omodel: data
agrid: C24
bc_version: NL3
bc_base: /discover/nobackup/projects/gmao/bcs_shared/fvInput/ExtData/esm/tiles
bc_version: NL3
expid: ''
ogrid: 360X180
rst_dir: /discover/nobackup/projects/gmao/SIteam/Remapping_Test_Cases/c24Toc12/inputs
Expand All @@ -31,8 +31,8 @@ output:
stretch: false
# (coupled) ocean model: data, MOM5, MOM6
omodel: data
bc_version: NL3
bc_base: /discover/nobackup/projects/gmao/bcs_shared/fvInput/ExtData/esm/tiles
bc_version: NL3
expid: hello
ogrid: 360X180
out_dir: $NOBACKUP/REMAP_TESTS/c24Toc12/
Expand Down
4 changes: 2 additions & 2 deletions pre/remap_restart/tests/c360Toc24.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ input:
stretch: false
# (coupled) ocean model: data, MOM5, MOM6
omodel: data
bc_version: NL3
bc_base: /discover/nobackup/projects/gmao/bcs_shared/fvInput/ExtData/esm/tiles
bc_version: NL3
expid: x0046a
ogrid: C360
rst_dir: /discover/nobackup/projects/gmao/SIteam/Remapping_Test_Cases/c360Toc24/inputs
Expand All @@ -31,8 +31,8 @@ output:
stretch: false
# (coupled) ocean model: data, MOM5, MOM6
omodel: data
bc_version: NL3
bc_base: /discover/nobackup/projects/gmao/bcs_shared/fvInput/ExtData/esm/tiles
bc_version: NL3
expid: C24c_x0046a
ogrid: 360X180
out_dir: $NOBACKUP/REMAP_TESTS/c360Toc24/
Expand Down
4 changes: 2 additions & 2 deletions pre/remap_restart/tests/f522Toc360.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ input:
# (coupled) ocean model: data, MOM5, MOM6
omodel: data
agrid: C720
bc_version: ICA
bc_base: /discover/nobackup/projects/gmao/bcs_shared/fvInput/ExtData/esm/tiles
bc_version: ICA
expid: f522_fp
ogrid: C720
rst_dir: /discover/nobackup/projects/gmao/SIteam/Remapping_Test_Cases/f522Toc360/inputs/
Expand All @@ -30,8 +30,8 @@ output:
stretch: false
# (coupled) ocean model: data, MOM5, MOM6
omodel: data
bc_version: NL3
bc_base: /discover/nobackup/projects/gmao/bcs_shared/fvInput/ExtData/esm/tiles
bc_version: NL3
expid: remap
ogrid: 360X180
out_dir: $NOBACKUP/REMAP_TESTS/f522Toc360/
Expand Down

0 comments on commit cbf0b84

Please sign in to comment.