Skip to content

Commit 302ea3a

Browse files
authored
Merge pull request #66 from GEOS-ESM/feature/mathomp4/fix-sles15-detect
Fix SLES15 detection in remap_utils
2 parents cdafa08 + 7242af5 commit 302ea3a

File tree

2 files changed

+41
-35
lines changed

2 files changed

+41
-35
lines changed

CHANGELOG.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10-
- Threshold ice concentration (boundary condition), so it is bounded in [0, 1] for atmospheric forecasting with anomaly persistence.
11-
1210
### Added
1311

1412
### Changed
@@ -19,6 +17,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1917

2018
### Deprecated
2119

20+
## [2.0.8] - 2024-03-29
21+
22+
### Fixed
23+
24+
- Fixed threshold ice concentration (boundary condition), so it is bounded in [0, 1] for atmospheric forecasting with anomaly persistence.
25+
- Fix SLES15 detection in `remap_utils.py` to look for `TRUE` rather than the absence of `TRUE`. This will allow a fix in `ESMA_cmake`
26+
for correcting other scripting
27+
2228
## [2.0.7] - 2024-02-21
2329

2430
### Changed

pre/remap_restart/remap_utils.py

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,18 @@
1717

1818
#During cmake step, the string will be changed according to the system
1919

20-
BUILT_ON_SLES15 = "NO@BUILT_ON_SLES15@"
20+
BUILT_ON_SLES15 = "@BUILT_ON_SLES15@"
2121
GEOS_SITE = "@GEOS_SITE@"
2222

23-
if BUILT_ON_SLES15== "NO":
24-
BUILT_ON_SLES15 = False
23+
if BUILT_ON_SLES15 == "TRUE":
24+
BUILT_ON_SLES15 = True
2525
else:
26-
BUILT_ON_SLES15 = True
26+
BUILT_ON_SLES15 = False
2727

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

3030
choices_bc_base =[ "NCCS/Discover : /discover/nobackup/projects/gmao/bcs_shared/fvInput/ExtData/esm/tiles",
31-
"NAS : /nobackup/gmao_SIteam/ModelData/bcs_shared/fvInput/ExtData/esm/tiles",
31+
"NAS : /nobackup/gmao_SIteam/ModelData/bcs_shared/fvInput/ExtData/esm/tiles",
3232
"Custom " ]
3333

3434
# define "choices", "message" strings, and "validate" lists that are used multiple times
@@ -53,7 +53,7 @@
5353
# the following needs more cleanup; e.g., first define list of SGxxx names and parameters (i.e., STRETCH_GRID),
5454
# then assemble message_stretch and choices_stretch using this definition
5555

56-
message_stretch = f'''\n
56+
message_stretch = f'''\n
5757
Select parameters of stretched cubed-sphere grid for new restarts:
5858
5959
Name Stretch_Factor Focus_Lat Focus_Lon
@@ -85,7 +85,7 @@
8585
BCs version | ADAS tags | GCM tags typically used with BCs version
8686
-----------------|----------------------|-----------------------------------------
8787
GM4: Ganymed-4_0 | 5_12_2 ... 5_16_5 | Ganymed-4_0 ... Heracles-5_4_p3
88-
ICA: Icarus | 5_17_0 ... 5_24_0_p1 | Icarus, Jason ... 10.18
88+
ICA: Icarus | 5_17_0 ... 5_24_0_p1 | Icarus, Jason ... 10.18
8989
NL3: Icarus-NLv3 | 5_25_1 ... present | Icarus_NL, 10.19 ... present
9090
----------------------------------------------------------------------------------
9191
Other: Additional choices used in model or DAS development.
@@ -105,7 +105,7 @@
105105
message_agrid_list = f'''
106106
C12 C180 C1440
107107
C24 C360 C2880
108-
C48 C720 C5760
108+
C48 C720 C5760
109109
C90 C1000 \n'''
110110

111111
message_agrid_in = ("Enter atmospheric grid of input restarts:\n" + message_agrid_list)
@@ -200,7 +200,7 @@ def fvcore_info(x):
200200
files = glob.glob(rst_dir+'/*fvcore_internal*'+time+'*')
201201
fname = files[0]
202202

203-
if len(files) == 1:
203+
if len(files) == 1:
204204
fname = files[0]
205205

206206
fvrst = nc.Dataset(fname)
@@ -262,7 +262,7 @@ def catch_model(x):
262262

263263
def data_ocean_default(resolution):
264264
# the default string should match the choice in remapl_question.py
265-
default_ = 'CS (same as atmosphere OSTIA cubed-sphere grid)'
265+
default_ = 'CS (same as atmosphere OSTIA cubed-sphere grid)'
266266
if resolution in ['C12','C24', 'C48'] : default_ = '360x180 (Reynolds)'
267267
return default_
268268

@@ -274,7 +274,7 @@ def get_label(config):
274274
omodel = config['output']['shared']['omodel']
275275
stretch = config['output']['shared']['stretch']
276276
EASE_grid = config['output']['surface'].get('EASE_grid', None)
277-
277+
278278
out_resolution = get_resolutions(agrid=agrid, ogrid=ogrid, omodel=omodel, stretch=stretch, grid=EASE_grid)
279279

280280
agrid = config['input']['shared']['agrid']
@@ -293,9 +293,9 @@ def get_label(config):
293293

