1414
1515## chemistry diag pre- and post-fixes
1616## Each list entry is a pair of possible new chemistry names
17- __CHEM_DIAG_PRE_POST = [('GS_' , '' ), ('AQ_' , '' ), ('AQ_' , '_OCW' ),
18- ('sink_' , '' ), ('sink_' , '_S' ),
19- ('CT_' , '' ), ('SF' , '' ), ('emis_' , '' ),
20- ('D' , 'CHM' ), ('F' , '_fvm' ), ('TA' , '' ), ('TM' , '' ),
21- ('VD' , '' ), ('' , 'CONU' ), ('' , 'DDF' ), ('' , 'DDV' ),
22- ('' , 'DTQ' ), ('' , 'GVF' ), ('' , 'INS' ), ('' , 'SBC' ),
23- ('' , 'SBS' ), ('' , 'SF' ), ('' , 'SFSBC' ), ('' , 'SFSBD' ),
24- ('' , 'SFSBS' ), ('' , 'SFSEC' ), ('' , 'SFSED' ),
25- ('' , 'SFSES' ), ('' , 'SFSIC' ), ('' , 'SFSID' ),
26- ('' , 'SFSIS' ), ('' , 'SFWET' ), ('' , 'SFWETC' ),
27- ('' , 'SIC' ), ('' , 'SIS' ), ('' , 'TBF' ), ('' , 'WET' ),
28- ('' , 'WETC' ), ('' , '_CHML' ), ('' , '_CHMP' ),
29- ('' , '_SRF' ), ('' , '_fvm' ), ('' , '_mixnuc1' ),
30- ('' , '_num' ), ('' , '_qneg3' ), ('' , '_qneg3_col' ),
31- ('' , '_sfcoag1' ), ('' , '_sfcsiz3' ), ('' , '_sfcsiz4' ),
32- ('' , '_sfgaex2' )]
17+ __CHEM_DIAG_PRE_POST = [('GS_' , '' ), ('AQ_' , '' ), ('AQ_' , '_OCW' ),
18+ ('sink_' , '' ), ('sink_' , '_S' ), ('CT_' , '' ),
19+ ('SF' , '' ), ('emis_' , '' ), ('D' , 'CHM' ),
20+ ('F' , '_fvm' ), ('TA' , '' ), ('TM' , '' ),
21+ ('VD' , '' ), ('' , 'CONU' ), ('' , 'DDF' ),
22+ ('' , 'DDV' ), ('' , 'DTQ' ), ('' , 'GVF' ),
23+ ('' , 'INS' ), ('' , 'SBC' ), ('' , 'SBS' ),
24+ ('' , 'SF' ), ('' , 'SFSBC' ), ('' , 'SFSBD' ),
25+ ('' , 'SFSBS' ), ('' , 'SFSEC' ), ('' , 'SFSED' ),
26+ ('' , 'SFSES' ), ('' , 'SFSIC' ), ('' , 'SFSID' ),
27+ ('' , 'SFSIS' ), ('' , 'SFWET' ), ('' , 'SFWETC' ),
28+ ('' , 'SIC' ), ('' , 'SIS' ), ('' , 'TBF' ),
29+ ('' , 'WET' ), ('' , 'WETC' ), ('' , '_CHML' ),
30+ ('' , '_CHMP' ), ('' , '_SRF' ), ('' , '_fvm' ),
31+ ('' , '_mixnuc1' ), ('' , '_num' ), ('' , '_qneg3' ),
32+ ('' , '_qneg3_col' ), ('' , '_sfcoag1' ), ('' , '_sfcsiz3' ),
33+ ('' , '_sfcsiz4' ), ('' , '_sfgaex2' ), ('' , '_OCWDDF' ),
34+ ('' , '_OCWGVF' ), ('' , '_OCWSFSBC' ), ('' , '_OCW' ),
35+ ('' , '_OCWSFSBS' ), ('' , '_OCWSFSIC' ),
36+ ('' , '_OCWSFSIS' ), ('' , '_OCWSFWET' ), ('' , '_OCWTBF' ),
37+ ('' , '_OCW_mixnuc1' ),
38+ ('' , '_OCWclcoagTend' ), ('' , 'coagTend' ),
39+ ('' , 'condTend' ), ('' , '_CLXF' ), ('' , '_CMXF' ),
40+ ('' , '_XFRC' ), ('' , 'clcoagTend' ),
41+ ('DC' , '' ), ('WD_A_' , '' ), ('cb_' , '' ),
42+ ('cb_' , '_OCW' )]
43+
44+ __ESM_FIXED_FIELDS = {'CO2_OCN' , 'CO2_FFF' , 'CO2_LND' , 'CO2' }
45+ __ESM_DIAG_PRE_POST = [('' , '_BOT' ), ('' , '_fvm' ), ('' , '_qneg3' ),
46+ ('' , '_qneg3_col' ), ('F' , '_fvm' ), ('SF' , '' ),
47+ ('TA' , '' ), ('TM' , '' ), ('VD' , '' )]
3348
3449## Find chem species in mo_sim_dat.F90
3550__SOLSYM_RE = re .compile (r"solsym[(][: 0-9]+[)] = [(]/(.*)$" )
@@ -107,6 +122,21 @@ def read_chem_species(chem_name):
107122
108123 return species_list
109124
125+ def all_diags_set (species_list , pre_post_list ):
126+ """Using a list of species names, <species_list>, create a set that
127+ includes these names plus each name decorated by the pre- and post-patterns
128+ from <pre_post_list>.
129+ Return this set of strings.
130+ """
131+ diag_names = set ()
132+ for speci in species_list :
133+ diag_names .add (speci )
134+ for decor in pre_post_list :
135+ diag_names .add (f"{ decor [0 ]} { speci } { decor [1 ]} " )
136+ # end if
137+ # end for
138+ return diag_names
139+
110140def all_chem_names (chem_name = None ):
111141 """Return a set containing all chemistry diagnostic names for one
112142 chemistry scheme (chem_name==None) or for all chemistry schemes
@@ -119,14 +149,15 @@ def all_chem_names(chem_name=None):
119149 all_chem_file = os .path .join (__MYDIR , "chemistry_fieldlist.txt" )
120150 all_species = read_fieldname_file (all_chem_file )
121151 # end if
122- for chem_speci in all_species :
123- diag_names .add (chem_speci )
124- for decor in __CHEM_DIAG_PRE_POST :
125- diag_names .add (f"{ decor [0 ]} { chem_speci } { decor [1 ]} " )
126- # end if
127- # end for
152+ diag_names = all_diags_set (all_species , __CHEM_DIAG_PRE_POST )
128153 return diag_names
129154
155+ def all_emission_names ():
156+ """Return a set of all the diagnostic field names associated with the
157+ CO2 emission-driven constituent fields, including CO2.
158+ """
159+ return all_diags_set (__ESM_FIXED_FIELDS , __ESM_DIAG_PRE_POST )
160+
130161###############################################################################
131162
132163if __name__ == "__main__" :
0 commit comments