Open Paul-Robineau opened 4 months ago
Some update:
By looking at the code, it seems like the init of the ExcelLCIAImporter class in the excel_lcia.py prevents or cancels the init of the LCIAImporter class in the base_lcia.py.
The LCIAImporter class init in base_lcia.py:
class LCIAImporter(ImportBase):
def __init__(self, filepath, biosphere=None):
print("init yup")
self.applied_strategies = []
self.filepath = filepath
self.biosphere_name = biosphere or config.biosphere
if self.biosphere_name not in databases:
raise ValueError(
"Can't find biosphere database {}".format(self.biosphere_name)
)
self.strategies = [
# [...] the code continues
The excel_lcia.py import the LCIAImporter class, so biosphere_name should be ok, but then we have the ExcelLCIAImporter class init :
class ExcelLCIAImporter(LCIAImporter):
# [...] Some code commmentaries
format = "Excel"
extractor = ExcelExtractor
def __init__(self, filepath, name, description, unit, **metadata):
assert isinstance(name, tuple)
super(ExcelLCIAImporter, self).__init__(filepath, biosphere=None)
self.strategies = [
# [...] the code continues
The line super(ExcelLCIAImporter, self).__init__(filepath, biosphere=None)
was added on our side after looking at the structure of the init of the SimaProLCIACSVImporter class, which contains an analog line, which gave the idea. When it's added, the AttributeError on biosphere_name of the ExcelLCIAImporter disappears.
Not sure if it's the proper way to fix the issue, but hope it helps!
Hello there,
I am trying to import Ucrad as an LCIA method in brightway2, through its Excel file containing the characterization factors for various radionuclides. I've followed the documentation and use the code below, which works fine in theory (tested on the already present ionising radiations: human health method in EFv3.1, by extracting the data from the .json, building an Excel in the correct form, and do the import).
Output:
Then:
Returns:
As the unlinked cfs come from the ones addressing unpresent biosphere flows, I thus do:
Which returns:
I don't understand the problem, did I miss something obvious?
Paul