@@ -19,10 +19,12 @@ using filehandling
1919using Printf
2020
2121export setrxns,
22- generate_incfiles
22+ generate_incfiles,
23+ generate_wiki
2324
2425# Include private functions
2526include (" setrxns.jl" )
27+ include (" generate_wiki.jl" )
2628
2729"""
2830 setrxns(tuvdir::String; inputfiles::Union{String,Vector{String}}="", setflags::Int64=-1)
@@ -57,6 +59,11 @@ function setrxns(tuvdir::String; inputfiles::Union{String,Vector{String}}="",
5759end # function setrxns
5860
5961
62+ """
63+ generate_incfiles(tuvdir::String)
64+
65+ Generate include files to link TUV in directory `tuvdir` to the box model DSMACC.
66+ """
6067function generate_incfiles (tuvdir:: String )
6168
6269 # Save current directory
@@ -72,4 +79,32 @@ function generate_incfiles(tuvdir::String)
7279 cd (currdir)
7380end
7481
82+
83+ """
84+ generate_wiki(tuvdir::String, kwargs)
85+
86+ Generate markdown files from templates specified kwarg `wikitemplates`, where
87+ reactions numbers from TUV in `tuvdir` and in MCM/GECKO-A are listed for every
88+ reaction listed at the beginning of each template line and written to files specified
89+ by kwarg `wikioutput`. The table `MCMcollength` can be specifief with a kwarg, for nicer
90+ md file formatting. The `MCMversion` needs to be specified for every wiki template.
91+ """
92+ function generate_wiki (tuvdir:: String ; wikitemplates:: Union{String, Vector{String}} = " " ,
93+ wikioutput:: Union{String, Vector{String}} = " WIKI.md" , MCMcollength:: Union{Int64,Vector{Int64}} = 10 ,
94+ MCMversion:: Union{Int64,Vector{Int64}} = 4 , parinput:: String = " " ,
95+ paroutput:: String = " ../MCM-Photolysis-Parameters.md" )
96+ # Save current directory
97+ currdir = pwd ()
98+ # Find files related to photolysis mechanism
99+ rxnfiles, callfiles, tuvdir = getfiles (tuvdir)
100+ # get list of reactions in order for input files
101+ rxnlist = generate_rxns (rxnfiles, callfiles)
102+
103+ # Auto-generate inc files for TUV_DSMACC
104+ write_wiki (rxnlist, tuvdir, wikitemplates, wikioutput, MCMcollength, MCMversion, currdir)
105+ write_params (parinput, paroutput, currdir)
106+ # Go back to original directory
107+ cd (currdir)
108+ end # function generate_wiki
109+
75110end # module TUVtools
0 commit comments