premise-community-scenarios / scenario-example-bread Goto Github PK
View Code? Open in Web Editor NEWThis is an example of a repository containing a custom prospective scenario for bread, to be used in premise
This is an example of a repository containing a custom prospective scenario for bread, to be used in premise
Hi!
After successfully running the code that adds an external scenario (bread scenario), I applied the ndb.update_all() function.
Then, after a while, I got an error message when the code was updating the fuel supply chains (I copied and pasted below what I got). I would like to know how to solve it so that I can write the database with the bread scenario. Thanks a lot!
IndexError Traceback (most recent call last)
Input In [6], in
----> 1 ndb.update_all()
File ~\Miniconda3\envs\bw2\lib\site-packages\premise\ecoinvent_modification.py:983, in NewDatabase.update_all(self)
981 self.update_cement()
982 self.update_steel()
--> 983 self.update_fuels()
984 self.update_external_scenario()
File ~\Miniconda3\envs\bw2\lib\site-packages\premise\ecoinvent_modification.py:781, in NewDatabase.update_fuels(self)
771 if "exclude" not in scenario or "update_fuels" not in scenario["exclude"]:
773 fuels = Fuels(
774 database=scenario["database"],
775 iam_data=scenario["iam data"],
(...)
779 version=self.version,
780 )
--> 781 fuels.generate_fuel_markets()
782 scenario["database"] = fuels.database
File ~\Miniconda3\envs\bw2\lib\site-packages\premise\fuels.py:1507, in Fuels.generate_fuel_markets(self)
1503 """Create new fuel supply chains
1504 and update existing fuel markets"""
1506 # Create new fuel supply chains
-> 1507 self.generate_fuel_supply_chains()
1509 print("Generate new fuel markets.")
1511 # we start by creating region-specific "diesel, burned in" markets
File ~\Miniconda3\envs\bw2\lib\site-packages\premise\fuels.py:1488, in Fuels.generate_fuel_supply_chains(self)
1486 # hydrogen
1487 print("Generate region-specific hydrogen production pathways.")
-> 1488 self.generate_hydrogen_activities()
1490 # biogas
1491 print("Generate region-specific biogas and syngas supply chains.")
File ~\Miniconda3\envs\bw2\lib\site-packages\premise\fuels.py:311, in Fuels.generate_hydrogen_activities(self)
307 hydrogen_sources = fetch_mapping(HYDROGEN_SOURCES)
309 for hydrogen_type, hydrogen_activity in hydrogen_sources.items():
--> 311 new_ds = self.fetch_proxies(
312 name=hydrogen_activity["name"],
313 ref_prod="Hydrogen",
314 production_variable=hydrogen_activity["var"],
315 relink=True,
316 )
318 for region, dataset in new_ds.items():
319
320 # we adjust the electrolysis efficiency
321 if hydrogen_type == "from electrolysis":
File ~\Miniconda3\envs\bw2\lib\site-packages\premise\transformation.py:381, in BaseTransformation.fetch_proxies(self, name, ref_prod, production_variable, relink, regions)
362 def fetch_proxies(
363 self, name, ref_prod, production_variable=None, relink=True, regions=None
364 ) -> Dict[str, dict]:
365 """
366 Fetch dataset proxies, given a dataset name
and reference product
.
367 Store a copy for each IAM region.
(...)
378 :return: dictionary with IAM regions as keys, proxy datasets as values.
379 """
--> 381 d_iam_to_eco = self.region_to_proxy_dataset_mapping(
382 name=name, ref_prod=ref_prod, regions=regions
383 )
385 d_act = {}
387 ds_name, ds_ref_prod = [None, None]
File ~\Miniconda3\envs\bw2\lib\site-packages\premise\transformation.py:358, in BaseTransformation.region_to_proxy_dataset_mapping(self, name, ref_prod, regions)
356 fallback_loc = "GLO"
357 else:
--> 358 fallback_loc = list(d_map.values())[0]
360 return {region: d_map.get(region, fallback_loc) for region in regions}
IndexError: list index out of range
โ
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.