OcelotProject / Ocelot

Ocelot is open-source linking for life cycle assessment. See https://ocelot.space/ for more information.
Other
26 stars 7 forks source link

KeyError with 3.3 (or 3.2?) #123

Closed cmutel closed 7 years ago

cmutel commented 8 years ago

Reported by Brian Cox:

Starting Ocelot model run
Using cached ecospold2 data
Opening log file at: C:\Users\cox_b\AppData\Local\ocelot_project\Ocelot\model-runs\9da4b04d1dd640ec9af1b86b2be8c7f4\report.log.json
Applying transformation variable_names_are_unique
Applying transformation ensure_markets_only_have_one_reference_product
Applying transformation ensure_markets_dont_consume_their_ref_product
Applying transformation fix_specific_ecoinvent_issues
Applying transformation replace_implicit_references
Applying transformation fix_known_bad_formula_strings
Applying transformation lowercase_all_parameters
Applying transformation fix_math_formulas
Applying transformation replace_reserved_words
Applying transformation delete_unparsable_formulas
Applying transformation ensure_production_exchanges_have_production_volume
Applying transformation add_pv_to_allocatable_byproducts
Applying transformation create_pv_parameters
Applying transformation remove_consequential_exchanges
Applying transformation drop_rp_activity_links
Applying transformation drop_zero_amount_activity_links
Applying transformation check_activity_link_validity
Applying transformation add_hard_linked_production_volumes
Applying transformation rename_recyclable_content_exchanges
Applying transformation create_recycled_content_datasets
Applying transformation flip_non_allocatable_byproducts
Applying transformation label_allocation_method
Applying transformation economic_allocation
Applying transformation constrained_market_allocation
Applying transformation recycling_allocation
Applying transformation waste_treatment_allocation
Applying transformation combined_production_without_products
Applying transformation combined_production
NameError
   5.36e-11* cement+silica_fume*0+ blast_furnace_slag*0+ flyash*0
                     ^^^
name 'silica_fume' is not defined
NameError
   5.36e-11* cement+silica_fume*0+ blast_furnace_slag*0+ flyash*0
                     ^^^
name 'silica_fume' is not defined
Applying transformation combined_production_with_byproducts
Applying transformation delete_allocation_method
Applying transformation drop_rp_activity_links
Applying transformation label_reference_product
Applying transformation delete_allowed_zero_pv_market_datsets
Applying transformation assign_fake_pv_to_confidential_datasets
Applying transformation relabel_global_to_row
Applying transformation add_unique_codes
Applying transformation actualize_activity_links
Applying transformation add_recycled_content_suppliers_to_markets
Applying transformation add_suppliers_to_markets
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-2-1eb8162223d7> in <module>()
----> 1 ocelot.system_model('unlinked', show=True)

C:\Users\cox_b\AppData\Local\Continuum\Miniconda3\envs\ocelot\lib\site-packages\ocelot\model.py in system_model(data_path, config, show, use_cache, save_strategy)
     92             data = apply_transformation(obj, counter, data,
     93                                         output_manager.directory,
---> 94                                         save_strategy)
     95
     96         print("Saving final results")

C:\Users\cox_b\AppData\Local\Continuum\Miniconda3\envs\ocelot\lib\site-packages\ocelot\model.py in apply_transformation(function, counter, data, output_dir, save_strategy)
     25         for obj in function:
     26             data = apply_transformation(obj, counter, data,
---> 27                                         output_dir, save_strategy)
     28         return data
     29     else:

C:\Users\cox_b\AppData\Local\Continuum\Miniconda3\envs\ocelot\lib\site-packages\ocelot\model.py in apply_transformation(function, counter, data, output_dir, save_strategy)
     38
     39         print("Applying transformation {}".format(metadata['name']))
---> 40         data = function(data)
     41         metadata.update(
     42             type="function end",

C:\Users\cox_b\AppData\Local\Continuum\Miniconda3\envs\ocelot\lib\site-packages\ocelot\transformations\locations\markets.py in add_suppliers_to_markets(data, from_type, to_type)
    115             continue
    116         if to_type == 'market activity':
--> 117             no_overlaps(consumers)
    118         apportion_suppliers_to_consumers(consumers, suppliers)
    119     return data

C:\Users\cox_b\AppData\Local\Continuum\Miniconda3\envs\ocelot\lib\site-packages\ocelot\transformations\locations\validation.py in no_overlaps(data)
     34     """Check to make sure activities in ``data`` doesn't have geographic overlaps."""
     35     locations = [x['location'] for x in data]
---> 36     if topology.overlaps(locations):
     37         raise OverlappingActivities
     38     if 'GLO' in locations and len(locations) > 1:

C:\Users\cox_b\AppData\Local\Continuum\Miniconda3\envs\ocelot\lib\site-packages\ocelot\transformations\locations\_topology.py in overlaps(self, group)
     50         if not group:
     51             return None
---> 52         faces = [self(obj) for obj in group]
     53         return len([o for f in faces for o in f]) != len(set.union(*faces))
     54

C:\Users\cox_b\AppData\Local\Continuum\Miniconda3\envs\ocelot\lib\site-packages\ocelot\transformations\locations\_topology.py in <listcomp>(.0)
     50         if not group:
     51             return None
---> 52         faces = [self(obj) for obj in group]
     53         return len([o for f in faces for o in f]) != len(set.union(*faces))
     54

C:\Users\cox_b\AppData\Local\Continuum\Miniconda3\envs\ocelot\lib\site-packages\ocelot\transformations\locations\_topology.py in __call__(self, location)
     56         if location in ('GLO', 'RoW'):
     57             return set()
---> 58         return self.data[location]

KeyError: 'IAI Area, Asia, without China and GCC'
cmutel commented 7 years ago

Can't reproduce with 3.2 or 3.3. Probably fixed in an update of the topo data.