-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
problem with excel importer #1021
Comments
could it be a memory problem, since it doesn't work with larger files?? |
Hi @simb-sdu, I think this is an unrelated issue to what I had, I was getting segmentation faults from an issue that I think is related to multi-threading. Would it be possible to share your database, so that it's possible to see where the problem is starting? KR, |
Hi J Plase send me an email on simb@igt.sdu.dk and i will share the excel datebase. it's my colleagues data so I dont think i can put it publicly
|
Hi @simb-sdu you can use this address kidnerjh@vuw.leidenuniv.nl |
I solved the problem! edit: thanks for answering @Zoophobus, it somehow helped get my "diagnozing" in the right direction It appears that my excel file had some wrong values for a few
this gave the error eventually i opened the log file |
@Zoophobus, You have some more experience with writing good error messages with the scenarios imports, do you think we can do something useful with this for users?
Kind regards,
Marc van der Meide
PhD Candidate
Leiden University | Faculty of Science - Institute of environmental sciences (CML)
Einsteinweg 2 | Leiden 2333 CC | linkedin<https://www.linkedin.com/in/marcvandermeide/?locale=en_US>
…________________________________
From: Simon Bruhn ***@***.***>
Sent: Friday, August 25, 2023 19:07
To: LCA-ActivityBrowser/activity-browser ***@***.***>
Cc: Subscribed ***@***.***>
Subject: Re: [LCA-ActivityBrowser/activity-browser] problem with excel importer (Issue #1021)
I solved the problem!
It appears that my excel file had some wrong values for a few locations and units. however this was impossible to spot via activity-browser. i found it by importing manually in brigthway with the following code
`
import bw2data as bd
import bw2calc as bc
import bw2io as bi
#import bw_processing as bwp
import numpy as np
from pathlib import Path
import pandas as pd
bd.projects.set_current('sarah-ei391')
imp = bi.ExcelImporter("/home/simb/Nextcloud/Cut-off_DK_BAU.xlsx")
imp.apply_strategies()
imp.match_database("cutoff391", fields=('name','unit','location', 'reference product'))
imp.match_database(fields=('name', 'unit', 'location'))
imp.statistics()
imp.write_excel()
imp.write_database()`
this gave the error
1 unlinked exchanges Type technosphere: 1 unique unlinked exchanges Wrote matching file to: /home/simb/.local/share/Brightway3/sarah-ei391.e7b311ea4751b039a2d93e8d91891004/output/db-matching-Cut-off_DK_BAU.xlsx Writing activities to SQLite3 database: 0% [######## ] 100% | ETA: 00:00:01Traceback (most recent call last): File "/home/simb/Nextcloud/sarah case study/excelimport.py", line 21, in <module> imp.write_database() File "/home/simb/miniconda3/envs/ab/lib/python3.9/site-packages/bw2io/importers/excel.py", line 277, in write_database super(ExcelImporter, self).write_database(**kwargs) File "/home/simb/miniconda3/envs/ab/lib/python3.9/site-packages/bw2io/importers/base_lci.py", line 269, in write_database db.write(existing) File "/home/simb/miniconda3/envs/ab/lib/python3.9/site-packages/bw2data/project.py", line 358, in writable_project return wrapped(*args, **kwargs) File "/home/simb/miniconda3/envs/ab/lib/python3.9/site-packages/bw2data/backends/peewee/database.py", line 260, in write self._efficient_write_many_data(data) File "/home/simb/miniconda3/envs/ab/lib/python3.9/site-packages/bw2data/backends/peewee/database.py", line 204, in _efficient_write_many_data exchanges, activities = self._efficient_write_dataset( File "/home/simb/miniconda3/envs/ab/lib/python3.9/site-packages/bw2data/backends/peewee/database.py", line 156, in _efficient_write_dataset raise InvalidExchange bw2data.errors.InvalidExchange
eventually i opened the log file Wrote matching file to: /home/simb/.local/share/Brightway3/sarah-ei391.e7b311ea4751b039a2d93e8d91891004/output/db-matching-Cut-off_DK_BAU.xlsx and here the invalid exchanges were highlighted with red. There I could see that the unit for electricity was in megajoule, and not kilowatt hour. hence it could not match to the ecoinvent dataset where it is given in kilowatt hour
—
Reply to this email directly, view it on GitHub<#1021 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AIIFUDUDLOYG2PNU5K6HGLTXXDLTRANCNFSM6AAAAAA36U5K4U>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
The excel importer asks me to identify the database
Cut-off_DK_BAU
. However that is the name of the databse i want to import! So it should be able to dientify itself.As you can see in the following screenshot, all exchanges gets the db name from cell B1 which ahs the value
![image](https://private-user-images.githubusercontent.com/94962841/263309780-c67e46f2-4066-4b92-9cf9-e01945ef17e0.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk1NDYwMTgsIm5iZiI6MTcxOTU0NTcxOCwicGF0aCI6Ii85NDk2Mjg0MS8yNjMzMDk3ODAtYzY3ZTQ2ZjItNDA2Ni00YjkyLTljZjktZTAxOTQ1ZWYxN2UwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjI4VDAzMzUxOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTRhZTA2MDAxNWIwMjg2ZDkwNWIxYzI0OWQ1N2MxYzVhMjA2MmVhZmY1YTFmN2RiN2U2MjY3MzBhZWFlNDNiMTUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.Hwj3RztRuHMFISV2ngioWWtbjFropf5dWJxDRhzYK7E)
Cut-off_DK_BAU
Cant figure out what triggers this issue - which means i cannot import my excel databse. Yesterday I made a very small test databse with just one exchange, and that worked fine
The text was updated successfully, but these errors were encountered: