Chris Mutel avatar Chris Mutel committed e7505ca

Don't hard code biosphere database name

Comments (0)

Files changed (1)

bw2calc/sensitivity/parameter_utils.py

 # -*- coding: utf-8 -*
 from ..mc_vector import ParameterVectorLCA
-from bw2data import Database
+from bw2data import Database, config
 
 
 class ParameterNaming(object):
     """Translate parameter indices into something meaningful to humans."""
     def __init__(self, lca):
         assert isinstance(lca, ParameterVectorLCA)
-        self.databases = {"biosphere": Database("biosphere").load()}
+        self.databases = {"biosphere": Database(config.biosphere).load()}
         self.lca = lca
         self.positions = self.lca.positions
         self.lca.fix_dictionaries()
         elif kind == "bio":
             offset = self.positions['tech'][1]
             row_key = self.rb[self.lca.bio_params[index - offset]['row']]
-            input_ds = self.databases["biosphere"][row_key]
+            input_ds = self.databases[config.biosphere][row_key]
             col_key = self.rt[self.lca.bio_params[index - offset]['col']]
             if col_key[0] not in self.databases:
                 self.databases[col_key[0]] = Database(col_key[0]).load()
         elif kind == "cf":
             offset = self.positions['bio'][1]
             row_key = self.rb[self.lca.cf_params[index - offset]['index']]
-            ds = self.databases["biosphere"][row_key]
+            ds = self.databases[config.biosphere][row_key]
             return "CF: %s (%s)" % (ds['name'], "-".join(ds['categories']))
 
     def get_kind(self, index):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.