This repository has been archived by the owner on Jan 26, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathanswer.sh
executable file
·173 lines (159 loc) · 6.88 KB
/
answer.sh
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
# Prepare answers to questions about IPCC authors, in TSV format
#
# USAGE:
# answer.sh [user] [host] [password]
# with
# user - optional, string, database user name, defaults to 'root'
# host - optional, string, database host name, defaults to 'localhost'
# password - optional, string, database user password,
# defaults to 'no password' which provides no password;
# an empty string results in a prompt for password.
user=${1:-'root'}
host=${2:-'localhost'}
password=${3:-'no password'}
if [ "$password" = 'no password' ]
then
passwordParam=''
else
passwordParam="--password $password"
fi
database=ipcc
query="mysql --host $host --user $user $passwordParam"
# change to the script's directory
cd $(dirname $0)
answer()
{
mkdir -p "answer$1"
$query $database \
< "question$1/$2.sql" \
> "answer$1/$2.tsv"
}
echo '*******************************************************'
echo 'Q1.'
echo 'Who are the authors that have participated'
echo 'in more than 1, 2, 3, or 4 assessment reports?'
echo '*******************************************************'
echo 'Answers:'
answer 01 list-names
answer 01 count-cumulated-participations
answer 01 count-cumulated-participations-by-wmo-country-group
answer 01 count-cumulated-participations-by-eco-country-group
answer 01 count-cumulated-participations-by-cli-country-group
answer 01 list-cumulated-participations-by-institution
answer 01 count-cumulated-participations-by-institution
answer 01 count-cumulated-participations-percentage-by-institution
answer 01 count-cumulated-participations-by-institution-type
answer 01 count-cumulated-participations-by-working-group
answer 01 count-cumulated-participations-percentage-by-country
answer 01 count-cumulated-participations-by-country
answer 01 count-total-participations-by-wmo-country-group
answer 01 count-total-participations-by-eco-country-group
answer 01 count-total-participations-by-cli-country-group
answer 01 count-total-participations-by-institution
answer 01 count-total-participations-by-institution-type
answer 01 count-total-participations-by-working-group
answer 01 count-total-participations-by-country
ls -l -h -o answer01
echo '*******************************************************'
echo 'Q2.'
echo 'Who are the authors that have participated'
echo 'in more than 1, 2, 3, or 4 assessment reports'
echo 'while holding at least 1 of the 3 elected roles in the IPCC'
echo 'in each assessment report of participation'
echo '(Coordinating Lead Author, Lead Author, Review Editor)?'
echo '*******************************************************'
echo 'Answers:'
answer 02 list-resp-names
answer 02 count-cumulated-resp-participations
answer 02 count-cumulated-resp-participations-by-wmo-country-group
answer 02 count-cumulated-resp-participations-by-eco-country-group
answer 02 count-cumulated-resp-participations-by-cli-country-group
answer 02 count-cumulated-resp-participations-by-institution
answer 02 count-cumulated-resp-participations-percentage-by-institution
answer 02 count-cumulated-resp-participations-by-institution-type
answer 02 count-cumulated-resp-participations-by-working-group
answer 02 count-cumulated-resp-participations-percentage-by-country
answer 02 count-cumulated-resp-participations-by-country
answer 02 count-total-resp-participations-by-wmo-country-group
answer 02 count-total-resp-participations-by-eco-country-group
answer 02 count-total-resp-participations-by-cli-country-group
answer 02 count-total-resp-participations-by-institution
answer 02 count-total-resp-participations-by-institution-type
answer 02 count-total-resp-participations-by-working-group
answer 02 count-total-resp-participations-by-country
ls -l -h -o answer02
echo '*******************************************************'
echo 'Q3.'
echo 'Who are the authors that have participated in'
echo 'more than one working group (what we call bridge authors)?'
echo '*******************************************************'
echo 'Answers:'
answer 03 list-bridge-author-names
answer 03 compute-working-group-membership-ratios
answer 03 list-bridge-authors-by-country
answer 03 list-bridge-authors-by-institution
answer 03 count-bridge-authors-by-wmo-country-group
answer 03 count-bridge-authors-by-eco-country-group
answer 03 count-bridge-authors-by-cli-country-group
ls -l -h -o answer03
echo '*******************************************************'
echo 'Q4.'
echo 'Are there particular chapters of the IPCC'
echo 'where these bridge authors tend to aggregate'
echo '(i.e. around particular themes)?'
echo '*******************************************************'
echo 'Answers:'
answer 04 list-bridge-chapters
answer 04 list-bridge-authors
answer 04 list-bridge-authors-by-chapter
answer 04 list-bridge-authors-by-chapter-type
ls -l -h -o answer04
echo '*******************************************************'
echo 'Q5.'
echo 'What kind of roles do the authors who participate'
echo 'in more than one working group occupy?'
echo '*******************************************************'
echo 'Answers:'
answer 05 compute-role-ratios
answer 05 count-bridge-authors-by-cumulated-wg-and-role
answer 05 count-bridge-authors-by-wg-and-role
ls -l -h -o answer05
echo '*******************************************************'
echo 'Q12.'
echo 'Where are French authors on the IPCC?'
echo 'To which chapters do they contribute the most?'
echo '*******************************************************'
echo 'Answers:'
answer 12 list-french-author-participations
answer 12 compute-participation-ratio-relative-to-other-countries-per-country-and-chapter
answer 12 compute-participation-ratio-relative-to-working-group-per-country-and-chapter
ls -l -h -o answer12
echo '*******************************************************'
echo 'Q13.'
echo 'Which countries have increased their participation in the IPCC'
echo 'and which have decreased their participation over time?'
echo '*******************************************************'
echo 'Answers:'
answer 13 count-authors-by-country-and-ar
answer 13 list-authors-and-roles-by-country-and-ar
ls -l -h -o answer13
echo '*******************************************************'
echo 'Q14.'
echo 'Which institutions have increased or decreased the most'
echo 'in participation over time?'
echo '*******************************************************'
echo 'Answers:'
answer 14 count-authors-by-institution-and-ar
answer 14 list-authors-and-roles-by-institution-and-ar
ls -l -h -o answer14
echo '*******************************************************'
echo 'Q15.'
echo '*******************************************************'
echo 'What are the differences in diversity (by country and by institution)'
echo 'between the working groups?'
echo '*******************************************************'
answer 15 count-participations-by-ar-author-role-institution-country
ls -l -h -o answer15
echo '*******************************************************'
echo 'Export Complete'
echo '*******************************************************'