Skip to content

Commit 44dc2f7

Browse files
committed
Merge branch 'main' into feature/wjiang/bill_remap_upper_stretched_cube_in
2 parents 7cf1841 + 302ea3a commit 44dc2f7

File tree

3 files changed

+68
-33
lines changed

3 files changed

+68
-33
lines changed

CHANGELOG.md

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

2222
### Deprecated
2323

24+
## [2.0.8] - 2024-03-29
25+
26+
### Fixed
27+
28+
- Fixed threshold ice concentration (boundary condition), so it is bounded in [0, 1] for atmospheric forecasting with anomaly persistence.
29+
- 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`
30+
for correcting other scripting
31+
2432
## [2.0.7] - 2024-02-21
2533

2634
### Changed

pre/prepare_ocnExtData/forecast_SST_FRACI_eight.F90

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ PROGRAM forecast_SST_FRACI_eight
3535
integer :: today_year, today_mon, today_day
3636

3737
integer :: fcst_nDays
38+
39+
real, parameter :: T_f = 271.35d0 ! 273.15-1.8d0 sea water freezing temperature in K
3840
!----
3941

4042
print *, " "
@@ -158,6 +160,32 @@ PROGRAM forecast_SST_FRACI_eight
158160
if (i > 1) then
159161
sst = sst_daily_clim + anom_sst0
160162
ice = ice_daily_clim + anom_ice0
163+
164+
! -- check bounds of sst and ice --
165+
! -- why? because above amounts to taking lagged differences in climatologies, which can lead to unphysical values.
166+
! -- easier to start with ice, since we dont't know "good" bounds for sst.
167+
! first ice
168+
where (ice < 0.d0)
169+
ice = 0.0d0
170+
! second sst
171+
! if sst < (273.15-1.8d0) ! 273.15-1.8d0 = T_f is sea water freezing temperature in K
172+
! sst = what temperature? ! don't know where to melt! So leave it as is (for now).
173+
! else
174+
! ok
175+
! endif
176+
end where
177+
178+
where (ice > 1.d0)
179+
ice = 1.0d0
180+
! second sst
181+
where ( sst > T_f)
182+
sst = T_f
183+
endwhere
184+
end where
185+
!
186+
! min and max sst for = ?? again, we dont't know "good" bounds!
187+
! -- alternatively, one could apply thresholds on anomalies, but that needs careful work -- later, if and when possible.
188+
!
161189
else
162190
sst = sst0; ice = ice0 ! forecast day-1: just write out the same field(s).
163191
anom_sst0 = sst0 - sst_daily_clim

pre/remap_restart/remap_utils.py

Lines changed: 32 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)
@@ -203,7 +203,7 @@ def fvcore_info(x):
203203
files = glob.glob(rst_dir+'/*fvcore_internal*'+time+'*')
204204
fname = files[0]
205205

206-
if len(files) == 1:
206+
if len(files) == 1:
207207
fname = files[0]
208208

209209
fvrst = nc.Dataset(fname)
@@ -265,7 +265,7 @@ def catch_model(x):
265265

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

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

283283
agrid = config['input']['shared']['agrid']
@@ -296,9 +296,9 @@ def get_label(config):
296296

297297
# NOTE: "wemin" is a configurable parameter that can be set to anything, independent
298298
# of the bcs version. The default set here is simply the "wemin" value that is
299-
# typically used with the bcs version. The user needs to confirm the default
300-
# value or overwrite it with the "wemin" value used in the simulation that is
301-
# associated with the given set of restarts.
299+
# typically used with the bcs version. The user needs to confirm the default
300+
# value or overwrite it with the "wemin" value used in the simulation that is
301+
# associated with the given set of restarts.
302302
def wemin_default(bc_version):
303303
default_ = '13'
304304
if bc_version =='GM4' or bc_version == 'ICA' : default_ = '26'
@@ -378,24 +378,24 @@ def print_config( config, indent = 0 ):
378378

379379
def get_command_line_from_answers(answers):
380380

381-
merra2 = " -merra2 " if answers["input:shared:MERRA-2"] else ""
382-
ymdh = " -ymdh " + answers["input:shared:yyyymmddhh"]
383-
rst_dir = " -rst_dir " + answers["input:shared:rst_dir"]
381+
merra2 = " -merra2 " if answers["input:shared:MERRA-2"] else ""
382+
ymdh = " -ymdh " + answers["input:shared:yyyymmddhh"]
383+
rst_dir = " -rst_dir " + answers["input:shared:rst_dir"]
384384

385-
grout = ' -grout ' + answers["output:shared:agrid"]
386-
levsout = ' -levsout ' + answers["output:air:nlevel"]
385+
grout = ' -grout ' + answers["output:shared:agrid"]
386+
levsout = ' -levsout ' + answers["output:air:nlevel"]
387387

388388
out_dir = ' -out_dir ' + answers["output:shared:out_dir"]
389-
newid = answers["output:shared:expid"]
390-
389+
newid = answers["output:shared:expid"]
390+
391391
out_newid=''
392392
if newid.strip():
393393
out_newid = " -newid " + newid
394394

395395
bcvin = ''
396396
if answers.get("input:shared:bc_version"):
397-
bcvin = " -bcvin " + answers["input:shared:bc_version"]
398-
bcvout = " -bcvout " + answers["output:shared:bc_version"]
397+
bcvin = " -bcvin " + answers["input:shared:bc_version"]
398+
bcvout = " -bcvout " + answers["output:shared:bc_version"]
399399

400400
ocnmdlin = '-ocnmdlin data'
401401
if answers.get("input:shared:omodel"):
@@ -416,21 +416,20 @@ def get_command_line_from_answers(answers):
416416
if ogrid[0] == 'C':
417417
ogrid = "CS"
418418
oceanout = ' -oceanout ' + ogrid
419-
419+
420420
nobkg = '' if answers["output:analysis:bkg"] else " -nobkg "
421421
nolcv = '' if answers["output:analysis:lcv"] else " -nolcv "
422422
nonhydrostatic = '' if answers["input:air:hydrostatic"] else " -nonhydrostatic "
423-
424423
label = ' -lbl ' if answers["output:shared:label"] else ""
425-
424+
426425
in_bc_base = ' -in_bc_base ' + answers.get("input:shared:bc_base")
427426
out_bc_base = ' -out_bc_base ' + answers.get("output:shared:bc_base")
428427

429428
out_stretch = ''
430-
if answers["output:shared:stretch"]:
429+
if answers["output:shared:stretch"]:
431430
out_stretch = ' -out_stretch ' + answers["output:shared:stretch"]
432431
in_stretch = ''
433-
if answers["input:shared:stretch"]:
432+
if answers["input:shared:stretch"]:
434433
in_stretch = ' -in_stretch ' + answers["input:shared:stretch"]
435434

436435
zoom = " -zoom " + answers["input:surface:zoom"]
@@ -440,7 +439,7 @@ def get_command_line_from_answers(answers):
440439
if answers.get("input:surface:catch_model"):
441440
catch_model = " -catch_model " + answers["input:surface:catch_model"]
442441

443-
out_rs = " -rs "
442+
out_rs = " -rs "
444443
rs = 3
445444
if answers['output:air:remap'] and not answers['output:surface:remap_catch']:
446445
rs = 1
@@ -489,7 +488,7 @@ def get_command_line_from_answers(answers):
489488
qos + \
490489
partition
491490

492-
491+
493492
return cmdl
494493

495494
def flatten_nested(nested_dict, result=None, prefix=''):
@@ -516,7 +515,7 @@ def get_config_from_answers(answers, config_tpl = False):
516515
if config_tpl:
517516
remap_tpl = os.path.dirname(os.path.realpath(__file__)) + '/remap_params.tpl'
518517
config = get_config_from_file(remap_tpl)
519-
else:
518+
else:
520519
config['input'] = {}
521520
config['input']['air'] = {}
522521
config['input']['shared'] = {}
@@ -549,7 +548,7 @@ def get_resolutions(agrid=None, ogrid=None, omodel=None, stretch=None, grid=None
549548
if (agrid[0].upper() == 'C'):
550549
n = int(agrid[1:])
551550
aname ='CF{:04d}x6C'.format(n)
552-
551+
553552
if (ogrid[0].upper() == 'C'):
554553
oname = aname
555554
else:
@@ -566,7 +565,7 @@ def get_resolutions(agrid=None, ogrid=None, omodel=None, stretch=None, grid=None
566565
aname = aname + '-' + stretch
567566

568567
resolutions = aname +'_' + oname
569-
568+
570569
return resolutions
571570

572571
def get_default_bc_base():

0 commit comments

Comments
 (0)