hestia-earth-models 0.74.3__py3-none-any.whl → 0.74.5__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.

Potentially problematic release.


This version of hestia-earth-models might be problematic. Click here for more details.

Files changed (62) hide show
  1. hestia_earth/models/cml2001Baseline/abioticResourceDepletionMineralsAndMetals.py +0 -1
  2. hestia_earth/models/config/Cycle.json +15 -0
  3. hestia_earth/models/config/ImpactAssessment.json +30 -11
  4. hestia_earth/models/cycle/animal/input/hestiaAggregatedData.py +3 -3
  5. hestia_earth/models/cycle/completeness/seed.py +1 -1
  6. hestia_earth/models/cycle/input/hestiaAggregatedData.py +25 -16
  7. hestia_earth/models/data/hestiaAggregatedData/__init__.py +73 -0
  8. hestia_earth/models/environmentalFootprintV3_1/scarcityWeightedWaterUse.py +1 -1
  9. hestia_earth/models/environmentalFootprintV3_1/soilQualityIndexLandOccupation.py +5 -6
  10. hestia_earth/models/environmentalFootprintV3_1/soilQualityIndexLandTransformation.py +10 -13
  11. hestia_earth/models/fantkeEtAl2016/damageToHumanHealthParticulateMatterFormation.py +1 -1
  12. hestia_earth/models/hestia/landCover.py +24 -0
  13. hestia_earth/models/hestia/landOccupationDuringCycle.py +80 -51
  14. hestia_earth/models/hestia/landTransformation100YearAverageDuringCycle.py +7 -1
  15. hestia_earth/models/hestia/landTransformation20YearAverageDuringCycle.py +7 -1
  16. hestia_earth/models/hestia/resourceUse_utils.py +58 -119
  17. hestia_earth/models/hestia/waterSalinity.py +57 -12
  18. hestia_earth/models/impact_assessment/post_checks/__init__.py +3 -2
  19. hestia_earth/models/impact_assessment/post_checks/remove_cache_fields.py +9 -0
  20. hestia_earth/models/impact_assessment/pre_checks/cache_emissionsResourceUse.py +21 -0
  21. hestia_earth/models/impact_assessment/pre_checks/cycle.py +5 -0
  22. hestia_earth/models/ipcc2019/co2ToAirAboveGroundBiomassStockChange.py +6 -64
  23. hestia_earth/models/ipcc2019/co2ToAirBelowGroundBiomassStockChange.py +9 -87
  24. hestia_earth/models/ipcc2019/co2ToAirBiocharStockChange.py +140 -0
  25. hestia_earth/models/ipcc2019/co2ToAirCarbonStockChange_utils.py +329 -217
  26. hestia_earth/models/ipcc2019/co2ToAirSoilOrganicCarbonStockChange.py +10 -87
  27. hestia_earth/models/mocking/__init__.py +2 -2
  28. hestia_earth/models/mocking/mock_search.py +20 -10
  29. hestia_earth/models/mocking/search-results.json +1 -7679
  30. hestia_earth/models/pooreNemecek2018/landOccupationDuringCycle.py +8 -7
  31. hestia_earth/models/poschEtAl2008/terrestrialAcidificationPotentialAccumulatedExceedance.py +1 -1
  32. hestia_earth/models/poschEtAl2008/terrestrialEutrophicationPotentialAccumulatedExceedance.py +1 -1
  33. hestia_earth/models/preload_requests.py +18 -4
  34. hestia_earth/models/schmidt2007/utils.py +3 -3
  35. hestia_earth/models/utils/__init__.py +4 -1
  36. hestia_earth/models/utils/aggregated.py +21 -68
  37. hestia_earth/models/utils/cycle.py +3 -3
  38. hestia_earth/models/utils/impact_assessment.py +45 -41
  39. hestia_earth/models/utils/lookup.py +92 -67
  40. hestia_earth/models/version.py +1 -1
  41. hestia_earth/orchestrator/models/__init__.py +47 -10
  42. hestia_earth/orchestrator/models/transformations.py +3 -1
  43. hestia_earth/orchestrator/strategies/merge/__init__.py +1 -2
  44. hestia_earth/orchestrator/strategies/merge/merge_list.py +31 -8
  45. hestia_earth/orchestrator/utils.py +29 -0
  46. {hestia_earth_models-0.74.3.dist-info → hestia_earth_models-0.74.5.dist-info}/METADATA +2 -3
  47. {hestia_earth_models-0.74.3.dist-info → hestia_earth_models-0.74.5.dist-info}/RECORD +62 -55
  48. tests/models/cycle/animal/input/test_hestiaAggregatedData.py +3 -3
  49. tests/models/cycle/input/test_hestiaAggregatedData.py +9 -18
  50. tests/models/data/__init__.py +0 -0
  51. tests/models/data/test_hestiaAggregatedData.py +32 -0
  52. tests/models/hestia/test_landCover.py +32 -1
  53. tests/models/hestia/test_waterSalinity.py +16 -4
  54. tests/models/ipcc2019/test_co2ToAirAboveGroundBiomassStockChange.py +1 -6
  55. tests/models/ipcc2019/test_co2ToAirBelowGroundBiomassStockChange.py +1 -6
  56. tests/models/ipcc2019/test_co2ToAirBiocharStockChange.py +90 -0
  57. tests/models/ipcc2019/test_co2ToAirSoilOrganicCarbonStockChange.py +1 -6
  58. tests/models/pooreNemecek2018/test_landOccupationDuringCycle.py +1 -0
  59. tests/orchestrator/strategies/merge/test_merge_list.py +5 -0
  60. {hestia_earth_models-0.74.3.dist-info → hestia_earth_models-0.74.5.dist-info}/LICENSE +0 -0
  61. {hestia_earth_models-0.74.3.dist-info → hestia_earth_models-0.74.5.dist-info}/WHEEL +0 -0
  62. {hestia_earth_models-0.74.3.dist-info → hestia_earth_models-0.74.5.dist-info}/top_level.txt +0 -0
