Chris Mutel avatar Chris Mutel committed 990d871

Improve group_by_emissions to consider realms like soil, air, etc.

Comments (0)

Files changed (1)


 def group_by_emissions(method):
-    """Group characterization factors by name and unit.
+    """Group characterization factors by name, realm, and unit.
+    **realm** is the general category, e.g. air, soil, water.
     Does not work on regionalized LCIA methods!
         *method* (tuple or Method): LCIA method
-        Dictionary: {(name, unit)}: [cfs... ]
+        Dictionary: {(name, realm, unit)}: [cfs... ]
     if isinstance(method, Method):
             # Alternative biosphere, e.g. Ecoinvent 3. Add new biosphere DB
         flow = biosphere[key]
-        label = (flow["name"], flow["unit"])
+        label = (flow["name"], flow.get("categories", [""])[0], flow["unit"])
         grouped.setdefault(label, []).append(cf)
     return grouped
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
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.