I have an ecospold1 dataset extracted from openLCA and I would like to import it into Brightway2. Using the SingleOutputEcospold1Importer should read the ecospold files but apparently something is wrong in the file schema.
Given the possible export formats of openLCA and the possible import formats of Brightway2, ecospold1 seems to be the only common format. If there is any other way to do it, I would be happy to try.
Code:
import brightway2 as bw
bw.projects.set_current('importing_ecospold1')
bw.bw2setup()
fp = "path/to/EcoSpold01"
importer = bw.SingleOutputEcospold1Importer(fp, 'database_name', use_mp=False)
Output
File ~\miniconda3\envs\playing_with_brightway\lib\site-packages\bw2io\extractors\ecospold1.py:132, in Ecospold1DataExtractor.process_dataset(cls, dataset, filename, db_name)
109 @classmethod
110 def process_dataset(cls, dataset, filename, db_name):
111 ref_func = dataset.metaInformation.processInformation.referenceFunction
112 comments = [
113 ref_func.get("generalComment"),
114 ref_func.get("includedProcesses"),
115 (
116 "Location: ",
117 dataset.metaInformation.processInformation.geography.get("text"),
118 ),
119 (
120 "Technology: ",
121 dataset.metaInformation.processInformation.technology.get("text"),
122 ),
123 (
124 "Time period: ",
125 getattr2(dataset.metaInformation.processInformation, "timePeriod").get(
126 "text"
127 ),
128 ),
129 (
130 "Production volume: ",
131 getattr2(
--> 132 dataset.metaInformation.modellingAndValidation, "representativeness"
133 ).get("productionVolume"),
134 ),
135 (
136 "Sampling: ",
137 getattr2(
138 dataset.metaInformation.modellingAndValidation, "representativeness"
139 ).get("samplingProcedure"),
140 ),
141 (
142 "Extrapolations: ",
143 getattr2(
144 dataset.metaInformation.modellingAndValidation, "representativeness"
145 ).get("extrapolations"),
146 ),
147 (
148 "Uncertainty: ",
149 getattr2(
150 dataset.metaInformation.modellingAndValidation, "representativeness"
151 ).get("uncertaintyAdjustments"),
152 ),
153 ]
155 def get_authors():
156 ai = dataset.metaInformation.administrativeInformation
File src/lxml/objectify.pyx:234, in lxml.objectify.ObjectifiedElement.__getattr__()
File src/lxml/objectify.pyx:453, in lxml.objectify._lookupChildOrRaise()
AttributeError: no such child: {http://www.EcoInvent.org/EcoSpold01}modellingAndValidation
This will be hard to fix in the SO format - if your data is not confidential, please file a new brightway2-io issue with some sample data. If your data is confidential, you will need to make up an example project and export that, we need to XML files to fix this.