Skip to content

Commit 9461284

Browse files
committed
Generate v91 Standard Name Table
1 parent de7b7df commit 9461284

21 files changed

+191708
-95214
lines changed

Data/cf-standard-names/91/README.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
The XML file in the src directory is used to build the HTML version of the CF Standard Name Table in the build directory.
2+
3+
See the makefile for the available document build options.

Data/cf-standard-names/91/build/cf-standard-name-table.html

Lines changed: 66816 additions & 0 deletions
Large diffs are not rendered by default.
Loading
Loading
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env python
2+
3+
import sys, re
4+
5+
HELP = """%s - Injects link to area_type table. \nUsage: %s <file>"""%(sys.argv[0], sys.argv[0])
6+
7+
if len(sys.argv) < 2:
8+
print(HELP)
9+
sys.exit(1)
10+
11+
file = sys.argv[1]
12+
13+
# Read input.
14+
with open(file, 'r', encoding="utf8") as i:
15+
s = i.read()
16+
17+
# Replace text.
18+
text = 'area_type table'
19+
p = re.compile(text, re.DOTALL)
20+
fix = re.sub(p, '<a href="http://cfconventions.org/Data/area-type-table/current/build/area-type-table.html">%s</a>'%text, s, 1)
21+
22+
# Write output.
23+
with open(file, 'w', encoding="utf8", newline="\n") as o:
24+
o.write(fix)
25+
26+
print('%s - injected link'%file)
27+
28+
29+

Data/cf-standard-names/91/kwic_edit

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
3+
# Expects name of input file in first command line argument
4+
file=$1
5+
6+
# Extract list of standard names from xml file and remove entry id xml tags
7+
# Output file is called 'output.txt' in current working directory
8+
grep "entry id" $file | sed -e 's/ <entry id="//' -e 's/">//' > output.txt
9+
10+
# Insert standardname([' at the start of every line
11+
sed -i "s/^/standardname(['/" output.txt
12+
13+
# Insert ']). at end of every line
14+
sed -i "s/$/'])./" output.txt
15+
16+
# Replace underscores with commas
17+
sed -i "s/_/','/g" output.txt
18+

Data/cf-standard-names/91/makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
clean:
2+
rm build/cf-standard-name-table.html
3+
rm build/kwic_index_for_cf_standard_names.html
4+
5+
standard-name-table:
6+
xsltproc xsl/html/cf-standard-name-table-1.3.xsl src/cf-standard-name-table.xml > build/cf-standard-name-table.html
7+
./inject-area-type-link.py build/cf-standard-name-table.html
8+
9+
kwic-index:
10+
./kwic_edit src/cf-standard-name-table.xml

Data/cf-standard-names/91/src/cf-standard-name-table.xml

Lines changed: 27866 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)