@@ -8,18 +8,17 @@ from . import MODEL
8
8
 
9
9
  REQUIREMENTS = {
10
10
  "ImpactAssessment": {
11
- "product": {"@type": "Term"},
11
+ "product": {
12
+ "@type": "Term",
13
+ "economicValueShare": "> 0",
14
+ "value": "> 0"
15
+ },
12
16
  "cycle": {
13
17
  "@type": "Cycle",
14
18
  "or": [
15
19
  {
16
20
  "@doc": "if the [cycle.functionalUnit](https://hestia.earth/schema/Cycle#functionalUnit) = 1 ha, additional properties are required", # noqa: E501
17
21
  "cycleDuration": "",
18
- "products": [{
19
- "@type": "Product",
20
- "value": "> 0",
21
- "economicValueShare": "> 0"
22
- }],
23
22
  "practices": [{"@type": "Practice", "value": "", "term.@id": "longFallowRatio"}]
24
23
  },
25
24
  {
@@ -54,6 +53,7 @@ def _indicator(term_id: str, value: float, land_cover_term_id: str):
54
53
 
55
54
  def _should_run(impact_assessment: dict):
56
55
  product = get_product(impact_assessment)
56
+ product_evs = product.get('economicValueShare')
57
57
  cycle = impact_assessment.get('cycle', {})
58
58
  site = get_site(impact_assessment)
59
59
  land_cover_from_product = get_landCover_term_id(product.get('term', {}))
@@ -62,11 +62,12 @@ def _should_run(impact_assessment: dict):
62
62
  land_occupation_m2_kg = land_occupation_per_kg(MODEL, TERM_ID, cycle, site, product)
63
63
 
64
64
  logRequirements(impact_assessment, model=MODEL, term=TERM_ID,
65
+ economicValueShare=product_evs,
65
66
  land_occupation_kg=land_occupation_m2_kg,
66
67
  land_cover_from_product=land_cover_from_product,
67
68
  land_cover_from_site=land_cover_from_site)
68
69
 
69
- should_run = all([land_cover_term_id, land_occupation_m2_kg is not None])
70
+ should_run = all([product_evs, land_cover_term_id, land_occupation_m2_kg is not None])
70
71
  logShouldRun(impact_assessment, MODEL, TERM_ID, should_run)
71
72
  return should_run, land_occupation_m2_kg, land_cover_term_id
72
73
 
@@ -36,7 +36,7 @@ def _indicator(value: float):
36
36
 
37
37
  def run(impact_assessment: dict):
38
38
  value = impact_country_value(MODEL, TERM_ID, impact_assessment, f"{list(LOOKUPS.keys())[0]}.csv",
39
- country_fallback=True)
39
+ default_world_value=True)
40
40
  logRequirements(impact_assessment, model=MODEL, term=TERM_ID,
41
41
  value=value)
42
42
  logShouldRun(impact_assessment, MODEL, TERM_ID, value is not None)
@@ -36,7 +36,7 @@ def _indicator(value: float):
36
36
 
37
37
  def run(impact_assessment: dict):
38
38
  value = impact_country_value(MODEL, TERM_ID, impact_assessment, f"{list(LOOKUPS.keys())[0]}.csv",
39
- country_fallback=True)
39
+ default_world_value=True)
40
40
  logRequirements(impact_assessment, model=MODEL, term=TERM_ID,
41
41
  value=value)
42
42
  logShouldRun(impact_assessment, MODEL, TERM_ID, value is not None)
@@ -7,12 +7,13 @@ from hestia_earth.utils.storage import _load_from_storage
7
7
 
8
8
  from .log import logger
9
9
  from .mocking.build_mock_search import create_search_results
10
- from .mocking import RESULTS_PATH, enable_mock as _mock
10
+ from .mocking.mock_search import unmock
11
+ from .mocking import RESULTS_PATH, enable_mock
11
12
 
12
13
 
13
14
  def _write_results(filepath: str, data: dict):
14
15
  with open(filepath, 'w') as f:
15
- f.write(json.dumps(data, indent=2, ensure_ascii=False))
16
+ f.write(json.dumps(data, ensure_ascii=False))
16
17
 
17
18
 
18
19
  def _load_data_from_glossary():
@@ -26,7 +27,8 @@ def enable_preload(
26
27
  filepath: str = RESULTS_PATH,
27
28
  node: dict = None,
28
29
  overwrite_existing: bool = True,
29
- use_glossary: bool = False
30
+ use_glossary: bool = False,
31
+ keep_in_memory: bool = False
30
32
  ):
31
33
  """
32
34
  Prefetch calls to HESTIA API in a local file.
@@ -43,6 +45,9 @@ def enable_preload(
43
45
  use_glossary : bool
44
46
  Optional - Try to fetch search results from the glossary.
45
47
  Only available with access to HESTIA infrastructure.
48
+ keep_in_memory : bool
49
+ Optional - keep the results file in memory, to avoid reading it from disk every request.
50
+ This increases the memory usage of the function, but reduces latency reading the file.
46
51
  """
47
52
  should_generate = overwrite_existing or not os.path.exists(filepath)
48
53
 
@@ -56,4 +61,13 @@ def enable_preload(
56
61
  _write_results(filepath, data)
57
62
 
58
63
  # enable mock search results from file
59
- _mock(filepath=filepath, node=node)
64
+ enable_mock(filepath=filepath, node=node, keep_in_memory=keep_in_memory)
65
+
66
+
67
+ def disable_preload():
68
+ """
69
+ Disable preloading API calls done with the `enable_preload` function.
70
+ All API calls will be done as usual after this function is called.
71
+ """
72
+ logger.debug('Removing mock of search results')
73
+ unmock()
@@ -10,9 +10,9 @@ from . import MODEL
10
10
  def get_waste_values(term_id: str, cycle: dict, lookup_col: str):
11
11
  products = filter_list_term_type(cycle.get('products', []), TermTermType.WASTE)
12
12
  value = all_factor_value(
13
- logs_model=MODEL,
14
- logs_term_id=term_id,
15
- node=cycle,
13
+ log_model=MODEL,
14
+ log_term_id=term_id,
15
+ log_node=cycle,
16
16
  lookup_name=f"{TermTermType.WASTE.value}.csv",
17
17
  lookup_col=lookup_col,
18
18
  blank_nodes=products,
@@ -23,7 +23,10 @@ CACHE_KEY = '_cache'
23
23
 
24
24
  def cached_value(node: dict, key: str = None, default=None):
25
25
  cache = node.get(CACHE_KEY, {})
26
- return cache.get(key, default) if key else cache
26
+ return cache.get(key, default) if all([
27
+ key,
28
+ cache is not None
29
+ ]) else cache
27
30
 
28
31
 
29
32
  def group_by(values: list, keys: list):
@@ -1,13 +1,12 @@
1
1
  import math
2
- from hestia_earth.schema import SchemaType
3
- from hestia_earth.utils.api import search
2
+ from hestia_earth.schema import NodeType
4
3
  from hestia_earth.utils.lookup import download_lookup, get_table_value, column_name
5
4
  from hestia_earth.utils.model import find_term_match, linked_node
6
5
  from hestia_earth.utils.tools import safe_parse_date, non_empty_list
7
6
 
8
7
  from hestia_earth.models.log import debugValues, logShouldRun
8
+ from hestia_earth.models.data.hestiaAggregatedData import DEFAULT_COUNTRY_ID, find_closest_impact_id
9
9
  from . import current_year
10
- from .cycle import is_organic
11
10
 
12
11
  MODEL_KEY = 'impactAssessment'
13
12
 
@@ -17,84 +16,38 @@ def aggregated_end_date(end_date: str):
17
16
  return min([round(math.floor(year / 10) * 10) + 9, current_year()])
18
17
 
19
18
 
20
- def _match_country_query(name: str = 'World', boost: int = 1):
21
- return {'match': {'country.name.keyword': {'query': name, 'boost': boost}}}
22
-
23
-
24
- def _match_country(country: dict):
25
- country_name = country.get('name') if country else None
26
- return {
27
- 'bool': {
28
- # either get with exact country, or default to global
29
- 'should': non_empty_list([
30
- _match_country_query(name=country_name, boost=1000) if country_name else None,
31
- _match_country_query()
32
- ]),
33
- 'minimum_should_match': 1
34
- }
35
- }
36
-
37
-
38
- def find_closest_impact(cycle: dict, end_date: str, term: dict, country: dict, must_queries=[]):
39
- query = {
40
- 'bool': {
41
- 'must': non_empty_list([
42
- {'match': {'@type': SchemaType.IMPACTASSESSMENT.value}},
43
- {'match': {'aggregated': 'true'}},
44
- {'match': {'aggregatedDataValidated': 'true'}},
45
- {
46
- 'bool': {
47
- # handle old ImpactAssessment data
48
- 'should': [
49
- {'match': {'product.term.name.keyword': term.get('name')}},
50
- {'match': {'product.name.keyword': term.get('name')}}
51
- ],
52
- 'minimum_should_match': 1
53
- }
54
- } if term else None,
55
- _match_country(country),
56
- {'range': {'endDate': {'lte': f"{end_date}-12-31"}}}
57
- ]) + must_queries,
58
- 'should': [
59
- # if the Cycle is organic, we can try to match organic aggregate first
60
- {'match': {'name': {'query': 'Organic' if is_organic(cycle) else 'Conventional', 'boost': 1000}}}
61
- ]
62
- }
63
- }
64
- results = search(query, fields=['@type', '@id', 'name', 'endDate']) if term else []
65
- # sort by distance to date and score and take min
66
- results = sorted(
67
- results,
68
- key=lambda v: abs(int(end_date) - int(v.get('endDate', '0'))) * v.get('_score', 0),
69
- )
70
- return results[0] if len(results) > 0 else None
71
-
72
-
73
- def _link_input_to_impact(model: str, cycle: dict, date: int):
19
+ def _link_input_to_impact(model: str, cycle: dict, date: int, **log_args):
74
20
  def run(input: dict):
75
21
  term = input.get('term', {})
76
22
  term_id = term.get('@id')
77
23
  country = input.get('country')
78
- impact = find_closest_impact(cycle, date, term, country)
79
-
80
- search_by_country_id = (country or {}).get('@id') or 'region-world'
81
- debugValues(cycle, model=model, term=term_id, key=MODEL_KEY,
24
+ country_id = (country or {}).get('@id')
25
+ impact_id = (
26
+ find_closest_impact_id(product_id=term_id, country_id=country_id, year=date) or
27
+ find_closest_impact_id(product_id=term_id, country_id=DEFAULT_COUNTRY_ID, year=date)
28
+ )
29
+
30
+ search_by_country_id = country_id or DEFAULT_COUNTRY_ID
31
+ debugValues(cycle, model=model, term=term_id, key=MODEL_KEY, **log_args,
82
32
  search_by_input_term_id=term_id,
83
33
  search_by_country_id=search_by_country_id,
84
34
  search_by_end_date=str(date),
85
- impact_assessment_id_found=(impact or {}).get('@id'))
35
+ impact_assessment_id_found=impact_id)
86
36
 
87
- should_run = all([impact is not None])
88
- logShouldRun(cycle, model, term_id, should_run)
89
- logShouldRun(cycle, model, term_id, should_run, key=MODEL_KEY) # show specifically under Input
37
+ should_run = all([impact_id])
38
+ logShouldRun(cycle, model, term_id, should_run, **log_args)
39
+ logShouldRun(cycle, model, term_id, should_run, key=MODEL_KEY, **log_args) # show specifically under Input
90
40
 
91
- return input | {MODEL_KEY: linked_node(impact), 'impactAssessmentIsProxy': True} if impact else None
41
+ return input | {
42
+ MODEL_KEY: linked_node({'@type': NodeType.IMPACTASSESSMENT.value, '@id': impact_id}),
43
+ 'impactAssessmentIsProxy': True
44
+ } if impact_id else None
92
45
  return run
93
46
 
94
47
 
95
- def link_inputs_to_impact(model: str, cycle: dict, inputs: list):
48
+ def link_inputs_to_impact(model: str, cycle: dict, inputs: list, **log_args):
96
49
  date = aggregated_end_date(cycle.get('endDate'))
97
- return non_empty_list(map(_link_input_to_impact(model, cycle, date), inputs))
50
+ return non_empty_list(map(_link_input_to_impact(model, cycle, date, **log_args), inputs))
98
51
 
99
52
 
100
53
  def _should_aggregate_input(term: dict):
@@ -409,9 +409,9 @@ def impact_lookup_value(model: str, term_id: str, cycle: dict, blank_nodes: list
409
409
  """
410
410
  term_type = blank_nodes[0].get('term', {}).get('termType') if len(blank_nodes) > 0 else None
411
411
  return all_factor_value(
412
- logs_model=model,
413
- logs_term_id=term_id,
414
- node=cycle,
412
+ log_model=model,
413
+ log_term_id=term_id,
414
+ log_node=cycle,
415
415
  lookup_name=f"{term_type}.csv",
416
416
  lookup_col=lookup_col,
417
417
  blank_nodes=blank_nodes
@@ -3,8 +3,7 @@ from hestia_earth.schema import TermTermType
3
3
  from hestia_earth.utils.model import filter_list_term_type
4
4
  from hestia_earth.utils.tools import list_sum, safe_parse_date
5
5
 
6
- from hestia_earth.models.log import debugValues
7
- from .lookup import all_factor_value, region_factor_value, aware_factor_value, fallback_country
6
+ from .lookup import all_factor_value, region_factor_value, aware_factor_value
8
7
  from .product import find_by_product
9
8
  from .site import region_level_1_id
10
9
 
@@ -106,8 +105,12 @@ def get_country_id(impact_assessment: dict, blank_node: dict = None) -> str:
106
105
  return term_id if term_id else None
107
106
 
108
107
 
108
+ def get_emissionsResourceUse(impact_assessment: dict):
109
+ return impact_assessment.get('cache_emissionsResourceUse', []) or impact_assessment.get('emissionsResourceUse', [])
110
+
111
+
109
112
  def impact_emission_lookup_value(
110
- model: str, term_id: str, impact: dict, lookup_col: str, grouped_key: Optional[str] = None
113
+ model: str, term_id: str, impact: dict, lookup_col: str, group_key: Optional[str] = None
111
114
  ) -> float:
112
115
  """
113
116
  Calculate the value of the impact based on lookup factors and emissions value.
@@ -122,7 +125,7 @@ def impact_emission_lookup_value(
122
125
  The `ImpactAssessment`.
123
126
  lookup_col : str
124
127
  The lookup column to fetch the factors from.
125
- grouped_key : str
128
+ group_key : str
126
129
  key of grouped data to extract in a lookup table
127
130
 
128
131
  Returns
@@ -130,25 +133,29 @@ def impact_emission_lookup_value(
130
133
  int
131
134
  The impact total value.
132
135
  """
136
+ # use cache version which is grouped
137
+ blank_nodes = get_emissionsResourceUse(impact)
138
+ blank_nodes = filter_list_term_type(blank_nodes, TermTermType.EMISSION)
139
+
133
140
  return all_factor_value(
134
- logs_model=model,
135
- logs_term_id=term_id,
136
- node=impact,
141
+ log_model=model,
142
+ log_term_id=term_id,
143
+ log_node=impact,
137
144
  lookup_name='emission.csv',
138
145
  lookup_col=lookup_col,
139
- blank_nodes=filter_list_term_type(impact.get('emissionsResourceUse', []), TermTermType.EMISSION),
140
- grouped_key=grouped_key,
146
+ blank_nodes=blank_nodes,
147
+ group_key=group_key,
141
148
  default_no_values=None
142
149
  )
143
150
 
144
151
 
145
152
  def impact_country_value(
146
- logs_model: str,
147
- logs_term_id: str,
153
+ log_model: str,
154
+ log_term_id: str,
148
155
  impact: dict,
149
156
  lookup: str,
150
157
  group_key: str = None,
151
- country_fallback: bool = False,
158
+ default_world_value: bool = False,
152
159
  default_no_values=None
153
160
  ) -> float:
154
161
  """
@@ -156,9 +163,9 @@ def impact_country_value(
156
163
 
157
164
  Parameters
158
165
  ----------
159
- logs_model : str
166
+ log_model : str
160
167
  The model to display in the logs only.
161
- logs_term_id : str
168
+ log_term_id : str
162
169
  The term to display in the logs only.
163
170
  impact : dict
164
171
  The `ImpactAssessment`.
@@ -166,31 +173,32 @@ def impact_country_value(
166
173
  The name of the lookup to fetch the factors from.
167
174
  group_key : str
168
175
  Optional: key to use if the data is a group of values.
169
- country_fallback : bool
170
- Optional: if True fallback to default `region-world` country_id if country_id in `ImpactAssessment` not found in
171
- lookup file containing factors.
176
+ default_world_value : bool
177
+ Optional: when True, if the value is not found for the country, try using World value instead.
172
178
 
173
179
  Returns
174
180
  -------
175
181
  int
176
182
  The impact total value.
177
183
  """
184
+ # use cache version which is grouped
185
+ blank_nodes = get_emissionsResourceUse(impact)
178
186
  term_type = TermTermType.RESOURCEUSE.value if 'resourceUse' in lookup else TermTermType.EMISSION.value
179
- blank_nodes = filter_list_term_type(impact.get('emissionsResourceUse', []), term_type)
187
+ blank_nodes = filter_list_term_type(blank_nodes, term_type)
180
188
 
181
189
  country_id = get_country_id(impact)
182
- country_id = fallback_country(country_id, [lookup]) if country_fallback else country_id
183
190
 
184
191
  return all_factor_value(
185
- logs_model=logs_model,
186
- logs_term_id=logs_term_id,
187
- node=impact,
192
+ log_model=log_model,
193
+ log_term_id=log_term_id,
194
+ log_node=impact,
188
195
  lookup_name=lookup,
189
196
  lookup_col=country_id,
190
197
  blank_nodes=blank_nodes,
191
- grouped_key=group_key,
198
+ group_key=group_key,
192
199
  default_no_values=default_no_values,
193
- factor_value_func=region_factor_value
200
+ factor_value_func=region_factor_value,
201
+ default_world_value=default_world_value
194
202
  )
195
203
 
196
204
 
@@ -216,18 +224,18 @@ def impact_aware_value(model: str, term_id: str, impact: dict, lookup: str, grou
216
224
  int
217
225
  The impact total value.
218
226
  """
219
- blank_nodes = impact.get('emissionsResourceUse', [])
220
- site = get_site(impact)
221
- aware_id = site.get('awareWaterBasinId')
227
+ # use cache version which is grouped
228
+ blank_nodes = get_emissionsResourceUse(impact)
229
+ aware_id = get_site(impact).get('awareWaterBasinId')
222
230
 
223
231
  return None if aware_id is None else all_factor_value(
224
- logs_model=model,
225
- logs_term_id=term_id,
226
- node=impact,
232
+ log_model=model,
233
+ log_term_id=term_id,
234
+ log_node=impact,
227
235
  lookup_name=lookup,
228
236
  lookup_col=aware_id,
229
237
  blank_nodes=blank_nodes,
230
- grouped_key=group_key,
238
+ group_key=group_key,
231
239
  default_no_values=None,
232
240
  factor_value_func=aware_factor_value
233
241
  )
@@ -253,17 +261,18 @@ def impact_endpoint_value(model: str, term_id: str, impact: dict, lookup_col: st
253
261
  int
254
262
  The impact total value.
255
263
  """
256
- nodes = [i for i in impact.get('impacts', []) if (
264
+ blank_nodes = impact.get('impacts', [])
265
+ blank_nodes = [i for i in blank_nodes if (
257
266
  i.get('methodModel').get('@id') == model or
258
267
  not i.get('methodModel').get('@id').startswith(model[0:6]) # allow other non-related models to be accounted for
259
268
  )]
260
269
  return all_factor_value(
261
- logs_model=model,
262
- logs_term_id=term_id,
263
- node=impact,
270
+ log_model=model,
271
+ log_term_id=term_id,
272
+ log_node=impact,
264
273
  lookup_name='characterisedIndicator.csv',
265
274
  lookup_col=lookup_col,
266
- blank_nodes=nodes,
275
+ blank_nodes=blank_nodes,
267
276
  default_no_values=None
268
277
  )
269
278
 
@@ -273,11 +282,6 @@ def convert_value_from_cycle(
273
282
  ):
274
283
  pyield = list_sum(product.get('value', [])) if product else 0
275
284
  economic_value = product.get('economicValueShare') if product else 0
276
-
277
- debugValues(log_node, model=model, term=term_id,
278
- product_yield=pyield,
279
- economicValueShare=economic_value)
280
-
281
285
  return (value / pyield) * economic_value / 100 if all([
282
286
  value is not None, pyield > 0, economic_value
283
287
  ]) else default