294294
# NOTE: "wemin" is a configurable parameter that can be set to anything, independent
295295
# of the bcs version. The default set here is simply the "wemin" value that is
296-
# typically used with the bcs version. The user needs to confirm the default
297-
# value or overwrite it with the "wemin" value used in the simulation that is
298-
# associated with the given set of restarts.
296+
# typically used with the bcs version. The user needs to confirm the default
297+
# value or overwrite it with the "wemin" value used in the simulation that is
298+
# associated with the given set of restarts.
299299
def wemin_default(bc_version):
300300
default_ = '13'
301301
if bc_version =='GM4' or bc_version == 'ICA' : default_ = '26'
@@ -375,24 +375,24 @@ def print_config( config, indent = 0 ):
375375

376376
def get_command_line_from_answers(answers):
377377

378-
merra2 = " -merra2 " if answers["input:shared:MERRA-2"] else ""
379-
ymdh = " -ymdh " + answers["input:shared:yyyymmddhh"]
380-
rst_dir = " -rst_dir " + answers["input:shared:rst_dir"]
378+
merra2 = " -merra2 " if answers["input:shared:MERRA-2"] else ""
379+
ymdh = " -ymdh " + answers["input:shared:yyyymmddhh"]
380+
rst_dir = " -rst_dir " + answers["input:shared:rst_dir"]
381381

382-
grout = ' -grout ' + answers["output:shared:agrid"]
383-
levsout = ' -levsout ' + answers["output:air:nlevel"]
382+
grout = ' -grout ' + answers["output:shared:agrid"]
383+
levsout = ' -levsout ' + answers["output:air:nlevel"]
384384

385385
out_dir = ' -out_dir ' + answers["output:shared:out_dir"]
386-
newid = answers["output:shared:expid"]
387-
386+
newid = answers["output:shared:expid"]
387+
388388
out_newid=''
389389
if newid.strip():
390390
out_newid = " -newid " + newid
391391

392392
bcvin = ''
393393
if answers.get("input:shared:bc_version"):
394-
bcvin = " -bcvin " + answers["input:shared:bc_version"]
395-
bcvout = " -bcvout " + answers["output:shared:bc_version"]
394+
bcvin = " -bcvin " + answers["input:shared:bc_version"]
395+
bcvout = " -bcvout " + answers["output:shared:bc_version"]
396396

397397
ocnmdlin = '-ocnmdlin data'
398398
if answers.get("input:shared:omodel"):
@@ -413,20 +413,20 @@ def get_command_line_from_answers(answers):
413413
if ogrid[0] == 'C':
414414
ogrid = "CS"
415415
oceanout = ' -oceanout ' + ogrid
416-
416+
417417
nobkg = '' if answers["output:analysis:bkg"] else " -nobkg "
418418
nolcv = '' if answers["output:analysis:lcv"] else " -nolcv "
419-
419+
420420
label = ' -lbl ' if answers["output:shared:label"] else ""
421-
421+
422422
in_bc_base = ' -in_bc_base ' + answers.get("input:shared:bc_base")
423423
out_bc_base = ' -out_bc_base ' + answers.get("output:shared:bc_base")
424424

425425
out_stretch = ''
426-
if answers["output:shared:stretch"]:
426+
if answers["output:shared:stretch"]:
427427
out_stretch = ' -out_stretch ' + answers["output:shared:stretch"]
428428
in_stretch = ''
429-
if answers["input:shared:stretch"]:
429+
if answers["input:shared:stretch"]:
430430
in_stretch = ' -in_stretch ' + answers["input:shared:stretch"]
431431

432432
zoom = " -zoom " + answers["input:surface:zoom"]
@@ -436,7 +436,7 @@ def get_command_line_from_answers(answers):
436436
if answers.get("input:surface:catch_model"):
437437
catch_model = " -catch_model " + answers["input:surface:catch_model"]
438438

439-
out_rs = " -rs "
439+
out_rs = " -rs "
440440
rs = 3
441441
if answers['output:air:remap'] and not answers['output:surface:remap_catch']:
442442
rs = 1
@@ -482,7 +482,7 @@ def get_command_line_from_answers(answers):
482482
qos + \
483483
partition
484484

485-
485+
486486
return cmdl
487487

488488
def flatten_nested(nested_dict, result=None, prefix=''):
@@ -509,7 +509,7 @@ def get_config_from_answers(answers, config_tpl = False):
509509
if config_tpl:
510510
remap_tpl = os.path.dirname(os.path.realpath(__file__)) + '/remap_params.tpl'
511511
config = get_config_from_file(remap_tpl)
512-
else:
512+
else:
513513
config['input'] = {}
514514
config['input']['air'] = {}
515515
config['input']['shared'] = {}
@@ -542,7 +542,7 @@ def get_resolutions(agrid=None, ogrid=None, omodel=None, stretch=None, grid=None
542542
if (agrid[0].upper() == 'C'):
543543
n = int(agrid[1:])
544544
aname ='CF{:04d}x6C'.format(n)
545-
545+
546546
if (ogrid[0].upper() == 'C'):
547547
oname = aname
548548
else:
@@ -559,7 +559,7 @@ def get_resolutions(agrid=None, ogrid=None, omodel=None, stretch=None, grid=None
559559
aname = aname + '-' + stretch
560560

561561
resolutions = aname +'_' + oname
562-
562+
563563
return resolutions
564564

565565
def get_default_bc_base():

0 commit comments

Comments
 (0)