Skip to content

Commit 7280f5d

Browse files
author
Peter Bräuer
committed
Merge branch 'feat/wiki' into dev
2 parents 9a55234 + f57acfc commit 7280f5d

File tree

6 files changed

+762
-6
lines changed

6 files changed

+762
-6
lines changed

src/TUVtools.jl

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@ using filehandling
1919
using Printf
2020

2121
export setrxns,
22-
generate_incfiles
22+
generate_incfiles,
23+
generate_wiki
2324

2425
# Include private functions
2526
include("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}}="",
5759
end #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+
"""
6067
function generate_incfiles(tuvdir::String)
6168

6269
# Save current directory
@@ -72,4 +79,32 @@ function generate_incfiles(tuvdir::String)
7279
cd(currdir)
7380
end
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+
75110
end # module TUVtools

src/data/MCM-GECKO-A.db

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,10 @@ MCM/GECKO-A | TUVlabel
9393
22091 | DIBK -> NI products
9494
22101 | di-sec-butyl ketone -> NI products
9595
22111 | di-t-butyl ketone -> NI products
96-
22121 | 4-octanone -> NI products
97-
22131 | n-C3H7COCH(CH3)2 -> NI products
98-
22141 | n-C3H7COCH(CH3)2 -> i-C3H7COCH3 + C2H4
99-
22151 | CH3COCH2C(CH3)3 -> NI products
100-
22161 | di-sec-butyl ketone -> sec-C4H9COCH2CH3 + C2H4
96+
22121 | n-C3H7COCH(CH3)2 -> NI products
97+
22131 | n-C3H7COCH(CH3)2 -> i-C3H7COCH3 + C2H4
98+
22141 | CH3COCH2C(CH3)3 -> NI products
99+
22151 | di-sec-butyl ketone -> sec-C4H9COCH2CH3 + C2H4
101100
23011 | CH3COCH=CH2 -> CH3 + C2H3CO
102101
23021 | CH3CH2COCH=CH2 -> C2H5 + C2H3CO
103102
24011 | c-C3H4O -> C2H4 + CO

0 commit comments

Comments
 (0)