Chris Mutel committed 5c7c8dd

Updated for new Brightway database and method managing

Comments (0)

Files changed (2)

 # -*- coding: utf-8 -*
 from __future__ import division
 from brightway2 import config as base_config
-from brightway2 import meta, methods, mapping
+from brightway2 import databases, methods, mapping
 from brightway2.proxies import OneDimensionalArrayProxy, \
 from brightway2.utils import MAX_INT_32
     def get_databases(self):
         """Get list of databases for functional unit"""
-        return set.union(*[set(meta[key[0]]["depends"] + [key[0]]) for key \
+        return set.union(*[set(databases[key[0]]["depends"] + [key[0]]) for key \
             in self.demand])
     def load_databases(self):
     def score(self):
         assert hasattr(self, "characterized_inventory"), "Must do LCIA first"
         return float(self.characterized_inventory.sum())
+    def reverse_dict(self):
+        """Construct reverse dicts from row and col indices to processes"""
+        rev_mapping = dict([(v, k) for k, v in mapping.iteritems()])
+        rev_tech = dict([(v, rev_mapping[k]) for k, v in \
+            self.technosphere_dict.iteritems()])
+        rev_bio = dict([(v, rev_mapping[k]) for k, v in \
+            self.biosphere_dict.iteritems()])
+        return rev_tech, rev_bio
   author="Chris Mutel",
+  url="",