hestia-earth-aggregation 0.21.14__py3-none-any.whl → 0.21.15__py3-none-any.whl

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.
@@ -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
+ )
@@ -1 +1 @@
1
- VERSION = "0.21.14"
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
@@ -2,10 +2,10 @@ hestia_earth/aggregation/__init__.py,sha256=5r0icTYP5F4DFIX-Xm1Ms3inpAUfpXQwOmO2
2
2
  hestia_earth/aggregation/aggregate_cycles.py,sha256=9BRX41d0uLhKLUPBlALxAoRMfPriDj3Dhy0sTgmTS5Y,7812
3
3
  hestia_earth/aggregation/log.py,sha256=0CibXDtKqFfE-R86qziM2uH7ATUZ6I9p_bVpRSn_e_o,2351
4
4
  hestia_earth/aggregation/recalculate_cycles.py,sha256=xCO_tj5BAC407vZ36EVuxeOBmX2y82EXRrTx5W6g4CY,484
5
- hestia_earth/aggregation/version.py,sha256=zqCwaEmEyCPuIxRLzAP6Ds1U0koeoYfXnJ0e800-MWo,20
5
+ hestia_earth/aggregation/version.py,sha256=Z3Ng7JCS2UZEW-r2srjuHslYzJkIywa_nSkx0uI3j84,20
6
6
  hestia_earth/aggregation/config/Cycle/processedFood.json,sha256=JWelgL-ZLnurS9R8Y-HOXjiWZ5k3kAuUQHDoMcukEq8,1127
7
7
  hestia_earth/aggregation/utils/__init__.py,sha256=nVVLgVFZ4415CgQAqgv4jDamA7gDmzOWk5SY4vshAQs,6583
8
- hestia_earth/aggregation/utils/aggregate_country_nodes.py,sha256=c2rosOtI7B8vwb2CbDye-YPx4xyPc-o4kKKPsyAVoyU,28456
8
+ hestia_earth/aggregation/utils/aggregate_country_nodes.py,sha256=U39M2clD9_6FE0yFYvamP7EI8FrCQ350pzD0y_9Rw_Y,28806
9
9
  hestia_earth/aggregation/utils/aggregate_weighted.py,sha256=CUTqR8z3_MRnGhzAOiFswy68Twe1GaNCyrSd5x7qf_Q,7037
10
10
  hestia_earth/aggregation/utils/blank_node.py,sha256=f8JBcd5_SLqW8juzFAfbZysAESaZXj8JX6C7rDkLEoc,16812
11
11
  hestia_earth/aggregation/utils/combine.py,sha256=EmXUZksdkrtQ6o1gMOG5WMivUhL28NKSM9D4cPohJiE,4904
@@ -13,7 +13,7 @@ hestia_earth/aggregation/utils/completeness.py,sha256=eZ759PAdOSshhys-YKKPEpAYxR
13
13
  hestia_earth/aggregation/utils/covariance.py,sha256=2VaNGPvyD4ub3rR-OBn8VIEIeAz4JOefl6ZlAtXKj4U,5884
14
14
  hestia_earth/aggregation/utils/cycle.py,sha256=gzU2KofOVGBZvOPTymJGpsbbouABjSzUM35OJ42sFl8,15954
15
15
  hestia_earth/aggregation/utils/distribution.py,sha256=2XQKXVu-1XUy1zEHgThERupaj4RizXKO5F-VY-QQlMo,6935
16
- hestia_earth/aggregation/utils/emission.py,sha256=6MpDdf_izru0PGmkr2y9gOf9x_zfafyvSJSWALsseos,2554
16
+ hestia_earth/aggregation/utils/emission.py,sha256=2roXjGmDuS7a3muPJoEOqg7E-TZyQsnoavhU6b3B-Z8,2983
17
17
  hestia_earth/aggregation/utils/group.py,sha256=qU9sAuJu0RG80yLs90nsyoOcU57Pb6M1WKwT1TlJEkM,4765
18
18
  hestia_earth/aggregation/utils/input.py,sha256=pZ1bcdHR3y4S-3b0JZllbEUWdEyVZbltxv-07j7SucI,1092
19
19
  hestia_earth/aggregation/utils/lookup.py,sha256=osJiXTRns5KeBMz3mRsanmFQTATrwcMVBzB07xrb71M,2046
@@ -28,8 +28,8 @@ hestia_earth/aggregation/utils/site.py,sha256=nc1N4IRiTki69IbCX4G6lagQ5U7IpsOsqi
28
28
  hestia_earth/aggregation/utils/source.py,sha256=SOiE-jB5WNtbRxreUWQ8c04ywzrwICy1aGyRL3-L0RY,686
29
29
  hestia_earth/aggregation/utils/term.py,sha256=uVAfBYnxNkcTNfzuwwHur6JGBahNrPwR2pN-__sj9zk,2758
30
30
  hestia_earth/aggregation/utils/weights.py,sha256=3WO2_26bj1RB2h524Gknu0btvTFJucqMtn-tag339aY,6843
31
- hestia_earth_aggregation-0.21.14.dist-info/licenses/LICENSE,sha256=TD25LoiRJsA5CPUNrcyt1PXlGcbUGFMAeZoBcfCrCNE,1154
32
- hestia_earth_aggregation-0.21.14.dist-info/METADATA,sha256=DId0r59jDje3k-jfnNbBa1G9mcBRvi2rAbEjyvZQGnU,2481
33
- hestia_earth_aggregation-0.21.14.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
34
- hestia_earth_aggregation-0.21.14.dist-info/top_level.txt,sha256=q0QxKEYx9uLpAD5ZtC7Ypq29smEPfOzEAn7Xv8XHGOQ,13
35
- hestia_earth_aggregation-0.21.14.dist-info/RECORD,,
31
+ hestia_earth_aggregation-0.21.15.dist-info/licenses/LICENSE,sha256=TD25LoiRJsA5CPUNrcyt1PXlGcbUGFMAeZoBcfCrCNE,1154
32
+ hestia_earth_aggregation-0.21.15.dist-info/METADATA,sha256=XgOXgQA87fTsZYpB8xXvgcz1Mp5LP7Kkec3Ik5wlLZo,2481
33
+ hestia_earth_aggregation-0.21.15.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
34
+ hestia_earth_aggregation-0.21.15.dist-info/top_level.txt,sha256=q0QxKEYx9uLpAD5ZtC7Ypq29smEPfOzEAn7Xv8XHGOQ,13
35
+ hestia_earth_aggregation-0.21.15.dist-info/RECORD,,