hestia-earth-aggregation 0.21.14__tar.gz → 0.21.15__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. {hestia_earth_aggregation-0.21.14/hestia_earth_aggregation.egg-info → hestia_earth_aggregation-0.21.15}/PKG-INFO +1 -1
  2. {hestia_earth_aggregation-0.21.14 → hestia_earth_aggregation-0.21.15}/hestia_earth/aggregation/utils/aggregate_country_nodes.py +12 -2
  3. {hestia_earth_aggregation-0.21.14 → hestia_earth_aggregation-0.21.15}/hestia_earth/aggregation/utils/emission.py +15 -0
  4. hestia_earth_aggregation-0.21.15/hestia_earth/aggregation/version.py +1 -0
  5. {hestia_earth_aggregation-0.21.14 → hestia_earth_aggregation-0.21.15/hestia_earth_aggregation.egg-info}/PKG-INFO +1 -1
  6. hestia_earth_aggregation-0.21.14/hestia_earth/aggregation/version.py +0 -1
  7. {hestia_earth_aggregation-0.21.14 → hestia_earth_aggregation-0.21.15}/LICENSE +0 -0
  8. {hestia_earth_aggregation-0.21.14 → hestia_earth_aggregation-0.21.15}/MANIFEST.in +0 -0
  9. {hestia_earth_aggregation-0.21.14 → hestia_earth_aggregation-0.21.15}/README.md +0 -0
  10. {hestia_earth_aggregation-0.21.14 → hestia_earth_aggregation-0.21.15}/hestia_earth/aggregation/__init__.py +0 -0
  11. {hestia_earth_aggregation-0.21.14 → hestia_earth_aggregation-0.21.15}/hestia_earth/aggregation/aggregate_cycles.py +0 -0
  12. {hestia_earth_aggregation-0.21.14 → hestia_earth_aggregation-0.21.15}/hestia_earth/aggregation/config/Cycle/processedFood.json +0 -0
  13. {hestia_earth_aggregation-0.21.14 → hestia_earth_aggregation-0.21.15}/hestia_earth/aggregation/log.py +0 -0
  14. {hestia_earth_aggregation-0.21.14 → hestia_earth_aggregation-0.21.15}/hestia_earth/aggregation/recalculate_cycles.py +0 -0
  15. {hestia_earth_aggregation-0.21.14 → hestia_earth_aggregation-0.21.15}/hestia_earth/aggregation/utils/__init__.py +0 -0
  16. {hestia_earth_aggregation-0.21.14 → hestia_earth_aggregation-0.21.15}/hestia_earth/aggregation/utils/aggregate_weighted.py +0 -0
  17. {hestia_earth_aggregation-0.21.14 → hestia_earth_aggregation-0.21.15}/hestia_earth/aggregation/utils/blank_node.py +0 -0
  18. {hestia_earth_aggregation-0.21.14 → hestia_earth_aggregation-0.21.15}/hestia_earth/aggregation/utils/combine.py +0 -0
  19. {hestia_earth_aggregation-0.21.14 → hestia_earth_aggregation-0.21.15}/hestia_earth/aggregation/utils/completeness.py +0 -0
  20. {hestia_earth_aggregation-0.21.14 → hestia_earth_aggregation-0.21.15}/hestia_earth/aggregation/utils/covariance.py +0 -0
  21. {hestia_earth_aggregation-0.21.14 → hestia_earth_aggregation-0.21.15}/hestia_earth/aggregation/utils/cycle.py +0 -0
  22. {hestia_earth_aggregation-0.21.14 → hestia_earth_aggregation-0.21.15}/hestia_earth/aggregation/utils/distribution.py +0 -0
  23. {hestia_earth_aggregation-0.21.14 → hestia_earth_aggregation-0.21.15}/hestia_earth/aggregation/utils/group.py +0 -0
  24. {hestia_earth_aggregation-0.21.14 → hestia_earth_aggregation-0.21.15}/hestia_earth/aggregation/utils/input.py +0 -0
  25. {hestia_earth_aggregation-0.21.14 → hestia_earth_aggregation-0.21.15}/hestia_earth/aggregation/utils/lookup.py +0 -0
  26. {hestia_earth_aggregation-0.21.14 → hestia_earth_aggregation-0.21.15}/hestia_earth/aggregation/utils/management.py +0 -0
  27. {hestia_earth_aggregation-0.21.14 → hestia_earth_aggregation-0.21.15}/hestia_earth/aggregation/utils/measurement.py +0 -0
  28. {hestia_earth_aggregation-0.21.14 → hestia_earth_aggregation-0.21.15}/hestia_earth/aggregation/utils/practice.py +0 -0
  29. {hestia_earth_aggregation-0.21.14 → hestia_earth_aggregation-0.21.15}/hestia_earth/aggregation/utils/product.py +0 -0
  30. {hestia_earth_aggregation-0.21.14 → hestia_earth_aggregation-0.21.15}/hestia_earth/aggregation/utils/property.py +0 -0
  31. {hestia_earth_aggregation-0.21.14 → hestia_earth_aggregation-0.21.15}/hestia_earth/aggregation/utils/quality_score.py +0 -0
  32. {hestia_earth_aggregation-0.21.14 → hestia_earth_aggregation-0.21.15}/hestia_earth/aggregation/utils/queries.py +0 -0
  33. {hestia_earth_aggregation-0.21.14 → hestia_earth_aggregation-0.21.15}/hestia_earth/aggregation/utils/site.py +0 -0
  34. {hestia_earth_aggregation-0.21.14 → hestia_earth_aggregation-0.21.15}/hestia_earth/aggregation/utils/source.py +0 -0
  35. {hestia_earth_aggregation-0.21.14 → hestia_earth_aggregation-0.21.15}/hestia_earth/aggregation/utils/term.py +0 -0
  36. {hestia_earth_aggregation-0.21.14 → hestia_earth_aggregation-0.21.15}/hestia_earth/aggregation/utils/weights.py +0 -0
  37. {hestia_earth_aggregation-0.21.14 → hestia_earth_aggregation-0.21.15}/hestia_earth_aggregation.egg-info/SOURCES.txt +0 -0
  38. {hestia_earth_aggregation-0.21.14 → hestia_earth_aggregation-0.21.15}/hestia_earth_aggregation.egg-info/dependency_links.txt +0 -0
  39. {hestia_earth_aggregation-0.21.14 → hestia_earth_aggregation-0.21.15}/hestia_earth_aggregation.egg-info/requires.txt +0 -0
  40. {hestia_earth_aggregation-0.21.14 → hestia_earth_aggregation-0.21.15}/hestia_earth_aggregation.egg-info/top_level.txt +0 -0
  41. {hestia_earth_aggregation-0.21.14 → hestia_earth_aggregation-0.21.15}/setup.cfg +0 -0
  42. {hestia_earth_aggregation-0.21.14 → hestia_earth_aggregation-0.21.15}/setup.py +0 -0
  43. {hestia_earth_aggregation-0.21.14 → hestia_earth_aggregation-0.21.15}/tests/test_aggregation.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hestia_earth_aggregation
