forked from dmricciuto/OLMT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathruncase.py
executable file
·1667 lines (1526 loc) · 66.5 KB
/
runcase.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env python
import netcdf4_functions as nffun
import socket, os, sys, csv, time, math, numpy
import re, subprocess
from optparse import OptionParser
#from Numeric import *
#runcase.py does the following:
#
# 1. Call routines to create surface and domain data (makepointdata.py)
# 2. Use create_newcase to build the new case with specified options
# 3. Set point and case-epecific namelist options
# 4. configure case
# 5. build (compile) ACME with clean_build first if requested
# 6. apply user-specified PBS and submit information
# 7. submit single run or parameter ensemble job to PBS queue.
#
#-------------------Parse options-----------------------------------------------
parser = OptionParser()
parser.add_option("--caseidprefix", dest="mycaseid", default="", \
help="Unique identifier to include as a prefix to the case name")
parser.add_option("--caseroot", dest="caseroot", default='', \
help = "case root directory (default = ./, i.e., under scripts/)")
parser.add_option("--dailyrunoff", dest="dailyrunoff", default=False, \
action="store_true", help="Write daily output for hydrology")
parser.add_option("--diags", dest="diags", default=False, \
action="store_true", help="Write special outputs for diagnostics")
parser.add_option("--debugq", dest="debug", default=False, \
action="store_true", help='Use debug queue')
parser.add_option("--runroot", dest="runroot", default="", \
help="Directory where the run would be created")
parser.add_option('--project', dest='project',default='', \
help='Set project')
parser.add_option("--exeroot", dest="exeroot", default="", \
help="Location of executable")
parser.add_option("--lat_bounds", dest="lat_bounds", default='-999,-999', \
help = 'latitude range for regional run')
parser.add_option("--lon_bounds", dest="lon_bounds", default='-999,-999', \
help = 'longitude range for regional run')
parser.add_option("--humhol", dest="humhol", default=False, \
help = 'Use hummock/hollow microtopography', action="store_true")
parser.add_option("--mask", dest="mymask", default='', \
help = 'Mask file to use (regional only)')
parser.add_option("--model", dest="mymodel", default='', \
help = 'Model to use (ELM,CLM5)')
parser.add_option("--monthly_metdata", dest="monthly_metdata", default = '', \
help = "File containing met data (cpl_bypass only)")
parser.add_option("--namelist_file", dest="namelist_file", default='', \
help="File containing custom namelist options for user_nl_clm")
parser.add_option("--ilambvars", dest="ilambvars", default=False, \
action="store_true", help="Write special outputs for diagnostics")
parser.add_option("--dailyvars", dest="dailyvars", default=False, \
action="store_true", help="Write daily ouptut variables")
parser.add_option("--res", dest="res", default="CLM_USRDAT", \
help='Resoultion for global simulation')
parser.add_option("--point_list", dest="point_list", default='', \
help = 'File containing list of points to run')
parser.add_option("--pft", dest="mypft", default=-1, \
help = 'Use this PFT for all gridcells')
parser.add_option("--site_forcing", dest="site_forcing", default='', \
help = '6-character FLUXNET code for forcing data')
parser.add_option("--site", dest="site", default='', \
help = '6-character FLUXNET code to run (required)')
parser.add_option("--sitegroup", dest="sitegroup", default="AmeriFlux", \
help = "site group to use (default AmeriFlux)")
parser.add_option("--coldstart", dest="coldstart", default=False, \
help = "set cold start (mutually exclusive w/finidat)", \
action="store_true")
parser.add_option("--compset", dest="compset", default='I1850CNPRDCTCBC', \
help = "component set to use (required)\n"
"Currently supports ONLY *CLM45(CN) compsets")
parser.add_option("--cruncep", dest="cruncep", default=False, \
help = "use cru-ncep data", action="store_true")
parser.add_option("--cruncepv8", dest="cruncepv8", default=False, \
help = "use cru-ncep data", action="store_true")
parser.add_option("--cplhist", dest="cplhist", default=False, \
help= "use CPLHIST forcing", action="store_true")
parser.add_option("--gswp3", dest="gswp3", default=False, \
help= "use GSWP3 forcing", action="store_true")
parser.add_option("--princeton", dest="princeton", default=False, \
help= "use Princecton forcing", action="store_true")
parser.add_option("--livneh", dest="livneh", default=False, \
action="store_true", help = "Livneh correction to CRU precip (CONUS only)")
parser.add_option("--daymet", dest="daymet", default=False, \
action="store_true", help = "Daymet correction to GSWP3 precip (CONUS only)")
parser.add_option("--machine", dest="machine", default = '', \
help = "machine to\n")
parser.add_option("--compiler", dest="compiler", default='', \
help = "compiler to use (pgi, gnu)")
parser.add_option("--mpilib", dest="mpilib", default="mpi-serial", \
help = "mpi library (openmpi*, mpich, ibm, mpi-serial)")
parser.add_option("--ad_spinup", action="store_true", \
dest="ad_spinup", default=False, \
help = 'Run accelerated decomposition spinup')
parser.add_option("--exit_spinup", action="store_true", \
dest="exit_spinup", default=False, \
help = 'Run exit spinup (CLM 4.0 only)')
parser.add_option("--model_root", dest="csmdir", default='', \
help = "base model directory")
parser.add_option("--ccsm_input", dest="ccsm_input", default='', \
help = "input data directory for CESM (required)")
parser.add_option("--finidat_case", dest="finidat_case", default='', \
help = "case containing initial data file to use" \
+" (should be in your run directory)")
parser.add_option("--finidat", dest="finidat", default='', \
help = "initial data file to use" \
+" (should be in your run directory)")
parser.add_option("--finidat_year", dest="finidat_year", default=-1, \
help = "model year of initial data file (default is" \
+" last available)")
parser.add_option("--run_units", dest="run_units", default='nyears', \
help = "run length units (ndays, nyears)")
parser.add_option("--run_n", dest="run_n", default=50, \
help = "run length (in run units)")
parser.add_option("--rest_n", dest="rest_n", default=-1, \
help = "restart interval (in run units)")
parser.add_option("--run_startyear", dest="run_startyear",default=-1, \
help='Starting year for model output')
parser.add_option("--rmold", dest="rmold", default=False, action="store_true", \
help = 'Remove old case directory with same name' \
+" before proceeding")
parser.add_option("--srcmods_loc", dest="srcmods_loc", default='', \
help = 'Copy sourcemods from this location')
parser.add_option("--parm_file", dest="parm_file", default='',
help = 'file for parameter modifications')
parser.add_option("--parm_vals", dest="parm_vals", default="", \
help = 'User specified parameter values')
parser.add_option("--parm_file_P", dest="parm_file_P", default='',
help = 'file for P parameter modifications')
parser.add_option("--hist_mfilt", dest="hist_mfilt", default=-1, \
help = 'number of output timesteps per file')
parser.add_option("--hist_nhtfrq", dest="hist_nhtfrq", default=-999, \
help = 'output file timestep')
parser.add_option("--hist_vars", dest="hist_vars", default='', \
help = 'use hist_vars file')
#parser.add_option("--queue", dest="queue", default='essg08q', \
# help = 'PBS submission queue')
parser.add_option("--clean_config", dest="clean_config", default=False, \
help = 'Run cesm_setup -clean script')
parser.add_option("--clean_build", dest="clean_build", default=False, \
help = 'Perform clean build before building', \
action="store_true")
parser.add_option("--no_config", dest="no_config", default=False, \
help = 'do NOT configure case', action="store_true")
parser.add_option("--no_build", dest="no_build", default=False, \
help = 'do NOT build CESM', action="store_true")
parser.add_option("--no_submit", dest="no_submit", default=True, \
help = 'do NOT submit CESM to queue', action="store_true")
parser.add_option("--align_year", dest="align_year", default=-999, \
help = 'Alignment year (transient run only)')
parser.add_option("--np", dest="np", default=1, \
help = 'number of processors')
parser.add_option("--ninst", dest="ninst", default=1, \
help = 'number of land model instances')
parser.add_option("--ng", dest="ng", default=64, \
help = 'number of groups to run in ensmble mode')
parser.add_option("--tstep", dest="tstep", default=0.5, \
help = 'CLM timestep (hours)')
parser.add_option("--co2_file", dest="co2_file", default="fco2_datm_rcp4.5_1765-2500_c130312.nc", \
help = 'CLM timestep (hours)')
parser.add_option("--nyears_ad_spinup", dest="ny_ad", default=250, \
help = 'number of years to run ad_spinup')
parser.add_option("--metdir", dest="metdir", default="none", \
help = 'subdirectory for met data forcing')
parser.add_option("--nopointdata", action="store_true", \
dest="nopointdata", help="Do NOT make point data (use data already created)", \
default=False)
#parser.add_option("--cleanlogs",dest="cleanlogs", help=\
# "Removes temporary and log files that are created",\
# default=False,action="store_true")
parser.add_option("--nofire", action="store_true", dest="nofire", default=False, \
help="To turn off wildfires")
parser.add_option("--nopftdyn", action="store_true", dest="nopftdyn", \
default = False, help='Do not use dynamic PFT file')
parser.add_option("--harvmod", action="store_true", dest="harvmod", \
default=False, help = "Turn on harvest modificaton" \
"All harvest is performed in first timestep")
parser.add_option("--no_dynroot", dest="no_dynroot", default=False, \
help = 'Turn off dynamic root distribution', action="store_true")
parser.add_option("--bulk_denitrif", dest="bulk_denitrif", default=False, \
help = 'To turn off BGC nitrification-denitrification', action="store_true")
parser.add_option("--vertsoilc", dest="vsoilc", default=False, \
help = 'To turn on CN with multiple soil layers, excluding CENTURY C module (CLM4ME on as well)', action="store_true")
parser.add_option("--centbgc", dest="centbgc", default=False, \
help = 'To turn on CN with multiple soil layers, CENTURY C module (CLM4ME on as well)', action="store_true")
parser.add_option("--CH4", dest="CH4", default=False, \
help = 'To turn on CN with CLM4me', action="store_true")
parser.add_option("--1850_ndep", dest="ndep1850", default=False, \
help = 'Use constant 1850 N deposition', action="store_true")
parser.add_option("--1850_aero", dest="aero1850", default=False, \
help = 'Use constant 1850 aerosol deposition', action="store_true")
parser.add_option("--1850_co2", dest="co21850", default=False, \
help = 'Use constant 1850 CO2 concentration', action="store_true")
parser.add_option("--C13", dest="C13", default=False, \
help = 'Switch to turn on C13', action="store_true")
parser.add_option("--C14", dest="C14", default=False, \
help = 'Use C14 as C13 (no decay)', action="store_true")
parser.add_option("--branch", dest="branch", default=False, \
help = 'Switch for branch run', action="store_true")
parser.add_option("--makemetdata", dest="makemet", default=False, \
help = 'Generate meteorology', action="store_true")
parser.add_option("--surfdata_grid", dest="surfdata_grid", default=False, \
help = 'Use gridded surface data instead of site data', action="store_true")
parser.add_option("--include_nonveg", dest="include_nonveg", default=False, \
help = 'Include non-vegetated columns/Landunits in surface data')
parser.add_option("--trans2", dest="trans2", default=False, action="store_true", \
help = 'Tranisnent phase 2 (1901-2010) - CRUNCEP only')
parser.add_option("--spinup_vars", dest="spinup_vars", default=False, \
help = 'Limit output vars in spinup runs', action="store_true")
parser.add_option("--trans_varlist", dest = "trans_varlist", default='', help = "Transient outputs")
parser.add_option("--c_only", dest="c_only", default=False, \
help="Carbon only (supplemental P and N)", action="store_true")
parser.add_option("--cn_only", dest="cn_only", default=False, \
help = 'Carbon/Nitrogen only (supplemental P)', action="store_true")
parser.add_option("--cp_only", dest="cp_only", default=False, \
help = 'Carbon/Phosphorus only (supplemental N)', action = "store_true")
parser.add_option("--ensemble_file", dest="ensemble_file", default='', \
help = 'Parameter sample file to generate ensemble')
parser.add_option("--mc_ensemble", dest="mc_ensemble", default=-1, \
help = 'Monte Carlo ensemble (argument is # of simulations)')
parser.add_option("--ensemble_nocopy", dest="ensemble_nocopy", default=False, \
help = 'Do not copy files to ensemble directories', action="store_true")
parser.add_option("--surffile", dest="surffile", default="", \
help = 'Surface file to use')
parser.add_option("--domainfile", dest="domainfile", default="", \
help = 'Domain file to use')
parser.add_option("--fates_hydro", dest="fates_hydro", default=False, action="store_true", \
help = 'Set fates hydro to true')
parser.add_option("--fates_paramfile", dest="fates_paramfile", default="", \
help = 'Fates parameter file to use')
parser.add_option("--add_temperature", dest="addt", default=0.0, \
help = 'Temperature to add to atmospheric forcing')
parser.add_option("--add_co2", dest="addco2", default=0.0, \
help = 'CO2 (ppmv) to add to atmospheric forcing')
parser.add_option("--startdate_add_temperature", dest="sd_addt", default="99991231", \
help = 'Date (YYYYMMDD) to begin addding temperature')
parser.add_option("--startdate_add_co2", dest="sd_addco2", default="99991231", \
help = 'Date (YYYYMMDD) to begin addding CO2')
#Changed by Ming for mesabi
parser.add_option("--archiveroot", dest="archiveroot", default='', \
help = "archive root directory only for mesabi")
#Added by Kirk to include the modified parameter file
parser.add_option("--mod_parm_file", dest="mod_parm_file", default='', \
help = "adding the path to the modified parameter file")
parser.add_option("--mod_parm_file_P", dest="mod_parm_file_P", default='', \
help = "adding the path to the modified parameter file")
parser.add_option("--parm_list", dest="parm_list", default='parm_list', \
help = 'File containing list of parameters to vary')
parser.add_option("--postproc_file", dest="postproc_file", default="", \
help = 'File for ensemble post processing')
parser.add_option("--walltime", dest="walltime", default=6, \
help = "desired walltime for each job (hours)")
parser.add_option("--lai", dest="lai", default=-999, \
help = 'Set constant LAI (SP mode only)')
#Added to control gpu compiler flags
parser.add_option("--pgi_acc", dest="pgi_acc", default=False, \
help="compile pgi openACC to target gpu", action="store_true")
(options, args) = parser.parse_args()
#-------------------------------------------------------------------------------
#Set default model root
if (options.csmdir == ''):
if (os.path.exists('../E3SM')):
options.csmdir = os.path.abspath('../E3SM')
print('Model root not specified. Defaulting to '+options.csmdir)
else:
print('Error: Model root not specified. Please set using --model_root')
sys.exit(1)
elif (not os.path.exists(options.csmdir)):
print('Error: Model root '+options.csmdir+' does not exist.')
sys.exit(1)
#machine info: cores per node
ppn=1
if ('titan' in options.machine):
ppn=16
if (int(options.walltime) > 2 and int(options.ng) < 2048):
print('Requested walltime too long')
print('Setting to 2 hours.')
options.walltime=2
elif ('metis' in options.machine):
ppn=16
elif ('oic2' in options.machine):
ppn=8
elif ('oic5' in options.machine or 'cori-haswell' in options.machine or 'eos' in options.machine \
or 'cades' in options.machine):
ppn=32
elif ('cori-knl' in options.machine):
ppn=64
elif ('edison' in options.machine):
ppn=24
elif ('anvil' in options.machine):
ppn=36
elif ('compy' in options.machine):
ppn=40
PTCLMdir = os.getcwd()
if (options.hist_vars != ''):
hist_vars = os.path.abspath(options.hist_vars)
#set model if not specified
if (options.mymodel == ''):
if ('clm5' in options.csmdir):
options.mymodel = 'CLM5'
elif ('E3SM' in options.csmdir or 'ACME' in options.csmdir):
options.mymodel = 'ELM'
else:
print('Error: Model not specified')
sys.exit(1)
#check for valid csm directory
if (os.path.exists(options.csmdir) == False):
print('Error: invalid model root directory. Please specify with --model_root')
sys.exit(1)
else:
csmdir = options.csmdir
scriptsdir = csmdir+'/cime/scripts'
#case directory
if (options.caseroot == '' or (os.path.exists(options.caseroot) == False)):
caseroot = csmdir+'/cime/scripts'
else:
caseroot = os.path.abspath(options.caseroot)
#case run root directory
runroot = os.path.abspath(options.runroot)
#check for valid input data directory
if (options.ccsm_input == '' or (os.path.exists(options.ccsm_input) \
== False)):
print('Error: invalid input data directory')
sys.exit(1)
else:
options.ccsm_input = os.path.abspath(options.ccsm_input)
compset = options.compset
isglobal = False
if (options.site == ''):
isglobal = True
options.site=options.res
if ('CBCN' in compset or 'ICB' in compset or 'CLM45CB' in compset):
cpl_bypass = True
else:
cpl_bypass = False
surfdir = 'surfdata_map'
if (options.mymodel == 'ELM'):
if ('ECA' in compset):
parm_file = 'clm_params.c160709.nc'
else:
parm_file = 'clm_params_c180524.nc'
if (options.mymodel == 'CLM5'):
parm_file = 'clm5_params.c171117.nc'
#pftphys_stamp = '_c160711' #'c160711_root'
#pftphys_stamp = '_c160711_test170303'
#CNPstamp = 'c131108'
CNPstamp = 'c180529'
#check consistency of options
if ('20TR' in compset):
#ignore spinup option if transient compset
if (options.ad_spinup or options.exit_spinup):
print('Spinup options not available for transient compset.')
sys.exit(1)
#finidat is required for transient compset
if (options.finidat_case == '' and options.finidat == ''):
print('Error: must provide initial data file for I20TR compsets')
sys.exit(1)
#get full path of finidat file
finidat=''
finidat_year=int(options.finidat_year)
if ('CN' in compset or 'ECA' in compset):
mybgc = 'CN'
elif ('ED' in compset):
mybgc = 'ED'
else:
mybgc = 'none'
if (options.exit_spinup):
if (options.mycaseid != ''):
finidat = options.mycaseid+'_'+options.site+'_I1850'+mybgc+'_ad_spinup'
else:
finidat = options.site+'_I1850'+mybgc+'_ad_spinup'
finidat_year = int(options.ny_ad)+1
if (options.finidat == '' and options.finidat_case == ''): #not user-defined
if (options.coldstart==False and compset == "I1850CLM45"+mybgc and options.ad_spinup == False):
if (options.mycaseid != ''):
options.finidat_case = options.mycaseid+'_'+options.site+ \
'_I1850CLM45'+mybgc+'_ad_spinup'
else:
options.finidat_case = options.site+'_I1850CLM45'+mybgc+'_ad_spinup'
if (options.finidat_year == -1):
finidat_year = int(options.ny_ad)+1
if (compset == "I20TRCLM45"+mybgc or compset == "I20TRCRUCLM45"+mybgc):
if (options.mycaseid != ''):
options.finidat_case = options.mycaseid+'_'+options.site+ \
'_I1850CLM45'+mybgc
else:
options.finidat_case = options.site + '_I1850CLM45'+mybgc
if (options.finidat_year == -1):
finidat_year=1850
if (compset == "I20TR"+mybgc):
if (options.mycaseid != ''):
options.finidat_case = options.mycaseid+'_'+options.site+ \
'_I1850'+mybgc
else:
options.finidat_case = options.site + '_I1850'+mybgc
if (options.finidat_year == -1):
finidat_year = 1850
#finidat is required for transient compset
if (os.path.exists(runroot+'/'+options.finidat_case) == False):
print('Error: must provide initial data file for I20TRCLM45CN/BGC compset OR '+ \
runroot+'/'+options.finidat_case+' existed as refcase')
sys.exit(1)
if (options.finidat_case != ''):
finidat_yst = str(10000+finidat_year)
finidat = runroot+'/'+options.finidat_case+'/run/'+ \
options.finidat_case+'.clm2.r.'+finidat_yst[1:]+ \
'-01-01-00000.nc'
if (options.finidat != ''):
finidat = options.finidat
finidat_year = int(finidat[-19:-15])
finidat_yst = str(10000+finidat_year)
#construct default casename
casename = options.site+"_"+compset
if (options.mycaseid != ""):
casename = options.mycaseid+'_'+casename
#CRU-NCEP 2 transient phases
if ('CRU' in compset or options.cruncep or options.gswp3 or \
options.cruncepv8 or options.princeton or options.cplhist):
use_reanalysis = True
else:
use_reanalysis = False
if ('20TR' in compset and use_reanalysis and (not cpl_bypass)):
if options.trans2:
casename = casename+'_phase2'
else:
casename = casename+'_phase1'
if (options.ad_spinup):
casename = casename+'_ad_spinup'
if (options.exit_spinup):
casename = casename+'_exit_spinup'
PTCLMfiledir = options.ccsm_input+'/lnd/clm2/PTCLM'
if (caseroot != "./"):
casedir=caseroot+"/"+casename
else:
casedir=casename
print('Machine is: '+options.machine)
#Check for existing case directory
if (os.path.exists(casedir)):
print('Warning: Case directory exists')
if (options.rmold):
print('--rmold specified. Removing old case ')
os.system('rm -rf '+casedir)
else:
var = raw_input('proceed (p), remove old (r), or exit (x)? ')
if var[0] == 'r':
os.system('rm -rf '+casedir)
if var[0] == 'x':
sys.exit(1)
print("CASE directory is: "+casedir)
#Construct case build and run directory
if (options.exeroot == '' or (os.path.exists(options.exeroot) == False)):
exeroot = runroot+'/'+casename+'/bld'
#if ('titan' in options.machine or 'eos' in options.machine):
# exeroot = os.path.abspath(os.environ['HOME']+ \
# '/acme_scratch/pointclm/'+casename+'/bld')
else:
exeroot=options.exeroot
print("CASE exeroot is: "+exeroot)
rundir=runroot+'/'+casename+'/run'
print("CASE rundir is: "+rundir)
if (options.rmold):
if (options.no_build == False):
print('Removing build directory: '+exeroot)
os.system('rm -rf '+exeroot)
print('Removing run directory: '+rundir)
os.system('rm -rf '+rundir)
#------Make domain, surface data and pftdyn files ------------------
mysimyr=1850
if ('1850' not in compset and '20TR' not in compset):
mysimyr=2000
print("creating makepointdata command")
if (options.nopointdata == False):
ptcmd = 'python makepointdata.py --ccsm_input '+options.ccsm_input+ \
' --keep_duplicates --lat_bounds '+options.lat_bounds+' --lon_bounds '+ \
options.lon_bounds+' --mysimyr '+str(mysimyr)+' --model '+options.mymodel
if (options.metdir != 'none'):
ptcmd = ptcmd + ' --metdir '+options.metdir
if (options.makemet):
ptcmd = ptcmd + ' --makemetdata'
if (options.surfdata_grid):
ptcmd = ptcmd + ' --surfdata_grid'
if (options.include_nonveg):
ptcmd = ptcmd + ' --include_nonveg'
if (options.nopftdyn):
ptcmd = ptcmd + ' --nopftdyn'
if (options.mymask != ''):
ptcmd = ptcmd + ' --mask '+options.mymask
if (float(options.lai) > 0):
ptcmd = ptcmd + ' --lai '+str(options.lai)
if (int(options.mypft) >= 0):
ptcmd = ptcmd + ' --pft '+str(options.mypft)
if (isglobal):
ptcmd = ptcmd + ' --res '+options.res
if (options.point_list != ''):
ptcmd = ptcmd+' --point_list '+options.point_list
else:
ptcmd = ptcmd + ' --site '+options.site+' --sitegroup '+options.sitegroup
if (options.machine == 'eos' or options.machine == 'titan'):
os.system('rm temp/*.nc')
print('Note: NCO operations are slow on eos and titan.')
print('Submitting PBS script to make surface and domain data on rhea')
pbs_rhea=open('makepointdata_rhea.pbs','w')
pbs_rhea.write('#PBS -l walltime=00:30:00\n')
pbs_rhea.write('#PBS -l nodes=1\n')
pbs_rhea.write('#PBS -A cli112\n')
pbs_rhea.write('#PBS -q rhea\n')
pbs_rhea.write('#PBS -l gres=atlas1%atlas2\n\n')
pbs_rhea.write(' module load nco\n')
pbs_rhea.write(' cd '+os.getcwd()+'\n')
pbs_rhea.write(' rm temp/*.nc\n')
pbs_rhea.write(' module unload PE-intel\n')
pbs_rhea.write(' module load PE-gnu\n')
pbs_rhea.write(' module load python\n')
pbs_rhea.write(' module load python_numpy\n')
pbs_rhea.write(' module load python_scipy\n')
pbs_rhea.write(ptcmd+'\n')
pbs_rhea.close()
os.system('qsub makepointdata_rhea.pbs')
n_nc_files = 3
if (options.nopftdyn):
n_nc_files = 2
n=0
while (n < n_nc_files):
#Wait until files have been generated on rhea to proceed
list_dir = os.listdir('./temp')
n=0
for file in list_dir:
if file.endswith('.nc'):
n=n+1
os.system('sleep 10')
#Clean up
os.system('rm makepointdata_rhea*')
else:
print("ptcmd:")
print(ptcmd)
st = time.time()
result = os.system(ptcmd)
if (result > 0):
print ('PointCLM: Error creating point data. Aborting')
sys.exit(1)
sto = time.time()
print("time for makeptdata cmd:",sto-st,'secs')
#get site year information
sitedatadir = os.path.abspath(PTCLMfiledir)
if (options.machine == 'excl'):
os.chdir(sitedatadir+'/PTCLM_sitedata')
else:
os.chdir(sitedatadir)
print('current working directory is: '+os.getcwd() )
if (isglobal == False):
AFdatareader = csv.reader(open(options.sitegroup+'_sitedata.txt',"rb"))
for row in AFdatareader:
if row[0] == options.site:
if (use_reanalysis):
if ('CN' in compset or 'BGC' in compset):
if (options.trans2):
startyear = 1921
endyear = int(row[7])
else:
startyear = 1901
endyear = 1920
else:
startyear = int(row[6]) #1901
endyear = int(row[7])
else:
startyear=int(row[6])
endyear=int(row[7])
alignyear = int(row[8])
if (options.diags):
timezone = int(row[9])
if (options.humhol):
numxpts=2
else:
numxpts=1
numypts=1
else:
if (use_reanalysis):
startyear=1901
if ('20TR' in compset):
endyear = 2010
if (options.trans2):
startyear = 1921
else:
endyear = 1920
else: #Global default to Qian
startyear=1948
if ('20TR' in compset):
endyear = 2004
if (options.trans2):
startyear = 1973
else:
endyear = 1972
ptstr=''
if (isglobal == False):
ptstr = str(numxpts)+'x'+str(numypts)+'pt'
os.chdir(csmdir+'/cime/scripts')
#parameter (pft-phys) modifications if desired
tmpdir = PTCLMdir+'/temp'
if (options.mycaseid == ''):
myscriptsdir = 'none'
else:
myscriptsdir = options.mycaseid
os.system('mkdir -p '+tmpdir)
if (options.mod_parm_file != ''):
#os.system('nccopy -3 '+options.mod_parm_file+' '+tmpdir+'/clm_params.nc')
os.system('ncks -O -3 '+options.mod_parm_file+' '+tmpdir+'/clm_params.nc')
else:
#os.system('nccopy -3 '+options.ccsm_input+'/lnd/clm2/paramdata/'+parm_file+' ' \
# +tmpdir+'/clm_params.nc')
os.system('ncks -O -3 '+options.ccsm_input+'/lnd/clm2/paramdata/'+parm_file+' ' \
+tmpdir+'/clm_params.nc')
if (options.humhol):
print('Adding hummock-hollow parameters (default for SPRUCE site)')
print('humhol_ht = 0.15m')
print('hum_frac = 0.64')
print('humhol_dist = 1.0m')
print('qflx_h2osfc_surfrate = 1.0e-7')
print('setting rsub_top_globlmax = 1.2e-5')
myncap = 'ncap'
if ('compy' in options.machine):
myncap='ncap2'
os.system(myncap+' -O -s "humhol_ht = br_mr*0+0.15" '+tmpdir+'/clm_params.nc '+tmpdir+'/clm_params.nc')
os.system(myncap+' -O -s "hum_frac = br_mr*0+0.64" '+tmpdir+'/clm_params.nc '+tmpdir+'/clm_params.nc')
os.system(myncap+' -O -s "humhol_dist = br_mr*0+1.0" '+tmpdir+'/clm_params.nc '+tmpdir+'/clm_params.nc')
os.system(myncap+' -O -s "qflx_h2osfc_surfrate = br_mr*0+1.0e-7" '+tmpdir+'/clm_params.nc '+tmpdir+'/clm_params.nc')
os.system(myncap+' -O -s "rsub_top_globalmax = br_mr*0+1.2e-5" '+tmpdir+'/clm_params.nc '+tmpdir+'/clm_params.nc')
os.system('chmod u+w ' +tmpdir+'/clm_params.nc')
if (options.parm_file != ''):
pftfile = tmpdir+'/clm_params.nc'
if ('/' not in options.parm_file):
#assume in pointclm directory
input = open(PTCLMdir+'/'+options.parm_file)
else: #assume full path given
input = open(os.path.abspath(options.parm_file))
for s in input:
if s[0:1] != '#':
values = s.split()
thisvar = nffun.getvar(pftfile, values[0])
if (len(values) == 2):
thisvar[...] = float(values[1])
elif (len(values) == 3):
if (float(values[1]) > 0):
thisvar[int(values[1])] = float(values[2])
else:
thisvar[...] = float(values[2])
ierr = nffun.putvar(pftfile, values[0], thisvar)
input.close()
if (options.parm_vals != ''):
pftfile = tmpdir+'/clm_params.nc'
parms = options.parm_vals.split('/')
nparms = len(parms)
for n in range(0,nparms):
parm_data=parms[n].split(',')
thisvar = nffun.getvar(pftfile, parm_data[0])
if (len(parm_data) == 2):
thisvar[...] = float(parm_data[1])
elif (len(parm_data) == 3):
if (float(parm_data[1]) >= 0):
thisvar[int(parm_data[1])] = float(parm_data[2])
else:
thisvar[...] = float(parm_data[2])
ierr = nffun.putvar(pftfile, parm_data[0], thisvar)
#parameter (soil order dependent) modifications if desired ::X.YANG
if (options.mymodel == 'ELM'):
if (options.mod_parm_file_P != ''):
os.system('cp '+options.mod_parm_file_P+' '+tmpdir+'/CNP_parameters.nc')
else:
os.system('cp '+options.ccsm_input+'/lnd/clm2/paramdata/CNP_parameters_'+CNPstamp+'.nc ' \
+tmpdir+'/CNP_parameters.nc')
os.system('chmod u+w ' +tmpdir+'/CNP_parameters.nc')
if (options.parm_file_P != ''):
soilorderfile = tmpdir+'/CNP_parameters.nc'
if ('/' not in options.parm_file_P):
#assume in pointclm directory
input = open(PTCLMdir+'/'+options.parm_file_P)
else: #assume full path given
input = open(os.path.abspath(options.parm_file_P))
input = open(os.path.abspath(options.parm_file_P))
for s in input:
if s[0:1] != '#':
values = s.split()
thisvar = nffun.getvar(soilorderfile, values[0])
if (len(values) == 2):
thisvar[...] = float(values[1])
elif (len(values) == 3):
if (float(values[1]) >= 0):
thisvar[int(values[1])] = float(values[2])
else:
thisvar[...] = float(values[2])
ierr = nffun.putvar(soilorderfile, values[0], thisvar)
input.close()
#set number of run years for ad, exit spinup cases
if (options.ny_ad != options.run_n and options.ad_spinup):
options.run_n = options.ny_ad
elif (options.exit_spinup):
options.run_n = 1
#create new case
print("Create New Case")
cmd = './create_newcase --case '+casedir+' --mach '+options.machine+' --compset '+ \
options.compset+' --res '+options.res+' --mpilib '+ \
options.mpilib+' --walltime '+str(options.walltime)+ \
':00:00 '+'--handle-preexisting-dirs u'
if (options.mymodel == 'CLM5'):
cmd = cmd+' --run-unsupported'
if (options.project != ''):
cmd = cmd+' --project '+options.project
if (options.compiler != ''):
cmd = cmd+' --compiler '+options.compiler
cmd = cmd+' > create_newcase.log'
result = os.system(cmd)
if (os.path.isdir(casedir)):
print(casename+' created. See create_newcase.log for details')
os.system('mv create_newcase.log '+casename)
else:
print('Error: runcase.py Failed to create case. See create_newcase.log for details')
sys.exit(1)
os.chdir(casedir)
print ("Building the environment, chdir to " + casedir)
#env_build
result = os.system('./xmlchange SAVE_TIMING=FALSE')
result = os.system('./xmlchange EXEROOT='+exeroot)
if (options.mymodel == 'ELM'):
result = os.system('./xmlchange MOSART_MODE=NULL')
if (options.debug):
print("Turning on debug settings")
result = os.system('./xmlchange DEBUG=TRUE')
else:
print("no debug!")
result = os.system('./xmlchange DEBUG=FALSE')
#clm 4_5 cn config options
#clmcn_opts = "'-phys clm4_5 -cppdefs -DMODAL_AER'"
#if (options.mymodel == 'ELM'):
# os.system("./xmlchange CLM_CONFIG_OPTS="+clmcn_opts)
if (options.machine == 'userdefined'):
os.system("./xmlchange COMPILER="+options.compiler)
os.system("./xmlchange OS=linux")
os.system("./xmlchange EXEROOT="+runroot+'/'+casename+"/bld")
#-------------- env_run.xml modifications -------------------------
os.system('./xmlchange RUNDIR='+rundir)
os.system('./xmlchange DOUT_S=TRUE')
os.system('./xmlchange DOUT_S_ROOT='+runroot+'/archive/'+casename)
os.system('./xmlchange DIN_LOC_ROOT='+options.ccsm_input)
#define mask and resoultion
if (isglobal == False):
os.system('./xmlchange CLM_USRDAT_NAME='+str(numxpts)+'x'+str(numypts)+'pt_'+options.site)
if (options.ad_spinup):
if (options.mymodel == 'ELM'):
os.system("./xmlchange --append CLM_BLDNML_OPTS='-bgc_spinup on'")
elif (options.mymodel == 'CLM5'):
os.system('./xmlchange CLM_ACCELERATED_SPINUP=on')
os.system('./xmlchange CLM_FORCE_COLDSTART=on')
if (int(options.run_startyear) > -1):
os.system('./xmlchange RUN_STARTDATE='+str(options.run_startyear)+'-01-01')
print("Setting run start date to "+str(options.run_startyear)+'-01-01')
if (options.domainfile == ''):
os.system('./xmlchange ATM_DOMAIN_PATH="\${RUNDIR}"')
os.system('./xmlchange LND_DOMAIN_PATH="\${RUNDIR}"')
os.system('./xmlchange ATM_DOMAIN_FILE=domain.nc')
os.system('./xmlchange LND_DOMAIN_FILE=domain.nc')
else:
domainpath = '/'.join(options.domainfile.split('/')[:-1])
domainfile = options.domainfile.split('/')[-1]
os.system('./xmlchange ATM_DOMAIN_PATH='+domainpath)
os.system('./xmlchange LND_DOMAIN_PATH='+domainpath)
os.system('./xmlchange ATM_DOMAIN_FILE='+domainfile)
os.system('./xmlchange LND_DOMAIN_FILE='+domainfile)
#turn off archiving
os.system('./xmlchange DOUT_S=FALSE')
#datm options
if (not cpl_bypass):
if (use_reanalysis):
os.system('./xmlchange DATM_MODE=CLMCRUNCEP')
else:
if (isglobal == False):
os.system('./xmlchange DATM_MODE=CLM1PT')
os.system('./xmlchange DATM_CLMNCEP_YR_START='+str(startyear))
os.system('./xmlchange DATM_CLMNCEP_YR_END='+str(endyear))
if (options.align_year == -999):
os.system('./xmlchange DATM_CLMNCEP_YR_ALIGN=1')
else:
os.system('./xmlchange DATM_CLMNCEP_YR_ALIGN='+str(options.align_year))
#Change simulation timestep
if (options.tstep != 0.5):
os.system('./xmlchange ATM_NCPL='+str(int(24/float(options.tstep))))
#Branch run options
if (options.branch or options.exit_spinup):
os.system('./xmlchange RUN_TYPE=branch')
os.system('./xmlchange RUN_REFDATE='+finidat_yst[1:]+'-01-01')
os.system('./xmlchange RUN_REFCASE='+options.finidat_case)
else:
if (('CN' in compset or 'BGC' in compset) and options.ad_spinup \
== False and options.coldstart==False):
os.system('./xmlchange RUN_REFDATE='+finidat_yst[1:]+'-01-01')
#adds capability to run with transient CO2
if ('20TR' in compset):
os.system('./xmlchange CCSM_BGC=CO2A')
os.system('./xmlchange CLM_CO2_TYPE=diagnostic')
if (options.run_startyear == -1):
os.system('./xmlchange RUN_STARTDATE=1850-01-01')
#No pnetcdf for small cases on compy
if ('compy' in options.machine and int(options.np) < 80):
os.system('./xmlchange PIO_TYPENAME=netcdf')
#Ensure PIO_TYPENAME is netcdf not pnetcdf
if (options.machine == 'excl'):
os.system('./xmlchange PIO_TYPENAME=netcdf')
os.system('./xmlquery PIO_TYPENAME')
comps = ['ATM','LND','ICE','OCN','CPL','GLC','ROF','WAV']
for c in comps:
print('Setting NTASKS_'+c+' to '+str(options.np))
os.system('./xmlchange NTASKS_'+c+'='+str(options.np))
os.system('./xmlchange NTHRDS_'+c+'=1')
if (int(options.np) > 1):
os.system('./xmlchange MAX_TASKS_PER_NODE='+str(ppn))
os.system('./xmlchange MAX_MPITASKS_PER_NODE='+str(ppn))
if (int(options.ninst) > 1):
os.system('./xmlchange NINST_LND='+options.ninst)
os.system('./xmlchange NTASKS_LND='+options.ninst)
os.system('./xmlchange STOP_OPTION='+options.run_units)
os.system('./xmlchange STOP_N='+str(options.run_n))
if (options.rest_n > 0):
print('Setting REST_N to '+str(options.rest_n))
os.system('./xmlchange REST_N='+str(options.rest_n))
#--------------------------CESM setup ----------------------------------------
if (options.clean_config):
result = os.system('./case.setup -clean')
if (result > 0):
print('Error: PointCLM.py failed to setup case. Aborting')
sys.exit(1)
os.system('rm -f Macro')
os.system('rm -f user-nl-*')
# Add options for FFLAGS to Macros file here
#clm namelist modifications
for i in range(1,int(options.ninst)+1):
if (int(options.ninst) == 1):
output = open("user_nl_clm",'w')
else:
if (i < 10):
output = open("user_nl_clm_000"+str(i),'w')
elif (i < 100):
output = open("user_nl_clm_00"+str(i),'w')
elif (i < 1000):
output = open("user_nl_clm_0"+str(i),'w')
output.write('&clm_inparm\n')
if (options.namelist_file != ''):
#First assume located in OLMT folder:
if (os.path.isfile(PTCLMdir+'/'+options.namelist_file)):
namelist_in = open(PTCLMdir+'/'+options.namelist_file,'r')
elif (os.path.isfile(options.namelist_file)):
namelist_in = open(options.namelist_file,'r')
else:
print('Error: namelist_file does not exist. Aborting')
sys.exit(1)
for s in namelist_in:
output.write(s)
namelist_in.close()
#history file options
#outputs for SPRUCE MiP and Jiafu's diagnostics code:
var_list_hourly = ['GPP', 'NEE', 'NEP', 'NPP', 'LEAFC_ALLOC', 'AGNPP', 'MR', \
'CPOOL_TO_DEADSTEMC', 'LIVECROOTC_XFER_TO_LIVECROOTC', 'DEADCROOTC_XFER_TO_DEADCROOTC', \
'CPOOL_TO_LIVECROOTC', 'CPOOL_TO_DEADCROOTC', 'FROOTC_ALLOC', 'AR', 'LEAF_MR', 'CPOOL_LEAF_GR',
'TRANSFER_LEAF_GR', 'CPOOL_LEAF_STORAGE_GR', 'LIVESTEM_MR', 'CPOOL_LIVESTEM_GR', \
'TRANSFER_LIVESTEM_GR', 'CPOOL_LIVESTEM_STORAGE_GR', 'CPOOL_DEADSTEM_GR', \
'TRANSFER_DEADSTEM_GR', 'CPOOL_DEADSTEM_STORAGE_GR', 'LIVECROOT_MR', 'CPOOL_LIVECROOT_GR', \
'TRANSFER_LIVECROOT_GR', 'CPOOL_LIVECROOT_STORAGE_GR', 'CPOOL_DEADCROOT_GR', 'TRANSFER_DEADCROOT_GR', 'CPOOL_DEADCROOT_STORAGE_GR', \
'FROOT_MR', 'CPOOL_FROOT_GR', 'TRANSFER_FROOT_GR', 'CPOOL_FROOT_STORAGE_GR', 'FSH', 'EFLX_LH_TOT', \
'Rnet', 'FCTR', 'FGEV', 'FCEV', 'SOILLIQ', 'QOVER', 'QDRAI', 'TOTVEGC', 'LEAFC', 'LIVESTEMC', 'DEADSTEMC', \
'FROOTC', 'LIVECROOTC', 'DEADCROOTC', 'TG', 'TV', 'TSA', 'TSOI', 'DEADSTEMC_STORAGE', \
'LIVESTEMC_STORAGE', 'DEADCROOTC_STORAGE', 'LIVECROOTC_STORAGE', 'CPOOL_TO_DEADSTEMC_STORAGE', \
'CPOOL_TO_LIVESTEMC_STORAGE', 'CPOOL_TO_DEADCROOTC_STORAGE', 'CPOOL_TO_LIVECROOTC_STORAGE', \
'ER', 'HR', 'FROOTC_STORAGE', 'LEAFC_STORAGE', 'LEAFC_XFER', 'FROOTC_XFER', 'LIVESTEMC_XFER', \
'DEADSTEMC_XFER', 'LIVECROOTC_XFER', 'DEADCROOTC_XFER', 'SR', 'HR_vr', 'FIRA',
'FSA', 'FSDS', 'FLDS', 'TBOT', 'RAIN', 'SNOW', 'WIND', 'PBOT', 'QBOT', 'QVEGT', 'QVEGE', 'QSOIL', \
'QFLX_SUB_SNOW', 'QFLX_DEW_GRND', 'QH2OSFC', 'H2OSOI', 'CPOOL_TO_LIVESTEMC', 'TOTLITC', \
'TOTSOMC', 'ZWT', 'SNOWDP', 'TLAI','RH2M','QRUNOFF']
#var_list_hourly_bgc TODO: Separate SP and BGC variables,
var_list_daily = ['TOTLITC', 'TOTSOMC', 'CWDC', 'LITR1C_vr', 'LITR2C_vr', 'LITR3C_vr', 'SOIL1C_vr', \
'SOIL2C_vr', 'SOIL3C_vr', 'H2OSFC', 'ZWT', 'SNOWDP', 'TLAI', 'CPOOL','NPOOL','PPOOL', \
'FPI','FPI_P','FPG','FPG_P','FPI_vr','FPI_P_vr']
var_list_pft = ['GPP', 'NPP', 'LEAFC_ALLOC', 'AGNPP', 'CPOOL_TO_DEADSTEMC', \
'LIVECROOTC_XFER_TO_LIVECROOTC', 'DEADCROOTC_XFER_TO_DEADCROOTC', \
'CPOOL_TO_LIVECROOTC', 'CPOOL_TO_DEADCROOTC', 'FROOTC_ALLOC', 'AR', 'MR', \
'LEAF_MR', 'CPOOL_LEAF_GR', 'TRANSFER_LEAF_GR', 'CPOOL_LEAF_STORAGE_GR', \
'LIVESTEM_MR', 'CPOOL_LIVESTEM_GR', 'TRANSFER_LIVESTEM_GR', \
'CPOOL_LIVESTEM_STORAGE_GR', 'CPOOL_DEADSTEM_GR', 'TRANSFER_DEADSTEM_GR', \
'CPOOL_DEADSTEM_STORAGE_GR', 'LIVECROOT_MR', 'CPOOL_LIVECROOT_GR', \
'TRANSFER_LIVECROOT_GR', 'CPOOL_LIVECROOT_STORAGE_GR', 'CPOOL_DEADCROOT_GR', \
'TRANSFER_DEADCROOT_GR', 'CPOOL_DEADCROOT_STORAGE_GR', 'FROOT_MR', \
'CPOOL_FROOT_GR', 'TRANSFER_FROOT_GR', 'CPOOL_FROOT_STORAGE_GR', 'FCTR', 'FCEV', \
'TOTVEGC', 'LEAFC', 'LIVESTEMC', 'DEADSTEMC', 'FROOTC', 'LIVECROOTC', \
'DEADCROOTC', 'DEADSTEMC_STORAGE', 'LIVESTEMC_STORAGE', 'DEADCROOTC_STORAGE', \
'LIVECROOTC_STORAGE', 'CPOOL_TO_DEADSTEMC_STORAGE', 'CPOOL_TO_LIVESTEMC_STORAGE', \
'CPOOL_TO_DEADCROOTC_STORAGE', 'CPOOL_TO_LIVECROOTC_STORAGE', \
'FROOTC_STORAGE', 'LEAFC_STORAGE', 'LEAFC_XFER', 'FROOTC_XFER', 'LIVESTEMC_XFER', \
'DEADSTEMC_XFER', 'LIVECROOTC_XFER', 'DEADCROOTC_XFER', 'TLAI', 'CPOOL_TO_LIVESTEMC']
var_list_spinup = ['PPOOL', 'EFLX_LH_TOT', 'RETRANSN', 'PCO2', 'PBOT', 'NDEP_TO_SMINN', 'OCDEP', \
'BCDEP', 'COL_FIRE_CLOSS', 'HDM', 'LNFM', 'NEE', 'GPP', 'FPSN', 'AR', 'HR', \
'MR', 'GR', 'ER', 'NPP', 'TLAI', 'SOIL3C', 'TOTSOMC', 'TOTSOMC_1m', 'LEAFC', \
'DEADSTEMC', 'DEADCROOTC', 'FROOTC', 'LIVESTEMC', 'LIVECROOTC', 'TOTVEGC', 'N_ALLOMETRY','P_ALLOMETRY',\
'TOTCOLC', 'TOTLITC', 'BTRAN', 'SCALARAVG_vr', 'CWDC', 'QVEGE', 'QVEGT', 'QSOIL', 'QDRAI', \
'QRUNOFF', 'FPI', 'FPI_vr', 'FPG', 'FPI_P','FPI_P_vr', 'FPG_P', 'CPOOL','NPOOL', 'PPOOL', 'SMINN', 'HR_vr']
if ('ICBCLM45CB' in compset):
var_list_spinup = ['FPSN','TLAI','QVEGT','QVEGE','QSOIL','EFLX_LH_TOT','FSH','RH2M','TSA','FSDS','FLDS','PBOT', \
'WIND','BTRAN','DAYL','T10','QBOT']
if (options.C14):
var_list_spinup.append('C14_TOTSOMC')
var_list_spinup.append('C14_TOTSOMC_1m')
var_list_spinup.append('C14_TOTVEGC')
#ILAMB diagnostic variables
ilamb_outputs = ['FAREA_BURNED', 'CWDC', 'LEAFC', 'TOTLITC', 'STORVEGC', 'LIVESTEMC', 'DEADSTEMC', \
'TOTPRODC', 'FROOTC', 'LIVECROOTC', 'DEADCROOTC', 'SOIL1C', 'SOIL2C', 'SOIL3C', \
'TOTSOMC', 'TOTVEGC', 'WOODC', 'QSOIL', 'QVEGE', 'COL_FIRE_CLOSS', \
'LITR1C_TO_SOIL1C', 'LITR2C_TO_SOIL2C', 'LITR3C_TO_SOIL3C', 'LAND_USE_FLUX', \
'LITFALL', 'GPP', 'FGR', 'TLAI', 'SNOWLIQ', 'SOILICE', 'SOILLIQ', 'QRUNOFF', \