Closed MMahdi97 closed 2 weeks ago
I will look into this, thx.
I get a similar issue for the consequential version if I do not update electricity. If I do update electricity, I get the following error:
I think it is related to the premise version. I think the last version which is 2.1 has some bugs. I have installed an older version and it works.
I have the same bug with 2.1. Which version did you use @MMahdi97 :question: Thanks!
I have the same bug with 2.1. Which version did you use @MMahdi97 ❓ Thanks!
I managed to use write_db_to_brightway
using version 2.0.0
I’ll have a look and provide a fix shortly.Can someone paste the script used to generate this error?On 4 Jun 2024, at 10:28, Laurent Drouet @.***> wrote:
I have the same bug with 2.1. Which version did you use @MMahdi97 ❓ Thanks!
I managed to use write_db_to_brightway using version 2.0.0
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>
Here is the script (based on the example one)
import brightway2 as bw
bw.projects.set_current("iamc_db_test")
bw.bw2setup()
if 'ecoinvent 3.9.1_cutoff_ecoSpold02' in bw.databases:
print("Database has already been imported.")
else:
# The ecoinvent file must be unzipped; then: path to the datasets subfolder
dir_ei391cut = r"datasets"
ei391cut = bw.SingleOutputEcospold2Importer(dir_ei391cut, 'ecoinvent 3.9.1_cutoff_ecoSpold02')
ei391cut
ei391cut.apply_strategies()
ei391cut.statistics()
ei391cut.write_database()
from premise import *
ndb = NewDatabase(
scenarios=[
{"model":"image", "pathway":"SSP2-RCP19", "year":2050},
{"model":"remind", "pathway":"SSP2-PkBudg500", "year":2050},
],
source_db="ecoinvent 3.9.1_cutoff_ecoSpold02", # <-- name of the database in the BW2 project. Must be a string.
source_version="3.9.1", # <-- version of ecoinvent. Can be "3.5", "3.6", "3.7" or "3.8". Must be a string.
key='xx', # <-- decryption key
# to be requested from the library maintainers if you want ot use default scenarios included in `premise`
#use_multiprocessing=True, # True by default, set to False if multiprocessing is causing troubles
keep_uncertainty_data=False, # False by default, set to True if you want to keep ecoinvent's uncertainty data
use_absolute_efficiency=True, # False by default, set to True if you want to use the IAM's absolute efficiency for power plants
)
ndb.write_db_to_brightway()
@lolow I am using premise 2.0.2
@romainsacchi Before I was using 2.1 and I had the problem.
Here is the script (based on the example one)
import brightway2 as bw bw.projects.set_current("iamc_db_test") bw.bw2setup() if 'ecoinvent 3.9.1_cutoff_ecoSpold02' in bw.databases: print("Database has already been imported.") else: # The ecoinvent file must be unzipped; then: path to the datasets subfolder dir_ei391cut = r"datasets" ei391cut = bw.SingleOutputEcospold2Importer(dir_ei391cut, 'ecoinvent 3.9.1_cutoff_ecoSpold02') ei391cut ei391cut.apply_strategies() ei391cut.statistics() ei391cut.write_database() from premise import * ndb = NewDatabase( scenarios=[ {"model":"image", "pathway":"SSP2-RCP19", "year":2050}, {"model":"remind", "pathway":"SSP2-PkBudg500", "year":2050}, ], source_db="ecoinvent 3.9.1_cutoff_ecoSpold02", # <-- name of the database in the BW2 project. Must be a string. source_version="3.9.1", # <-- version of ecoinvent. Can be "3.5", "3.6", "3.7" or "3.8". Must be a string. key='xx', # <-- decryption key # to be requested from the library maintainers if you want ot use default scenarios included in `premise` #use_multiprocessing=True, # True by default, set to False if multiprocessing is causing troubles keep_uncertainty_data=False, # False by default, set to True if you want to keep ecoinvent's uncertainty data use_absolute_efficiency=True, # False by default, set to True if you want to use the IAM's absolute efficiency for power plants ) ndb.write_db_to_brightway()
Hi @lolow , here the issue is that you do not apply any scenario integration (ndb.update()
) before writing the database to the brightway project. So, there is not, at this point in your script, an existing database yet. If you did not have this error, the database you would export back would anyway not be "prospective" since it would be a mere copy of the original LCA database. I will provide a more informative error message.
I have the same bug with 2.1. Which version did you use @MMahdi97 ❓ Thanks!
I managed to use
write_db_to_brightway
using version 2.0.0
And the reason it worked with an earlier version is because of how we store databases (so you are able to write the database in v.2.0 but that database is not transformed yet based on the IAM scenario. But in summary, you can use the latest version, and add a "transformation" step before writing the database (e.g., ndb.update()).
Hello everyone,
I have used ecoinvent database version 3.9 cut off and remind SSP2-Base scenario to creat a database, but when I want to use ndb.write_db_to_simapro() there is an error that I cannot understand what I should do. Here is the error:
This code worked several days ago, but it does not work now. Could someone please help me to solve it?
Hi @MMahdi97, similar to @lolow : could it be you did not run the transformation step (ndb.update()) before writing the database?
I confirm that doing ndb.update()
before ndb.write_db_to_brightway()
is solving the issue.
Hello @B-Maes @MMahdi97, I believe v.2.1.1.dev0
should fix these issues now. Please let me know.
Hello everyone,
I have used ecoinvent database version 3.9 cut off and remind SSP2-Base scenario to creat a database, but when I want to use ndb.write_db_to_simapro() there is an error that I cannot understand what I should do. Here is the error:![image](https://github.com/polca/premise/assets/170021288/bc271cb8-d810-4cba-bcdd-af2280c01f5c)
This code worked several days ago, but it does not work now. Could someone please help me to solve it?