From 6a9f5169b2e29b74ee4895060dedd2459b776ad1 Mon Sep 17 00:00:00 2001 From: Rolf Reichle Date: Tue, 14 Nov 2023 10:26:50 -0500 Subject: [PATCH 1/4] change order of bc_base and bc_version in yaml template and example/test yaml files (remap_params.tpl, test/*.yaml) --- pre/remap_restart/remap_params.tpl | 4 ++-- pre/remap_restart/tests/amip_c180Toc90.yaml | 4 ++-- pre/remap_restart/tests/c180Toc360.yaml | 4 ++-- pre/remap_restart/tests/c24Toc12.yaml | 4 ++-- pre/remap_restart/tests/c360Toc24.yaml | 4 ++-- pre/remap_restart/tests/f522Toc360.yaml | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/pre/remap_restart/remap_params.tpl b/pre/remap_restart/remap_params.tpl index d1d108a..3a78a20 100644 --- a/pre/remap_restart/remap_params.tpl +++ b/pre/remap_restart/remap_params.tpl @@ -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: @@ -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: diff --git a/pre/remap_restart/tests/amip_c180Toc90.yaml b/pre/remap_restart/tests/amip_c180Toc90.yaml index 9645e57..b3b7096 100644 --- a/pre/remap_restart/tests/amip_c180Toc90.yaml +++ b/pre/remap_restart/tests/amip_c180Toc90.yaml @@ -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/ @@ -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/ diff --git a/pre/remap_restart/tests/c180Toc360.yaml b/pre/remap_restart/tests/c180Toc360.yaml index ec89e70..10b4c32 100644 --- a/pre/remap_restart/tests/c180Toc360.yaml +++ b/pre/remap_restart/tests/c180Toc360.yaml @@ -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/ @@ -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/ diff --git a/pre/remap_restart/tests/c24Toc12.yaml b/pre/remap_restart/tests/c24Toc12.yaml index f983cec..ed9ec24 100644 --- a/pre/remap_restart/tests/c24Toc12.yaml +++ b/pre/remap_restart/tests/c24Toc12.yaml @@ -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 @@ -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/ diff --git a/pre/remap_restart/tests/c360Toc24.yaml b/pre/remap_restart/tests/c360Toc24.yaml index 250ff0d..e566fc9 100644 --- a/pre/remap_restart/tests/c360Toc24.yaml +++ b/pre/remap_restart/tests/c360Toc24.yaml @@ -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 @@ -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/ diff --git a/pre/remap_restart/tests/f522Toc360.yaml b/pre/remap_restart/tests/f522Toc360.yaml index b9664e9..4c58aab 100644 --- a/pre/remap_restart/tests/f522Toc360.yaml +++ b/pre/remap_restart/tests/f522Toc360.yaml @@ -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/ @@ -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/ From 588376877dcef5003d76afec20cfb73e728a0ee1 Mon Sep 17 00:00:00 2001 From: Rolf Reichle Date: Tue, 14 Nov 2023 10:34:20 -0500 Subject: [PATCH 2/4] minor edit to bc_base question (remap_questions.py, remap_utils.py) --- pre/remap_restart/remap_questions.py | 4 ++-- pre/remap_restart/remap_utils.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pre/remap_restart/remap_questions.py b/pre/remap_restart/remap_questions.py index afbf592..658cab0 100755 --- a/pre/remap_restart/remap_questions.py +++ b/pre/remap_restart/remap_questions.py @@ -304,7 +304,7 @@ 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 { @@ -327,7 +327,7 @@ 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 { diff --git a/pre/remap_restart/remap_utils.py b/pre/remap_restart/remap_utils.py index 7691c5b..3fdf31f 100755 --- a/pre/remap_restart/remap_utils.py +++ b/pre/remap_restart/remap_utils.py @@ -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). From 4dc80c0b09df40a2325ecea57269b57b7ad4a235 Mon Sep 17 00:00:00 2001 From: Rolf Reichle Date: Tue, 14 Nov 2023 10:40:23 -0500 Subject: [PATCH 3/4] minor edits in comments and white-space changes (remap_catchANDcn.py, remap_command_line.py, remap_questions.py, remap_utils.py) --- pre/remap_restart/remap_catchANDcn.py | 26 ++++++++++++------------- pre/remap_restart/remap_command_line.py | 4 ++-- pre/remap_restart/remap_questions.py | 4 ++-- pre/remap_restart/remap_utils.py | 4 ++-- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/pre/remap_restart/remap_catchANDcn.py b/pre/remap_restart/remap_catchANDcn.py index 05ddaa9..c374f49 100755 --- a/pre/remap_restart/remap_catchANDcn.py +++ b/pre/remap_restart/remap_catchANDcn.py @@ -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'] diff --git a/pre/remap_restart/remap_command_line.py b/pre/remap_restart/remap_command_line.py index 0c0c883..2a7693f 100755 --- a/pre/remap_restart/remap_command_line.py +++ b/pre/remap_restart/remap_command_line.py @@ -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']) diff --git a/pre/remap_restart/remap_questions.py b/pre/remap_restart/remap_questions.py index 658cab0..083c83d 100755 --- a/pre/remap_restart/remap_questions.py +++ b/pre/remap_restart/remap_questions.py @@ -311,7 +311,7 @@ def ask_questions(): "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') }, @@ -334,7 +334,7 @@ def ask_questions(): "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') }, diff --git a/pre/remap_restart/remap_utils.py b/pre/remap_restart/remap_utils.py index 3fdf31f..a7970ea 100755 --- a/pre/remap_restart/remap_utils.py +++ b/pre/remap_restart/remap_utils.py @@ -496,9 +496,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 From bea49ba7780bd725ffaab601a56cecbd816b366b Mon Sep 17 00:00:00 2001 From: Rolf Reichle Date: Tue, 14 Nov 2023 10:47:33 -0500 Subject: [PATCH 4/4] clarified question about using archived MERRA-2 restarts (remap_questions.py) --- pre/remap_restart/remap_questions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pre/remap_restart/remap_questions.py b/pre/remap_restart/remap_questions.py index 083c83d..b383900 100755 --- a/pre/remap_restart/remap_questions.py +++ b/pre/remap_restart/remap_questions.py @@ -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, }, {