@@ -1011,7 +1011,7 @@ def prep_iofiles():
1011
1011
d ['ozone' ] = dict2str ('{stdat}/{cmip}/{rcp}/vmro3_input4MIPs_ozone_ScenarioMIP_UReading-CCMI-{rcp}-1-0_gn_205001-209912.nc' )
1012
1012
else :
1013
1013
print ("ERROR: Unknown cmip option" )
1014
- sys .exit (1 )
1014
+ sys .exit (1 )
1015
1015
# Check ozone file exisits
1016
1016
check_file_exists (d ['ozone' ])
1017
1017
@@ -1176,12 +1176,21 @@ def config_initconds():
1176
1176
cname = newpath + ".000000"
1177
1177
if not os .path .exists (cname ):
1178
1178
raise ValueError (dict2str ('Cannot locate file {bcdir}/{mesonest}' ))
1179
+ # update calendar
1179
1180
if d ['leap' ] == "auto" :
1180
1181
d ['leap' ] = check_calendar_in_file (cname , d ['leap' ])
1181
1182
if d ['leap' ] == "auto" :
1182
1183
print ('Check calendar in ' ,cname )
1183
1184
raise ValueError ("ERROR: Cannot assign calendar for leap=auto" )
1184
1185
print (dict2str ('Assign calendar {leap}' ))
1186
+ # check match with emission scenario
1187
+ gendata = check_attributevalue_in_file (cname , 'driving_experiment_name' )
1188
+ if gendata != "" :
1189
+ if gendata != d ['rcp' ]:
1190
+ print ("ERROR: Mismatch between host dataset and specified emission scenario" )
1191
+ print ("mesonest " + gendata )
1192
+ print ("script " + d ['rcp' ])
1193
+ sys .exit (1 )
1185
1194
1186
1195
# prepare ifile
1187
1196
fname = d ['ifile' ]
@@ -2318,7 +2327,9 @@ def check_attribute_in_file(fname, vname, aname, vdata):
2318
2327
def check_timestep_in_file (fname ):
2319
2328
"Checks the time-step in output file"
2320
2329
2321
- timestep = subprocess .getoutput ('ncdump -c ' + fname + ' | grep time | tail -1 | cut -d= -f2 | cut -d, -f2' )
2330
+ timestep = subprocess .getoutput ('ncdump -c ' + fname + ' | grep time | tail -1 | cut -d= -f2 | cut -d, -f1' )
2331
+ if timestep == 0 :
2332
+ timestep = subprocess .getoutput ('ncdump -c ' + fname + ' | grep time | tail -1 | cut -d= -f2 | cut -d, -f2' )
2322
2333
return timestep
2323
2334
2324
2335
@@ -2368,23 +2379,31 @@ def calc_drs_host(fname):
2368
2379
d ['drs_host_name' ] = "error"
2369
2380
d ['drs_host_institution' ] = "error"
2370
2381
2371
- driving_model_id_test = subprocess . getoutput ( 'ncdump -c ' + fname + ' | grep driving_model_id | cut -d \" -f2 ' )
2382
+ driving_model_id_test = check_attributevalue_in_file ( fname , ' driving_model_id' )
2372
2383
if driving_model_id_test != "" :
2373
2384
d ['drs_host_name' ] = driving_model_id_test
2374
2385
2375
- driving_model_ensemble_number_test = subprocess . getoutput ( 'ncdump -c ' + fname + ' | grep driving_model_ensemble_number | cut -d \" -f2 ' )
2386
+ driving_model_ensemble_number_test = check_attributevalue_in_file ( fname , ' driving_model_ensemble_number' )
2376
2387
if driving_model_ensemble_number_test != "" :
2377
2388
d ['drs_host_ensemble' ] = driving_model_ensemble_number_test
2378
2389
2379
- driving_experiment_name_test = subprocess . getoutput ( 'ncdump -c ' + fname + ' | grep driving_experiment_name | cut -d \" -f2 ' )
2390
+ driving_experiment_name_test = check_attributevalue_in_file ( fname , ' driving_experiment_name' )
2380
2391
if driving_experiment_name_test != "" :
2381
2392
d ['drs_host_scenario' ] = driving_experiment_name_test
2382
2393
2383
- driving_institution_id_test = subprocess . getoutput ( 'ncdump -c ' + fname + ' | grep driving_institution_id | cut -d \" -f2 ' )
2394
+ driving_institution_id_test = check_attributevalue_in_file ( fname , ' driving_institution_id' )
2384
2395
if driving_institution_id_test != "" :
2385
2396
d ['drs_host_institution' ] = driving_institution_id_test
2386
2397
2387
2398
2399
+ def check_attributevalue_in_file (fname , attname ):
2400
+ "Return value of attribute"
2401
+
2402
+ attdata = subprocess .getoutput ('ncdump -c ' + fname + ' | grep ' + attname + ' | cut -d\\ " -f2' )
2403
+ print (attdata )
2404
+ return attdata
2405
+
2406
+
2388
2407
#===============================================================================
2389
2408
# Namelist templates
2390
2409
#===============================================================================
@@ -2669,7 +2688,7 @@ def input_template_c2014():
2669
2688
nevapls=0 ncloud={ncloud} tiedtke_form=1 acon={acon} bcon={bcon}
2670
2689
rcrit_l={rcrit_l} rcrit_s={rcrit_s}
2671
2690
lin_aerosolmode={lin_aerosolmode} lin_adv=1
2672
- qlg_max=1.e-3 qfg_max=1.e-3
2691
+ qlg_max=1.e-5 qfg_max=1.e-5
2673
2692
&end
2674
2693
"""
2675
2694
@@ -2695,7 +2714,7 @@ def input_template_c2015a():
2695
2714
nevapls=0 ncloud={ncloud} tiedtke_form=1 acon={acon} bcon={bcon}
2696
2715
rcrit_l={rcrit_l} rcrit_s={rcrit_s}
2697
2716
lin_aerosolmode={lin_aerosolmode} lin_adv=1
2698
- qlg_max=1.e-3 qfg_max=1.e-3
2717
+ qlg_max=1.e-5 qfg_max=1.e-5
2699
2718
&end
2700
2719
"""
2701
2720
@@ -2721,7 +2740,7 @@ def input_template_c2015m():
2721
2740
nevapls=0 ncloud={ncloud} tiedtke_form=1 acon={acon} bcon={bcon}
2722
2741
rcrit_l={rcrit_l} rcrit_s={rcrit_s}
2723
2742
lin_aerosolmode={lin_aerosolmode} lin_adv=1
2724
- qlg_max=1.e-3 qfg_max=1.e-3
2743
+ qlg_max=1.e-5 qfg_max=1.e-5
2725
2744
&end
2726
2745
"""
2727
2746
@@ -2741,7 +2760,7 @@ def input_template_c2015b():
2741
2760
nevapls=0 ncloud={ncloud} tiedtke_form=1 acon={acon} bcon={bcon}
2742
2761
rcrit_l={rcrit_l} rcrit_s={rcrit_s}
2743
2762
lin_aerosolmode={lin_aerosolmode} lin_adv=1
2744
- qlg_max=1.e-3 qfg_max=1.e-3
2763
+ qlg_max=1.e-5 qfg_max=1.e-5
2745
2764
&end
2746
2765
"""
2747
2766
@@ -2762,7 +2781,7 @@ def input_template_c2017():
2762
2781
nevapls=0 ncloud={ncloud} tiedtke_form=1 acon={acon} bcon={bcon}
2763
2782
rcrit_l={rcrit_l} rcrit_s={rcrit_s}
2764
2783
lin_aerosolmode={lin_aerosolmode} lin_adv=1
2765
- qlg_max=1.e-3 qfg_max=1.e-3
2784
+ qlg_max=1.e-5 qfg_max=1.e-5
2766
2785
&end
2767
2786
"""
2768
2787
@@ -2788,7 +2807,7 @@ def input_template_c2021():
2788
2807
nevapls=-4 ncloud={ncloud} tiedtke_form=1 acon={acon} bcon={bcon}
2789
2808
rcrit_l={rcrit_l} rcrit_s={rcrit_s}
2790
2809
lin_aerosolmode={lin_aerosolmode} lin_adv=1
2791
- qlg_max=1.e-3 qfg_max=1.e-3
2810
+ qlg_max=1.e-5 qfg_max=1.e-5
2792
2811
&end
2793
2812
"""
2794
2813
@@ -2802,7 +2821,7 @@ def input_template_grell():
2802
2821
nevapls=0 ncloud={ncloud} tiedtke_form=1 acon={acon} bcon={bcon}
2803
2822
rcrit_l={rcrit_l} rcrit_s={rcrit_s}
2804
2823
lin_aerosolmode={lin_aerosolmode} lin_adv=1
2805
- qlg_max=1.e-3 qfg_max=1.e-3
2824
+ qlg_max=1.e-5 qfg_max=1.e-5
2806
2825
&end
2807
2826
"""
2808
2827
0 commit comments