-
Notifications
You must be signed in to change notification settings - Fork 0
/
cfg.py
144 lines (112 loc) · 4.46 KB
/
cfg.py
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
# -*- coding: utf-8 -*-
""" Configurations for script of paper on
modeling reductions in the environmental footprints embodied in
European Union’s imports through source shifting
Copyright (C) 2018
Bertram F. de Boer
Faculty of Science
Institute of Environmental Sciences (CML)
Department of Industrial Ecology
Einsteinweg 2
2333 CC Leiden
The Netherlands
+31 (0)71 527 1478
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
import datetime
import matplotlib.pyplot as plt
def get_date():
""" Get string with date.
Used to make result directories.
Returns:
--------
string with date.
"""
date = datetime.datetime.now()
return '{}{:02}{:02}'.format(date.year, date.month, date.day)
date = get_date()
"""Define directory names to store results."""
method = '_source_shift/'
result_dir_path = 'result/'+date+method
priority_setting_dir_name = '1_priority_setting/'
shift_dir_name = '2_shift/'
reduc_dir_name = '3_reduction/'
pdf_dir_name = 'pdf/'
png_dir_name = 'png/'
txt_dir_name = 'txt/'
test_dir_name = 'test/'
list_output_dir_name = [pdf_dir_name, png_dir_name, txt_dir_name, test_dir_name]
"""Define directory and file names from which to read data."""
# Root directory for data.
data_path = 'data/'
# Directory with raw text version of EXIOBASE. Used for parsing.
eb_path=data_path + 'mrIOT_pxp_ita_transactions_3.3_2011/'
# Name of processed EXIOBASE pickle.
dict_eb_file_name = 'dict_eb_proc.pkl'
# Boolean to save processed EXIOBASE version for future uses.
save_eb = True
# File with country codes of EU28 countries.
# Used to select final demand matrix.
eu28_file_name = 'EU28.txt'
# Files with names of footprints. Used to select characterization factors.
e_fp_file_name = 'list_impact_emission.txt'
m_fp_file_name = 'list_impact_material.txt'
r_fp_file_name = 'list_impact_resource.txt'
# Files with characterization factors of footprints.
cQe_file_name = 'Q_emission.txt'
cQm_file_name = 'Q_material.txt'
cQr_file_name = 'Q_resource.txt'
# File linking country codes with country names. Used for plotting.
country_code_file_name = 'country_codes.txt'
# File with long versions of product names. Used for plotting.
prod_long_file_name = 'prod_long.txt'
# File with short versions of product names. Used for plotting.
prod_short_file_name = 'prod_short.txt'
# File linking names of impact categories with names of footprints.
# Used for plotting.
cf_long_footprint_file_name = 'cf_long_footprint.txt'
# File linking impact categories with orders of magnitude.
# Used for plotting.
cf_magnitude_file_name = 'cf_magnitude.txt'
# File with concatinated list of highest contributing products for each
# footprint.
# Used for plotting.
prod_order_file_name = 'prod_order.txt'
# Set font size for plotting.
#font_size = 8.0
#plt.rc('mathtext', default='regular')
#plt.rc('font', size=font_size)
#plt.rc('axes', titlesize=font_size)
dpi = 220
#dpi = 96
font_size = 9.0
plt.rcParams['mathtext.default'] = 'regular'
plt.rcParams['font.size'] = font_size
plt.rcParams['axes.titlesize'] = font_size
plt.rcParams['font.sans-serif'] = 'Arial'
#plt.rcParams['font.family'] = 'sans-serif'
# Limit of cumulative relative footprint for highest contributing products.
imp_cum_lim_priority = 0.5
# Limit of cumulative relative footprint for all products.
# This is set to 110% to include all products.
# If this is set to 100%, not all products are included due to rounding errors.
imp_cum_lim_full = 1.1
# Limit of cumulative relative footprint in source shifting.
# Used to select country names for plotting.
imp_cum_lim_source_shift = 0.5
# Transparency of overlayed new EU28 imported final demand
# Used for plotting.
reduc_alpha = 0.5
# Threshold for export level. If country exports less than this amount for a
# product, country is not considered for source shifting due to noise.
x_prod_cntr_min = 0.5