3
- Version: 0.21.14
3
+ Version: 0.21.15
4
4
  Summary: HESTIA's aggregation engine.
5
5
  Home-page: https://gitlab.com/hestia-earth/hestia-aggregation-engine
6
6
  Author: HESTIA Team
@@ -61,7 +61,11 @@ from .site import (
61
61
  format_site_description,
62
62
  site_parent_region_id,
63
63
  )
64
- from .emission import get_method_tier, get_method_model
64
+ from .emission import (
65
+ get_method_tier,
66
+ get_method_model,
67
+ has_value_without_transformation,
68
+ )
65
69
  from .property import aggregate_properties
66
70
  from .distribution import generate_blank_node_distribution
67
71
  from .covariance import add_covariance_cycles, generate_covariance_cycles
@@ -110,6 +114,8 @@ class BlankNodeFormatted(TypedDict, total=False):
110
114
  completeness_key: Optional[str]
111
115
  start_date: Optional[str]
112
116
  end_date: str
117
+ inputs: List[dict]
118
+ transformation: List[dict]
113
119
 
114
120
 
115
121
  # --- Cycle
@@ -243,6 +249,8 @@ def _group_cycle_blank_node(cycle: dict, product: dict, product_value: float):
243
249
  "economicValueShare": non_empty_list([_blank_node_evs(blank_nodes)]),
244
250
  # needed for background emissions
245
251
  "inputs": _map_values(blank_nodes, "inputs"),
252
+ # needed to exclude emissions with only transformation value
253
+ "transformation": _map_values(blank_nodes, "transformation"),
246
254
  "properties": _map_values(blank_nodes, "properties"),
247
255
  "methodTier": _map_values(blank_nodes, "methodTier"),
248
256
  "methodModel": _map_values(blank_nodes, "methodModel"),
@@ -300,7 +308,9 @@ def _group_cycle_blank_nodes(
300
308
  )
301
309
  # after combining all values, need to compute the final statistical values
302
310
  group[list_key] = {
303
- k: v | _compute_blank_node_stats(v) for k, v in values.items()
311
+ k: v | _compute_blank_node_stats(v)
312
+ for k, v in values.items()
313
+ if list_key != "emissions" or has_value_without_transformation(v)
304
314
  }
305
315
  logger.debug(
306
316
  "function=_group_cycle_blank_nodes, list_key=%s, time=%s",
@@ -69,3 +69,18 @@ def get_method_model(emissions: list):
69
69
  values = non_empty_list(flatten([e.get("methodModel", []) for e in emissions]))
70
70
  values = list({v["@id"]: v for v in values}.values())
71
71
  return values[0] if len(values) == 1 else None
72
+
73
+
74
+ def has_value_without_transformation(blank_node: dict):
75
+ values = blank_node.get("value", [])
76
+ transformations = blank_node.get("transformation", [])
77
+ return (
78
+ not transformations
79
+ or len(transformations) != len(values)
80
+ or any(
81
+ [
82
+ value is not None and transformations[index] is None
83
+ for index, value in enumerate(values)
84
+ ]
85
+ )
86
+ )
@@ -0,0 +1 @@
1
+ VERSION = "0.21.15"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hestia_earth_aggregation
3
- Version: 0.21.14
3
+ Version: 0.21.15
4
4
  Summary: HESTIA's aggregation engine.
5
5
  Home-page: https://gitlab.com/hestia-earth/hestia-aggregation-engine
6
6
  Author: HESTIA Team
@@ -1 +0,0 @@
1
- VERSION = "0.21.14"