Repository navigation
Expand file tree
/
Copy pathparse_iw.py
More file actions
6113 lines (5469 loc) · 405 KB
/
Copy pathparse_iw.py
File metadata and controls
6113 lines (5469 loc) · 405 KB
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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
"""
This project aims to parse the IMPACT World+ files from the original Microsoft access database to the different
implementation in the available LCA software (SimaPro, openLCA & brightway2). A developer version of IW+ is also parsed
and is made available in an Excel format. This version is aimed for entities wishing to integrated IW+ in their
tools/databases on their own.
In the end, IMPACT World+ will span over 6 different files, in different formats:
- the core SQL database (referred to as the source version)
- the Excel version of IW+ regrouping characterization factors from the source version as well as additional
extrapolated CFs (referred to as the dev version)
- the IW+ version directly implementable in the SimaPro LCA software, in a .csv format (referred to as the SimaPro version)
- the IW+ version directly implementable in the openLCA LCA software, in a .zip format (referred to as the openLCA version)
- the IW+ version directly implementable in the brightway2 LCA software, in a .bw2package format (referred to as the
brightway2 version)
- the IW+ version directly usable with the EXIOBASE MRIO database, in a .xlsx format (referred to as the exiobase version)
file name: parse_iw.py
author: Maxime Agez
e-mail: maxime.agez@polymtl.ca
date created: 02-04-22
python version= 3.9
"""
import pandas as pd
import numpy as np
import os
import pkg_resources
import json
import country_converter as coco
import scipy.sparse
import bw2data as bd
import bw2io as bi
from datetime import datetime
import csv
import warnings
import uuid
import logging
import sqlite3
import math
import molmass
import olca_ipc as ipc
import olca_schema as schema
from scipy.stats import gmean
from tqdm import tqdm
class Parse:
def __init__(self, path_access_db, version, bw2_projects, bw_version):
"""
:param path_access_db: path to the Microsoft access database (source version)
:param version: the version of IW+ to parse
:param bw2_projects: the name of a brightway2 project in which the database "biosphere3" is available
:param bw_version: the version of brightway used, can be '2' or '2.5'
Object instance variables:
-------------------------
- master_db : the master dataframe where basic IW CFs are stored (what is used to produce the dev.xlsx file)
following a +/-1 approach for biogenic carbon
- master_db_carbon_neutrality : the master dataframe where basic IW CFs are stored (what is used to produce the dev.xlsx file)
following a 0/0 approach for biogenic carbon
- ei310_iw : the dataframe where IW CFs linked to ecoinvent v3.10 elementary flows are stored,
following a +/-1 approach for biogenic carbon
- ei310_iw_carbon_neutrality : the dataframe where IW CFs linked to ecoinvent v3.10 elementary flows are stored
following a 0/0 approach for biogenic carbon
- simplified_version_ei310 : the dataframe where IW CFs linked to ecoinvent v3.10 elementary flows are stored
for the footprint version
- ei311_iw : the dataframe where IW CFs linked to ecoinvent v3.11 elementary flows are stored,
following a +/-1 approach for biogenic carbon
- ei311_iw_carbon_neutrality : the dataframe where IW CFs linked to ecoinvent v3.11 elementary flows are stored
following a 0/0 approach for biogenic carbon
- simplified_version_ei311 : the dataframe where IW CFs linked to ecoinvent v3.11 elementary flows are stored
for the footprint version
- iw_sp : the dataframe where IW CFs linked to SimaPro elementary flows are stored,
following a +/-1 approach for biogenic carbon
- iw_sp_carbon_neutrality : the dataframe where IW CFs linked to SimaPro elementary flows are stored
following a 0/0 approach for biogenic carbon
- simplified_version_sp : the dataframe where IW CFs linked to SimaPro elementary flows are stored
for the footprint version
- olca_iw : the dataframe where IW CFs linked to openLCA elementary flows are stored,
following a +/-1 approach for biogenic carbon
- olca_iw_carbon_neutrality : the dataframe where IW CFs linked to openLCA elementary flows are stored
following a 0/0 approach for biogenic carbon
- simplified_version_olca : the dataframe where IW CFs linked to openLCA elementary flows are stored
for the footprint version
- exio_iw_38 : the dataframe where IW CFs linked to EXIOBASE v3.8.2 and before elementary flows are stored
- exio_iw_39 : the dataframe where IW CFs linked to EXIOBASE v3.9.0 and after elementary flows are stored
Object insteance methods:
-------------------------
- load_cfs()
- load_basic_cfs()
- load_climate_change_cfs()
- load_ozone_layer_depletion_cfs()
- load_photochemical_ozone_formation()
- load_freshwater_acidification_cfs()
- load_terrestrial_acidification_cfs()
- load_marine_eutrophication_cfs()
- load_resources_services_loss_cfs()
- load_freshwater_eutrophication_cfs()
- load_land_use_cfs()
- load_particulates_cfs ()
- load_water_scarcity_cfs()
- load_water_availability_hh_cfs()
- load_water_availability_fw_cfs()
- load_water_availability_terr_cfs()
- load_thermally_polluted_water_cfs()
- load_physical_effects_cfs()
- load_fisheries_cfs()
- harmonize_regionalized_substances()
- apply_rules()
- create_not_regio_flows()
- create_regio_flows_for_not_regio_ic()
- order_things_around()
- deal_with_biogenic_carbon()
- deal_with_temporary_storage_of_carbon()
- separate_ghg_indicators()
- separate_regio_cfs()
- link_to_ecoinvent()
- link_to_sp()
- link_to_exiobase()
- link_to_olca()
- get_simplified_versions()
- get_total_hh_and_eq()
- export_to_bw()
- export_to_sp()
- export_to_olca()
- produce_files()
- produce_files_hybrid_ecoinvent()
"""
# ignoring some warnings
warnings.filterwarnings(action='ignore', category=FutureWarning)
warnings.filterwarnings(action='ignore', category=pd.errors.PerformanceWarning)
warnings.filterwarnings(action='ignore', category=UserWarning)
# set up logging tool
self.logger = logging.getLogger('IW_Reborn')
self.logger.setLevel(logging.INFO)
self.logger.handlers = []
formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
ch.setFormatter(formatter)
self.logger.addHandler(ch)
self.logger.propagate = False
self.path_access_db = path_access_db
self.version = str(version)
self.bw2_projects = bw2_projects
self.bw_version = bw_version
# OUTPUTs
self.master_db = pd.DataFrame()
self.master_db_carbon_neutrality = pd.DataFrame()
self.master_db_not_regio = pd.DataFrame()
self.master_db_not_regio_carbon_neutrality = pd.DataFrame()
self.ei310_iw = pd.DataFrame()
self.ei310_iw_carbon_neutrality = pd.DataFrame()
self.ei311_iw = pd.DataFrame()
self.ei311_iw_carbon_neutrality = pd.DataFrame()
self.ei312_iw = pd.DataFrame()
self.ei312_iw_carbon_neutrality = pd.DataFrame()
self.simplified_version_ei310 = pd.DataFrame()
self.simplified_version_ei311 = pd.DataFrame()
self.simplified_version_ei312 = pd.DataFrame()
self.iw_sp = pd.DataFrame()
self.iw_sp_carbon_neutrality = pd.DataFrame()
self.simplified_version_sp = pd.DataFrame()
self.simplified_version_olca = pd.DataFrame()
self.sp_data = {}
self.olca_iw = pd.DataFrame()
self.olca_iw_carbon_neutrality = pd.DataFrame()
self.exio_iw_38 = pd.DataFrame()
self.exio_iw_39 = pd.DataFrame()
self.conn = sqlite3.connect(self.path_access_db)
# Open openLCA. Open a database. Go to Tools/Dev tools/IPC server. Create a server with the local port 8080
# (comes by default). Activate the port (the green olay arrow)
# then we simply connect to that port. Now Python and openLCA can communicate via the "client" we created
self.olca_client = ipc.Client(8080)
# check if the opening of the openLCA client is activated or not
try:
self.olca_client.get_descriptor(schema.Unit, name='kg')
except:
print("The openLCA client. If you need it, don't forget to activate it in openLCA!")
# -------------------------------------------- Main methods -------------------------------------------------------
def load_cfs(self, bw_only:bool=False):
"""
Load the characterization factors and stored them in master_db.
:return: updated master_db
"""
self.load_basic_cfs()
self.logger.info("Loading climate change characterization factors...")
self.load_climate_change_cfs()
self.logger.info("Loading ozone layer depletion characterization factors...")
self.load_ozone_layer_depletion_cfs()
self.logger.info("Loading photochemical ozone formation characterization factors...")
self.load_photochemical_ozone_formation()
self.logger.info("Loading acidification characterization factors...")
self.load_freshwater_acidification_cfs()
self.load_terrestrial_acidification_cfs()
self.logger.info("Loading eutrophication characterization factors...")
self.load_marine_eutrophication_cfs()
self.load_freshwater_eutrophication_cfs()
self.logger.info("Loading land use characterization factors...")
self.load_land_use_cfs()
self.logger.info("Loading resources services loss/deficit characterization factors...")
self.load_resources_services_loss_cfs()
self.logger.info("Loading particulate matter characterization factors...")
self.load_particulates_cfs()
self.logger.info("Loading water scarcity characterization factors...")
self.load_water_scarcity_cfs()
self.logger.info("Loading water availability characterization factors...")
self.load_water_availability_fw_cfs()
self.load_water_availability_hh_cfs()
self.load_water_availability_terr_cfs()
self.logger.info("Loading thermally polluted water characterization factors...")
self.load_thermally_polluted_water_cfs()
self.logger.info("Loading physical effects on biota characterization factors...")
self.load_physical_effects_cfs()
self.logger.info("Loading fisheries impact characterization factors...")
self.load_fisheries_cfs()
self.logger.info("Harmonizing regionalized substances across indicators...")
self.harmonize_regionalized_substances()
self.logger.info("Applying rules...")
self.apply_rules()
self.logger.info("Treating regionalized factors...")
self.create_not_regio_flows()
self.create_regio_flows_for_not_regio_ic()
self.order_things_around()
self.logger.info("Managing biogenic carbon shenanigans...")
self.deal_with_biogenic_carbon()
self.deal_with_temporary_storage_of_carbon()
self.separate_ghg_indicators()
self.logger.info("Create non-regionalized version for ecoinvent...")
self.separate_regio_cfs()
self.logger.info("Linking to ecoinvent elementary flows...")
self.link_to_ecoinvent()
if not bw_only:
self.logger.info("Linking to SimaPro elementary flows...")
self.link_to_sp()
self.logger.info("Linking to openLCA elementary flows...")
self.link_to_olca()
# leave exiobase with brightway only option for hybrid version
self.logger.info("Linking to exiobase environmental extensions...")
self.link_to_exiobase()
self.logger.info("Prepare the footprint version...")
self.get_simplified_versions(bw_only=bw_only)
if not bw_only:
self.get_total_hh_and_eq_for_olca()
def generate_bw_files(self)->None:
"""
A specific method that generates IW+ files for brightway format only.
It first checks that brightway projects match code requirements.
Characterization factors are then loaded, matched to brightway format
and exported to a bw2package file.
Return
----------
Returns None. IW+ files are generated in `./Databases/Impact_world_2.2/bw{bw_version}`
bw_version can be '2' or '2.5' depending on what was chosen when instantiating the class.
"""
# Make sure that all projects have ecoinvent in their name
assert all(
"ecoinvent" in project for project in self.bw2_projects
), ("All project names should contain the word 'ecoinvent'. "
"Please rename your project with following form 'any_name ecoinvent$version_number$' "
"(replacing $version_number$ by the ecoinvent version you are using)")
# For each project make sure that at least one database has biosphere in its name
for project in self.bw2_projects:
bd.projects.set_current(project)
biosphere_key="biosphere"
if self.bw_version=='2':
biosphere_key="biosphere3"
assert any(biosphere_key in db for db in bd.databases), ("At least one database in each "
f"brightway project should be a biosphere and contain '{biosphere_key}' in its name "
"for the code to run.")
self.load_cfs(bw_only=True)
self.export_to_bw()
self.produce_files(bw_only=True)
def export_to_bw(self):
"""
This method creates a brightway2 or brightway2.5 method with the IW+ characterization
factors.
:return:
"""
self.logger.info("Exporting to brightway2...")
for project in self.bw2_projects:
bd.projects.set_current(project)
# for bw2
if 'biosphere3' in bd.databases:
biosphere_db_name = 'biosphere3'
# for bw2.5
else:
biosphere_db_name = [i for i in bd.databases if 'biosphere' in i][0]
bio = bd.Database(biosphere_db_name)
ei_version = project.split('ecoinvent')[1]
bw_flows_with_codes = (
pd.DataFrame(
[(i.as_dict()['name'], i.as_dict()['categories'][0], i.as_dict()['categories'][1],
i.as_dict()['code'])
if len(i.as_dict()['categories']) == 2
else (i.as_dict()['name'], i.as_dict()['categories'][0], 'unspecified', i.as_dict()['code'])
for i in bio],
columns=['Elem flow name', 'Compartment', 'Sub-compartment', 'code'])
)
if '3.10' in project:
ei_in_bw_normal = self.ei310_iw.merge(bw_flows_with_codes)
ei_in_bw_carbon_neutrality = self.ei310_iw_carbon_neutrality.merge(bw_flows_with_codes)
ei_in_bw_simple = self.simplified_version_ei310.merge(bw_flows_with_codes)
elif '3.11' in project:
ei_in_bw_normal = self.ei311_iw.merge(bw_flows_with_codes)
ei_in_bw_carbon_neutrality = self.ei311_iw_carbon_neutrality.merge(bw_flows_with_codes)
ei_in_bw_simple = self.simplified_version_ei311.merge(bw_flows_with_codes)
elif '3.12' in project:
ei_in_bw_normal = self.ei312_iw.merge(bw_flows_with_codes)
ei_in_bw_carbon_neutrality = self.ei312_iw_carbon_neutrality.merge(bw_flows_with_codes)
ei_in_bw_simple = self.simplified_version_ei312.merge(bw_flows_with_codes)
for ei_in_bw_format in ['normal', 'carbon neutrality']:
if ei_in_bw_format == 'normal':
ei_in_bw = ei_in_bw_normal
elif ei_in_bw_format == 'carbon neutrality':
ei_in_bw = ei_in_bw_carbon_neutrality
# create total HH and EQ categories
ei_in_bw.set_index(['Impact category', 'CF unit', 'code'], inplace=True)
total_hh = ei_in_bw.loc(axis=0)[:, 'DALY'].copy('deep')
total_hh = total_hh.groupby('code').agg({'Compartment': 'first',
'Sub-compartment': 'first',
'Elem flow name': 'first',
'CAS number': 'first',
'CF value': sum,
'Elem flow unit': 'first',
'MP or Damage': 'first',
'Native geographical resolution scale': 'first'})
total_hh.index = pd.MultiIndex.from_product([['Total human health'], ['DALY'], total_hh.index])
total_eq = ei_in_bw.loc(axis=0)[:, 'PDF.m2.yr'].copy('deep')
total_eq = total_eq.groupby('code').agg({'Compartment': 'first',
'Sub-compartment': 'first',
'Elem flow name': 'first',
'CAS number': 'first',
'CF value': sum,
'Elem flow unit': 'first',
'MP or Damage': 'first',
'Native geographical resolution scale': 'first'})
total_eq.index = pd.MultiIndex.from_product(
[['Total ecosystem quality'], ['PDF.m2.yr'], total_eq.index])
ei_in_bw = pd.concat([ei_in_bw, total_hh, total_eq])
ei_in_bw.index.names = ['Impact category', 'CF unit', 'code']
ei_in_bw = ei_in_bw.reset_index()
ei_in_bw.set_index(['Impact category', 'CF unit'], inplace=True)
impact_categories = ei_in_bw.index.drop_duplicates()
# -------------- For complete version of IW+ ----------------
for ic in impact_categories:
if ei_in_bw.loc[[ic], 'MP or Damage'].iloc[0] == 'Midpoint':
mid_end = 'Midpoint'
if ei_in_bw_format == 'normal':
name = ('IMPACT World+ ' + mid_end + ' ' + self.version + ' for ecoinvent v' +
ei_version + ' (incl. CO2 uptake)', 'Midpoint', ic[0])
elif ei_in_bw_format == 'carbon neutrality':
name = ('IMPACT World+ ' + mid_end + ' ' + self.version + ' for ecoinvent v' +
ei_version, 'Midpoint', ic[0])
else:
mid_end = 'Damage'
if ic[1] == 'DALY':
if ei_in_bw_format == 'normal':
name = ('IMPACT World+ ' + mid_end + ' ' + self.version + ' for ecoinvent v' +
ei_version + ' (incl. CO2 uptake)', 'Human health', ic[0])
elif ei_in_bw_format == 'carbon neutrality':
name = ('IMPACT World+ ' + mid_end + ' ' + self.version + ' for ecoinvent v' +
ei_version, 'Human health', ic[0])
else:
if ei_in_bw_format == 'normal':
name = ('IMPACT World+ ' + mid_end + ' ' + self.version + ' for ecoinvent v' +
ei_version + ' (incl. CO2 uptake)', 'Ecosystem quality', ic[0])
elif ei_in_bw_format == 'carbon neutrality':
name = ('IMPACT World+ ' + mid_end + ' ' + self.version + ' for ecoinvent v' +
ei_version, 'Ecosystem quality', ic[0])
# initialize the "Method" method
new_method = bd.Method(name)
# register the new method
new_method.register()
# set its unit
new_method.metadata["unit"] = ic[1]
df = ei_in_bw.loc[[ic], ['code', 'CF value']].copy()
df.set_index('code', inplace=True)
data = []
for stressor in df.index:
data.append(((biosphere_db_name, stressor), df.loc[stressor, 'CF value']))
new_method.write(data)
# -------------- For simplified version of IW+ ----------------
ei_in_bw_simple.set_index(['Impact category', 'CF unit'], inplace=True)
impact_categories_simple = ei_in_bw_simple.index.drop_duplicates()
for ic in impact_categories_simple:
name = ('IMPACT World+ Footprint ' + self.version + ' for ecoinvent v' + ei_version, ic[0])
# initialize the "Method" method
new_method = bd.Method(name)
# register the new method
new_method.register()
# set its unit
new_method.metadata["unit"] = ic[1]
df = ei_in_bw_simple.loc[[ic], ['code', 'CF value']].copy()
df.set_index('code', inplace=True)
data = []
for stressor in df.index:
data.append(((biosphere_db_name, stressor), df.loc[stressor, 'CF value']))
new_method.write(data)
def export_to_sp(self):
"""
This method careates the necessary information for the csv creation in SimaPro.
:return:
"""
self.logger.info("Exporting to SimaPro...")
# some elementary flows with the following region exceed the 100 characters limit of SimaPro -> drop region
self.iw_sp_carbon_neutrality = self.iw_sp_carbon_neutrality.loc[
~self.iw_sp_carbon_neutrality.loc[:, 'Elem flow name'].str.contains(
'United States of America, including overseas territories')]
self.iw_sp = self.iw_sp.loc[~self.iw_sp.loc[:, 'Elem flow name'].str.contains(
'United States of America, including overseas territories')]
self.simplified_version_sp = self.simplified_version_sp.loc[~
self.simplified_version_sp.loc[:, 'Elem flow name'].str.contains(
'United States of America, including overseas territories')]
# csv accepts strings only
self.iw_sp.loc[:, 'CF value'] = self.iw_sp.loc[:, 'CF value'].astype(str)
self.iw_sp_carbon_neutrality.loc[:, 'CF value'] = self.iw_sp_carbon_neutrality.loc[:, 'CF value'].astype(str)
self.simplified_version_sp.loc[:, 'CF value'] = self.simplified_version_sp.loc[:, 'CF value'].astype(str)
# Metadata
l = ['SimaPro 9.6', 'methods', 'Date: ' + datetime.now().strftime("%D"),
'Time: ' + datetime.now().strftime("%H:%M:%S"),
'Project: Methods', 'CSV Format version: 8.0.5', 'CSV separator: Semicolon',
'Decimal separator: .', 'Date separator: -', 'Short date format: yyyy-MM-dd', 'Selection: Selection (1)',
'Related objects (system descriptions, substances, units, etc.): Yes',
'Include sub product stages and processes: No', "Open library: 'Methods'"]
metadata = []
for i in l:
s = '{' + i + '}'
metadata.append([s, '', '', '', '', ''])
# metadata on the midpoint method
midpoint_method_metadata = [['Method', '', '', '', '', ''], ['', '', '', '', '', ''],
['Name', '', '', '', '', ''],
['IMPACT World+ Midpoint ' + self.version + ' (incl. CO2 uptake)', '', '', '', '',
''],
['', '', '', '', '', ''], ['Version', '', '', '', '', ''],
['2', '2', '1', '', '', ''],
['', '', '', '', '', ''], ['Comment', '', '', '', '', ''],
['IMPACT World+ ' + self.version + chr(int("007F", 16)) +
'New categories:' + chr(int("007F", 16)) +
'- Resources services deficit (beta)' + chr(int("007F", 16)) +
'- Adaptation to resources services loss (beta)' + chr(int("007F", 16)) +
chr(int("007F", 16)) +
'Renamed categories' + chr(int("007F", 16)) +
'- Physical effect on biota (formerly Plastic physical effect on biota)' + chr(
int("007F", 16)) +
'Updated categories:' + chr(int("007F", 16)) +
'- Climate change, short term' + chr(int("007F", 16)) +
'- Climate change, long term' + chr(int("007F", 16)) +
'- Acidification and eutrophication indicators' + chr(int("007F", 16)) +
'- Physical effect on biota' + chr(int("007F", 16)) +
'- Land occupation (biodiversity)' + chr(int("007F", 16)) +
'- Land transformation (biodiversity)' + chr(int("007F", 16)) +
chr(int("007F", 16)) +
'For more information on IMPACT World+ and its methodology: https://www.impactworldplus.org.' + chr(
int("007F", 16)) +
'Full list of changes available here: https://github.com/CIRAIG/IWP_Reborn/tree/master/Report_changes',
'', '', '', '', ''], ['', '', '', '', '', ''],
['Category', '', '', '', '', ''], ['Others', '', '', '', '', ''],
['', '', '', '', '', ''],
['Use Damage Assessment', '', '', '', '', ''], ['No', '', '', '', '', ''],
['', '', '', '', '', ''],
['Use Normalization', '', '', '', '', ''], ['No', '', '', '', '', ''],
['', '', '', '', '', ''],
['Use Weighting', '', '', '', '', ''], ['No', '', '', '', '', ''],
['', '', '', '', '', ''],
['Use Addition', '', '', '', '', ''], ['No', '', '', '', '', '']]
# metadata on the damage method
damage_method_metadata = [['Method', '', '', '', '', ''], ['', '', '', '', '', ''],
['Name', '', '', '', '', ''],
['IMPACT World+ Expert ' + self.version + ' (incl. CO2 uptake)', '', '', '', '', ''],
['', '', '', '', '', ''], ['Version', '', '', '', '', ''],
['2', '2', '1', '', '', ''],
['', '', '', '', '', ''], ['Comment', '', '', '', '', ''],
['IMPACT World+ ' + self.version + chr(int("007F", 16)) +
'New categories:' + chr(int("007F", 16)) +
'- Climate change, ecosystem quality, marine ecosystems (beta) (abbreviated as CC, EQ, mar)' + chr(
int("007F", 16)) +
'- Climate change, ecosystem quality, terrestrial ecosystems (abbreviated as CC, EQ, terr)' + chr(
int("007F", 16))
+ chr(int("007F", 16)) +
'Renamed categories' + chr(int("007F", 16)) +
'- Physical effect on biota (formerly Plastic physical effect on biota)' + chr(
int("007F", 16)) +
'Updated categories:' + chr(int("007F", 16)) +
'- Climate change damage indicators' + chr(int("007F", 16)) +
'- Acidification and eutrophication indicators' + chr(
int("007F", 16)) +
'- Physical effect on biota' + chr(int("007F", 16)) +
'- Land occupation (biodiversity)' + chr(int("007F", 16)) +
'- Land transformation (biodiversity)' + chr(int("007F", 16)) +
'- Marine ecotoxicity' + chr(int("007F", 16)) +
'- Terrestrial ecotoxicity' + chr(int("007F", 16)) +
chr(int("007F", 16)) +
'For more information on IMPACT World+ and its methodology: https://www.impactworldplus.org.' + chr(
int("007F", 16)) +
'Full list of changes available here: https://github.com/CIRAIG/IWP_Reborn/tree/master/Report_changes',
'', '', '', '', ''], ['', '', '', '', '', ''],
['Category', '', '', '', '', ''], ['Others', '', '', '', '', ''],
['', '', '', '', '', ''],
['Use Damage Assessment', '', '', '', '', ''], ['Yes', '', '', '', '', ''],
['', '', '', '', '', ''],
['Use Normalization', '', '', '', '', ''], ['Yes', '', '', '', '', ''],
['', '', '', '', '', ''],
['Use Weighting', '', '', '', '', ''], ['Yes', '', '', '', '', ''],
['', '', '', '', '', ''],
['Use Addition', '', '', '', '', ''], ['Yes', '', '', '', '', '']]
# metadata on the combined method
combined_method_metadata = [['Method', '', '', '', '', ''], ['', '', '', '', '', ''],
['Name', '', '', '', '', ''],
['IMPACT World+ ' + self.version + ' (incl. CO2 uptake)', '', '', '', '', ''],
['', '', '', '', '', ''], ['Version', '', '', '', '', ''],
['2', '2', '1', '', '', ''],
['', '', '', '', '', ''], ['Comment', '', '', '', '', ''],
['IMPACT World+ ' + self.version + chr(int("007F", 16)) +
'New categories:' + chr(int("007F", 16)) +
'- Climate change, ecosystem quality, marine ecosystems (beta) (abbreviated as CC, EQ, mar)' + chr(
int("007F", 16)) +
'- Climate change, ecosystem quality, terrestrial ecosystems (abbreviated as CC, EQ, terr)' + chr(
int("007F", 16)) +
'- Resources services deficit (beta)' + chr(int("007F", 16)) +
'- Adaptation to resources services loss (beta)' + chr(int("007F", 16)) +
chr(int("007F", 16)) +
'Renamed categories' + chr(int("007F", 16)) +
'- Physical effect on biota (formerly Plastic physical effect on biota)' + chr(
int("007F", 16)) +
'Updated categories:' + chr(int("007F", 16)) +
'- Climate change midpoint indicators' + chr(int("007F", 16)) +
'- Climate change damage indicators' + chr(int("007F", 16)) +
'- Acidification and eutrophication indicators' + chr(int("007F", 16)) +
'- Physical effect on biota' + chr(int("007F", 16)) +
'- Land occupation (biodiversity)' + chr(int("007F", 16)) +
'- Land transformation (biodiversity)' + chr(int("007F", 16)) +
'- Marine ecotoxicity' + chr(int("007F", 16)) +
'- Terrestrial ecotoxicity' + chr(int("007F", 16)) +
chr(int("007F", 16)) +
'For more information on IMPACT World+ and its methodology: https://www.impactworldplus.org.' + chr(
int("007F", 16)) +
'Full list of changes available here: https://github.com/CIRAIG/IWP_Reborn/tree/master/Report_changes',
'', '', '', '', ''], ['', '', '', '', '', ''],
['Category', '', '', '', '', ''], ['Others', '', '', '', '', ''],
['', '', '', '', '', ''],
['Use Damage Assessment', '', '', '', '', ''], ['Yes', '', '', '', '', ''],
['', '', '', '', '', ''],
['Use Normalization', '', '', '', '', ''], ['Yes', '', '', '', '', ''],
['', '', '', '', '', ''],
['Use Weighting', '', '', '', '', ''], ['Yes', '', '', '', '', ''],
['', '', '', '', '', ''],
['Use Addition', '', '', '', '', ''], ['Yes', '', '', '', '', '']]
# metadata on the midpoint method
midpoint_method_metadata_carboneutrality = [['Method', '', '', '', '', ''], ['', '', '', '', '', ''],
['Name', '', '', '', '', ''],
['IMPACT World+ Midpoint ' + self.version, '', '', '', '', ''],
['', '', '', '', '', ''], ['Version', '', '', '', '', ''],
['2', '2', '1', '', '', ''],
['IMPACT World+ ' + self.version + chr(int("007F", 16)) +
'New categories:' + chr(int("007F", 16)) +
'- Resources services deficit (beta)' + chr(int("007F", 16)) +
'- Adaptation to resources services loss (beta)' + chr(int("007F", 16)) +
chr(int("007F", 16)) +
'Renamed categories' + chr(int("007F", 16)) +
'- Physical effect on biota (formerly Plastic physical effect on biota)' + chr(int("007F", 16)) +
'Updated categories:' + chr(int("007F", 16)) +
'- Climate change, short term' + chr(int("007F", 16)) +
'- Climate change, long term' + chr(int("007F", 16)) +
'- Acidification and eutrophication indicators' + chr(int("007F", 16)) +
'- Physical effect on biota' + chr(int("007F", 16)) +
'- Land occupation (biodiversity)' + chr(int("007F", 16)) +
'- Land transformation (biodiversity)' + chr(int("007F", 16)) +
chr(int("007F", 16)) +
'For more information on IMPACT World+ and its methodology: https://www.impactworldplus.org.' + chr(
int("007F", 16)) +
'Full list of changes available here: https://github.com/CIRAIG/IWP_Reborn/tree/master/Report_changes',
'', '', '', '', ''], ['', '', '', '', '', ''],
['Category', '', '', '', '', ''], ['Others', '', '', '', '', ''],
['', '', '', '', '', ''],
['Use Damage Assessment', '', '', '', '', ''],
['No', '', '', '', '', ''],
['', '', '', '', '', ''],
['Use Normalization', '', '', '', '', ''],
['No', '', '', '', '', ''],
['', '', '', '', '', ''],
['Use Weighting', '', '', '', '', ''], ['No', '', '', '', '', ''],
['', '', '', '', '', ''],
['Use Addition', '', '', '', '', ''], ['No', '', '', '', '', '']]
# metadata on the damage method
damage_method_metadata_carboneutrality = [['Method', '', '', '', '', ''], ['', '', '', '', '', ''],
['Name', '', '', '', '', ''],
['IMPACT World+ Expert ' + self.version, '', '', '', '', ''],
['', '', '', '', '', ''], ['Version', '', '', '', '', ''],
['2', '2', '1', '', '', ''],
['', '', '', '', '', ''], ['Comment', '', '', '', '', ''],
['IMPACT World+ ' + self.version + chr(int("007F", 16)) +
'New categories:' + chr(int("007F", 16)) +
'- Climate change, ecosystem quality, marine ecosystems (beta) (abbreviated as Climate change, EQ, mar)' + chr(
int("007F", 16)) +
'- Climate change, ecosystem quality, terrestrial ecosystems (abbreviated as Climate change, EQ, terr)' + chr(
int("007F", 16))
+ chr(int("007F", 16)) +
'Renamed categories' + chr(int("007F", 16)) +
'- Physical effect on biota (formerly Plastic physical effect on biota)' + chr(
int("007F", 16)) +
'Updated categories:' + chr(int("007F", 16)) +
'- Climate change damage indicators' + chr(int("007F", 16)) +
'- Acidification and eutrophication indicators' + chr(
int("007F", 16)) +
'- Physical effect on biota' + chr(int("007F", 16)) +
'- Land occupation (biodiversity)' + chr(int("007F", 16)) +
'- Land transformation (biodiversity)' + chr(int("007F", 16)) +
'- Marine ecotoxicity' + chr(int("007F", 16)) +
'- Terrestrial ecotoxicity' + chr(int("007F", 16)) +
chr(int("007F", 16)) +
'For more information on IMPACT World+ and its methodology: https://www.impactworldplus.org.' + chr(
int("007F", 16)) +
'Full list of changes available here: https://github.com/CIRAIG/IWP_Reborn/tree/master/Report_changes',
'', '', '', '', ''], ['', '', '', '', '', ''],
['Category', '', '', '', '', ''], ['Others', '', '', '', '', ''],
['', '', '', '', '', ''],
['Use Damage Assessment', '', '', '', '', ''],
['Yes', '', '', '', '', ''],
['', '', '', '', '', ''],
['Use Normalization', '', '', '', '', ''],
['Yes', '', '', '', '', ''],
['', '', '', '', '', ''],
['Use Weighting', '', '', '', '', ''], ['Yes', '', '', '', '', ''],
['', '', '', '', '', ''],
['Use Addition', '', '', '', '', ''], ['Yes', '', '', '', '', '']]
# metadata on the combined method
combined_method_metadata_carboneutrality = [['Method', '', '', '', '', ''], ['', '', '', '', '', ''],
['Name', '', '', '', '', ''],
['IMPACT World+ ' + self.version, '', '', '', '', ''],
['', '', '', '', '', ''], ['Version', '', '', '', '', ''],
['2', '2', '1', '', '', ''],
['', '', '', '', '', ''], ['Comment', '', '', '', '', ''],
['IMPACT World+ ' + self.version + chr(int("007F", 16)) +
'New categories:' + chr(int("007F", 16)) +
'- Climate change, ecosystem quality, marine ecosystems (beta) (abbreviated as Climate change, EQ, mar)' + chr(int("007F", 16)) +
'- Climate change, ecosystem quality, terrestrial ecosystems (abbreviated as Climate change, EQ, terr)' + chr(int("007F", 16)) +
'- Resources services deficit (beta)' + chr(int("007F", 16)) +
'- Adaptation to resources services loss (beta)' + chr(int("007F", 16)) +
chr(int("007F", 16)) +
'Renamed categories' + chr(int("007F", 16)) +
'- Physical effect on biota (formerly Plastic physical effect on biota)' + chr(int("007F", 16)) +
'Updated categories:' + chr(int("007F", 16)) +
'- Climate change midpoint indicators' + chr(int("007F", 16)) +
'- Climate change damage indicators' + chr(int("007F", 16)) +
'- Acidification and eutrophication indicators' + chr(int("007F", 16)) +
'- Physical effect on biota' + chr(int("007F", 16)) +
'- Land occupation (biodiversity)' + chr(int("007F", 16)) +
'- Land transformation (biodiversity)' + chr(int("007F", 16)) +
'- Marine ecotoxicity' + chr(int("007F", 16)) +
'- Terrestrial ecotoxicity' + chr(int("007F", 16)) +
chr(int("007F", 16)) +
'For more information on IMPACT World+ and its methodology: https://www.impactworldplus.org.' + chr(
int("007F", 16)) +
'Full list of changes available here: https://github.com/CIRAIG/IWP_Reborn/tree/master/Report_changes',
'', '', '', '', ''], ['', '', '', '', '', ''],
['Category', '', '', '', '', ''], ['Others', '', '', '', '', ''],
['', '', '', '', '', ''],
['Use Damage Assessment', '', '', '', '', ''],
['Yes', '', '', '', '', ''],
['', '', '', '', '', ''],
['Use Normalization', '', '', '', '', ''],
['Yes', '', '', '', '', ''],
['', '', '', '', '', ''],
['Use Weighting', '', '', '', '', ''], ['Yes', '', '', '', '', ''],
['', '', '', '', '', ''],
['Use Addition', '', '', '', '', ''], ['Yes', '', '', '', '', '']]
# metadata on the simplified method
simplified_method_metadata = [['Method', '', '', '', '', ''], ['', '', '', '', '', ''],
['Name', '', '', '', '', ''],
['IMPACT World+ Footprint ' + self.version, '', '', '', '', ''],
['', '', '', '', '', ''], ['Version', '', '', '', '', ''],
['2', '2', '1', '', '', ''],
['', '', '', '', '', ''], ['Comment', '', '', '', '', ''],
['IMPACT World+ Footprint ' + self.version + chr(int("007F", 16)) +
'Updated categories:' + chr(int("007F", 16)) +
'- Carbon footprint' + chr(int("007F", 16)) +
'- Human health (residual)' + chr(int("007F", 16)) +
'- Ecosystem quality (residual)' + chr(int("007F", 16)) +
'For details on what the footprint version of IW+ entails, please consult this page: '
'https://www.impactworldplus.org/version-2-0-1/' + chr(int("007F", 16)) +
'For more information on IMPACT World+ and its methodology: https://www.impactworldplus.org.' + chr(
int("007F", 16)) +
'Full list of changes available here: https://github.com/CIRAIG/IWP_Reborn/tree/master/Report_changes',
'', '', '', '', ''], ['', '', '', '', '', ''],
['Category', '', '', '', '', ''], ['Others', '', '', '', '', ''],
['', '', '', '', '', ''],
['Use Damage Assessment', '', '', '', '', ''], ['No', '', '', '', '', ''],
['', '', '', '', '', ''],
['Use Normalization', '', '', '', '', ''], ['No', '', '', '', '', ''],
['', '', '', '', '', ''],
['Use Weighting', '', '', '', '', ''], ['No', '', '', '', '', ''],
['', '', '', '', '', ''],
['Use Addition', '', '', '', '', ''], ['No', '', '', '', '', '']]
# data for weighting and normalizing
df = pd.read_csv(pkg_resources.resource_filename(
__name__, '/Data/weighting_normalizing/weighting_and_normalization.csv'),
header=None, delimiter=';').fillna('')
weighting_info_damage_carboneutrality = [[df.loc[i].tolist()[0], df.loc[i].tolist()[1], '', '', '', ''] for i in
df.index]
weighting_info_damage_carboneutrality[4] = ['Climate change, HH, LT', '1.00E+00', '', '', '', '']
weighting_info_damage_carboneutrality[5] = ['Climate change, HH, ST', '1.00E+00', '', '', '', '']
weighting_info_damage_carboneutrality[10] = ['Ionizing radiations, human health', '1.00E+00', '', '', '', '']
weighting_info_damage_carboneutrality[13] = ['Photochemical ozone formation, human health', '1.00E+00', '', '',
'', '']
weighting_info_damage_carboneutrality.insert(22, ['Fisheries impact', '1.00E+00', '', '', '', ''])
weighting_info_damage_carboneutrality[27] = ['Ionizing radiations, ecosystem quality', '1.00E+00', '', '', '',
'']
weighting_info_damage_carboneutrality.insert(32, ['Marine ecotoxicity, long term', '1.00E+00', '', '', '', ''])
weighting_info_damage_carboneutrality.insert(33, ['Marine ecotoxicity, short term', '1.00E+00', '', '', '', ''])
weighting_info_damage_carboneutrality.insert(35,
['Photochemical ozone formation, ecosystem quality', '1.00E+00',
'', '', '', ''])
weighting_info_damage_carboneutrality.insert(36, ['Physical effects on biota', '1.00E+00', '', '', '', ''])
weighting_info_damage_carboneutrality.insert(38,
['Terrestrial ecotoxicity, long term', '1.00E+00', '', '', '', ''])
weighting_info_damage_carboneutrality.insert(39, ['Terrestrial ecotoxicity, short term', '1.00E+00', '', '', '',
''])
weighting_info_damage_carboneutrality[20] = ['Climate change, EQ, terr, LT', '1.00E+00', '', '', '', '']
weighting_info_damage_carboneutrality[21] = ['Climate change, EQ, terr, ST', '1.00E+00', '', '', '', '']
weighting_info_damage_carboneutrality.insert(22, ['Climate change, EQ, mar, LT (beta)', '1.00E+00', '', '', '', ''])
weighting_info_damage_carboneutrality.insert(23, ['Climate change, EQ, mar, ST (beta)', '1.00E+00', '', '', '', ''])
weighting_info_combined_carboneutrality = weighting_info_damage_carboneutrality.copy()
weighting_info_combined_carboneutrality[11] = ['Ozone layer depletion (damage)', '1.00E+00', '', '', '', '']
weighting_info_combined_carboneutrality[12] = ['Particulate matter formation (damage)', '1.00E+00', '', '', '',
'']
weighting_info_combined_carboneutrality[25] = ['Freshwater acidification (damage)', '1.00E+00', '', '', '', '']
weighting_info_combined_carboneutrality[28] = ['Freshwater eutrophication (damage)', '1.00E+00', '', '', '', '']
weighting_info_combined_carboneutrality[30] = ['Land occupation, biodiversity (damage)', '1.00E+00', '', '', '',
'']
weighting_info_combined_carboneutrality[31] = ['Land transformation, biodiversity (damage)', '1.00E+00', '', '',
'', '']
weighting_info_combined_carboneutrality[36] = ['Marine eutrophication (damage)', '1.00E+00', '', '', '', '']
weighting_info_combined_carboneutrality[38] = ['Physical effects on biota (damage)', '1.00E+00', '', '', '', '']
weighting_info_combined_carboneutrality[39] = ['Terrestrial acidification (damage)', '1.00E+00', '', '', '', '']
weighting_info_damage = [[df.loc[i].tolist()[0], df.loc[i].tolist()[1], '', '', '', ''] for i in df.index]
weighting_info_damage[4] = ['CC, HH, LT, fossil', '1.00E+00', '', '', '', '']
weighting_info_damage[5] = ['CC, HH, ST, fossil', '1.00E+00', '', '', '', '']
weighting_info_damage[10] = ['Ionizing radiations, human health', '1.00E+00', '', '', '', '']
weighting_info_damage[13] = ['Photochemical ozone formation, human health', '1.00E+00', '', '', '', '']
weighting_info_damage[20] = ['CC, EQ, terr, LT, fossil', '1.00E+00', '', '', '', '']
weighting_info_damage[21] = ['CC, EQ, terr, ST, fossil', '1.00E+00', '', '', '', '']
weighting_info_damage.insert(22, ['CC, EQ, mar, LT, fossil (beta)', '1.00E+00', '', '', '', ''])
weighting_info_damage.insert(23, ['CC, EQ, mar, ST, fossil (beta)', '1.00E+00', '', '', '', ''])
weighting_info_damage.insert(24, ['Fisheries impact', '1.00E+00', '', '', '', ''])
weighting_info_damage[29] = ['Ionizing radiations, ecosystem quality', '1.00E+00', '', '', '', '']
weighting_info_damage.insert(34, ['Marine ecotoxicity, long term', '1.00E+00', '', '', '', ''])
weighting_info_damage.insert(35, ['Marine ecotoxicity, short term', '1.00E+00', '', '', '', ''])
weighting_info_damage.insert(37,
['Photochemical ozone formation, ecosystem quality', '1.00E+00', '', '', '', ''])
weighting_info_damage.insert(38, ['Physical effects on biota', '1.00E+00', '', '', '', ''])
weighting_info_damage.insert(40, ['Terrestrial ecotoxicity, long term', '1.00E+00', '', '', '', ''])
weighting_info_damage.insert(41, ['Terrestrial ecotoxicity, short term', '1.00E+00', '', '', '', ''])
weighting_info_damage.insert(6, ['CC, HH, LT, biogenic', '1.00E+00', '', '', '', ''])
weighting_info_damage.insert(7, ['CC, HH, ST, biogenic', '1.00E+00', '', '', '', ''])
weighting_info_damage.insert(8, ['CC, HH, LT, CO2 uptake', '1.00E+00', '', '', '', ''])
weighting_info_damage.insert(9, ['CC, HH, ST, CO2 uptake', '1.00E+00', '', '', '', ''])
weighting_info_damage.insert(10, ['CC, HH, LT, land transformation', '1.00E+00', '', '', '', ''])
weighting_info_damage.insert(11, ['CC, HH, ST, land transformation', '1.00E+00', '', '', '', ''])
weighting_info_damage.insert(28, ['CC, EQ, terr, LT, biogenic', '1.00E+00', '', '', '', ''])
weighting_info_damage.insert(29, ['CC, EQ, terr, ST, biogenic', '1.00E+00', '', '', '', ''])
weighting_info_damage.insert(30, ['CC, EQ, terr, LT, CO2 uptake', '1.00E+00', '', '', '', ''])
weighting_info_damage.insert(31, ['CC, EQ, terr, ST, CO2 uptake', '1.00E+00', '', '', '', ''])
weighting_info_damage.insert(32,
['CC, EQ, terr, LT, land transformation', '1.00E+00', '', '', '', ''])
weighting_info_damage.insert(33,
['CC, EQ, terr, ST, land transformation', '1.00E+00', '', '', '', ''])
weighting_info_damage.insert(36, ['CC, EQ, mar, LT, biogenic (beta)', '1.00E+00', '', '', '', ''])
weighting_info_damage.insert(37, ['CC, EQ, mar, ST, biogenic (beta)', '1.00E+00', '', '', '', ''])
weighting_info_damage.insert(38, ['CC, EQ, mar, LT, CO2 uptake (beta)', '1.00E+00', '', '', '', ''])
weighting_info_damage.insert(39, ['CC, EQ, mar, ST, CO2 uptake (beta)', '1.00E+00', '', '', '', ''])
weighting_info_damage.insert(40,
['CC, EQ, mar, LT, land transformation (beta)', '1.00E+00', '', '', '', ''])
weighting_info_damage.insert(41,
['CC, EQ, mar, ST, land transformation (beta)', '1.00E+00', '', '', '', ''])
weighting_info_combined = weighting_info_damage.copy()
weighting_info_combined[17] = ['Ozone layer depletion (damage)', '1.00E+00', '', '', '', '']
weighting_info_combined[18] = ['Particulate matter formation (damage)', '1.00E+00', '', '', '', '']
weighting_info_combined[43] = ['Freshwater acidification (damage)', '1.00E+00', '', '', '', '']
weighting_info_combined[46] = ['Freshwater eutrophication (damage)', '1.00E+00', '', '', '', '']
weighting_info_combined[48] = ['Land occupation, biodiversity (damage)', '1.00E+00', '', '', '', '']
weighting_info_combined[49] = ['Land transformation, biodiversity (damage)', '1.00E+00', '', '', '', '']
weighting_info_combined[54] = ['Marine eutrophication (damage)', '1.00E+00', '', '', '', '']
weighting_info_combined[56] = ['Physical effects on biota (damage)', '1.00E+00', '', '', '', '']
weighting_info_combined[57] = ['Terrestrial acidification (damage)', '1.00E+00', '', '', '', '']
# extracting midpoint CFs
d_ic_unit = self.iw_sp.loc[self.iw_sp['MP or Damage'] == 'Midpoint',
['Impact category', 'CF unit']].drop_duplicates().set_index('Impact category').iloc[
:,
0].to_dict()
midpoint_values = []
for j in d_ic_unit.keys():
midpoint_values.append(['', '', '', '', '', ''])
midpoint_values.append(['Impact category', '', '', '', '', ''])
midpoint_values.append([j, d_ic_unit[j], '', '', '', ''])
midpoint_values.append(['', '', '', '', '', ''])
midpoint_values.append(['Substances', '', '', '', '', ''])
df = self.iw_sp[self.iw_sp['Impact category'] == j]
df = df[df['CF unit'] == d_ic_unit[j]]
df = df[['Compartment', 'Sub-compartment', 'Elem flow name', 'CAS number', 'CF value', 'Elem flow unit']]
for i in df.index:
if type(df.loc[i, 'CAS number']) == float:
df.loc[i, 'CAS number'] = ''
midpoint_values.append(df.loc[i].tolist())
d_ic_unit = self.iw_sp_carbon_neutrality.loc[self.iw_sp_carbon_neutrality['MP or Damage'] == 'Midpoint',
['Impact category', 'CF unit']].drop_duplicates().set_index(
'Impact category').iloc[:,
0].to_dict()
midpoint_values_carboneutrality = []
for j in d_ic_unit.keys():
midpoint_values_carboneutrality.append(['', '', '', '', '', ''])
midpoint_values_carboneutrality.append(['Impact category', '', '', '', '', ''])
midpoint_values_carboneutrality.append([j, d_ic_unit[j], '', '', '', ''])
midpoint_values_carboneutrality.append(['', '', '', '', '', ''])
midpoint_values_carboneutrality.append(['Substances', '', '', '', '', ''])
df = self.iw_sp_carbon_neutrality[self.iw_sp_carbon_neutrality['Impact category'] == j]
df = df[df['CF unit'] == d_ic_unit[j]]
df = df[['Compartment', 'Sub-compartment', 'Elem flow name', 'CAS number', 'CF value', 'Elem flow unit']]
for i in df.index:
if type(df.loc[i, 'CAS number']) == float:
df.loc[i, 'CAS number'] = ''
midpoint_values_carboneutrality.append(df.loc[i].tolist())
# extracting damage CFs
d_ic_unit = self.iw_sp.loc[self.iw_sp['MP or Damage'] == 'Damage',
['Impact category', 'CF unit']].drop_duplicates().set_index('Impact category').iloc[
:,
0].to_dict()
damage_values = []
for j in d_ic_unit.keys():
damage_values.append(['', '', '', '', '', ''])
damage_values.append(['Impact category', '', '', '', '', ''])
damage_values.append([j, d_ic_unit[j], '', '', '', ''])
damage_values.append(['', '', '', '', '', ''])
damage_values.append(['Substances', '', '', '', '', ''])
df = self.iw_sp[self.iw_sp['Impact category'] == j]
df = df[df['CF unit'] == d_ic_unit[j]]
df = df[['Compartment', 'Sub-compartment', 'Elem flow name', 'CAS number', 'CF value', 'Elem flow unit']]
for i in df.index:
if type(df.loc[i, 'CAS number']) == float:
df.loc[i, 'CAS number'] = ''
damage_values.append(df.loc[i].tolist())
d_ic_unit = self.iw_sp_carbon_neutrality.loc[self.iw_sp_carbon_neutrality['MP or Damage'] == 'Damage',
['Impact category', 'CF unit']].drop_duplicates().set_index(
'Impact category').iloc[:,
0].to_dict()
damage_values_carboneutrality = []
for j in d_ic_unit.keys():
damage_values_carboneutrality.append(['', '', '', '', '', ''])
damage_values_carboneutrality.append(['Impact category', '', '', '', '', ''])
damage_values_carboneutrality.append([j, d_ic_unit[j], '', '', '', ''])
damage_values_carboneutrality.append(['', '', '', '', '', ''])
damage_values_carboneutrality.append(['Substances', '', '', '', '', ''])
df = self.iw_sp_carbon_neutrality[self.iw_sp_carbon_neutrality['Impact category'] == j]
df = df[df['CF unit'] == d_ic_unit[j]]
df = df[['Compartment', 'Sub-compartment', 'Elem flow name', 'CAS number', 'CF value', 'Elem flow unit']]
for i in df.index:
if type(df.loc[i, 'CAS number']) == float:
df.loc[i, 'CAS number'] = ''
damage_values_carboneutrality.append(df.loc[i].tolist())
# extracting combined CFs
ic_unit = self.iw_sp.loc[:, ['Impact category', 'CF unit']].drop_duplicates()
same_names = ['Freshwater acidification', 'Freshwater eutrophication', 'Land occupation, biodiversity',
'Land transformation, biodiversity', 'Marine eutrophication', 'Ozone layer depletion',
'Particulate matter formation', 'Terrestrial acidification',
'Physical effects on biota']
combined_values = []
for j in ic_unit.index:
combined_values.append(['', '', '', '', '', ''])
combined_values.append(['Impact category', '', '', '', '', ''])
if ic_unit.loc[j, 'Impact category'] in same_names:
if ic_unit.loc[j, 'CF unit'] in ['DALY', 'PDF.m2.yr']:
combined_values.append([ic_unit.loc[j, 'Impact category'] + ' (damage)',
ic_unit.loc[j, 'CF unit'], '', '', '', ''])
else:
combined_values.append([ic_unit.loc[j, 'Impact category'] + ' (midpoint)',
ic_unit.loc[j, 'CF unit'], '', '', '', ''])
else:
combined_values.append([ic_unit.loc[j, 'Impact category'],
ic_unit.loc[j, 'CF unit'], '', '', '', ''])
combined_values.append(['', '', '', '', '', ''])
combined_values.append(['Substances', '', '', '', '', ''])
df = self.iw_sp.loc[[i for i in self.iw_sp.index if (
self.iw_sp.loc[i, 'Impact category'] == ic_unit.loc[j, 'Impact category'] and
self.iw_sp.loc[i, 'CF unit'] == ic_unit.loc[j, 'CF unit'])]]
df = df[['Compartment', 'Sub-compartment', 'Elem flow name', 'CAS number', 'CF value', 'Elem flow unit']]
for i in df.index:
if type(df.loc[i, 'CAS number']) == float:
df.loc[i, 'CAS number'] = ''
combined_values.append(df.loc[i].tolist())
ic_unit = self.iw_sp_carbon_neutrality.loc[:, ['Impact category', 'CF unit']].drop_duplicates()
same_names = ['Freshwater acidification', 'Freshwater eutrophication', 'Land occupation, biodiversity',
'Land transformation, biodiversity', 'Marine eutrophication', 'Ozone layer depletion',
'Particulate matter formation', 'Terrestrial acidification',
'Physical effects on biota']
combined_values_carboneutrality = []
for j in ic_unit.index:
combined_values_carboneutrality.append(['', '', '', '', '', ''])
combined_values_carboneutrality.append(['Impact category', '', '', '', '', ''])
if ic_unit.loc[j, 'Impact category'] in same_names:
if ic_unit.loc[j, 'CF unit'] in ['DALY', 'PDF.m2.yr']:
combined_values_carboneutrality.append([ic_unit.loc[j, 'Impact category'] + ' (damage)',
ic_unit.loc[j, 'CF unit'], '', '', '', ''])
else:
combined_values_carboneutrality.append([ic_unit.loc[j, 'Impact category'] + ' (midpoint)',
ic_unit.loc[j, 'CF unit'], '', '', '', ''])
else:
combined_values_carboneutrality.append([ic_unit.loc[j, 'Impact category'],
ic_unit.loc[j, 'CF unit'], '', '', '', ''])
combined_values_carboneutrality.append(['', '', '', '', '', ''])
combined_values_carboneutrality.append(['Substances', '', '', '', '', ''])
df = self.iw_sp_carbon_neutrality.loc[[i for i in self.iw_sp_carbon_neutrality.index if (
self.iw_sp_carbon_neutrality.loc[i, 'Impact category'] == ic_unit.loc[j, 'Impact category'] and
self.iw_sp_carbon_neutrality.loc[i, 'CF unit'] == ic_unit.loc[j, 'CF unit'])]]
df = df[['Compartment', 'Sub-compartment', 'Elem flow name', 'CAS number', 'CF value', 'Elem flow unit']]
for i in df.index:
if type(df.loc[i, 'CAS number']) == float:
df.loc[i, 'CAS number'] = ''
combined_values_carboneutrality.append(df.loc[i].tolist())
# extracting simplified values
ic_unit = self.simplified_version_sp.loc[:, ['Impact category', 'CF unit']].drop_duplicates()
simplified_values = []
for j in ic_unit.index:
simplified_values.append(['', '', '', '', '', ''])
simplified_values.append(['Impact category', '', '', '', '', ''])
simplified_values.append([ic_unit.loc[j, 'Impact category'],
ic_unit.loc[j, 'CF unit'], '', '', '', ''])
simplified_values.append(['', '', '', '', '', ''])
simplified_values.append(['Substances', '', '', '', '', ''])
df = self.simplified_version_sp.loc[[i for i in self.simplified_version_sp.index if (
self.simplified_version_sp.loc[i, 'Impact category'] == ic_unit.loc[j, 'Impact category'] and
self.simplified_version_sp.loc[i, 'CF unit'] == ic_unit.loc[j, 'CF unit'])]]
df = df[['Compartment', 'Sub-compartment', 'Elem flow name', 'CAS number', 'CF value', 'Elem flow unit']]
for i in df.index:
simplified_values.append(df.loc[i].tolist())
# dump everything in an attribute
self.sp_data = {'metadata': metadata, 'midpoint_method_metadata': midpoint_method_metadata,
'damage_method_metadata': damage_method_metadata,
'combined_method_metadata': combined_method_metadata,
'simplified_method_metadata': simplified_method_metadata,