hestia-earth-models 0.72.1__py3-none-any.whl → 0.72.2__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.
- hestia_earth/models/cml2001Baseline/resourceUseEnergyDepletionInputsProduction.py +2 -1
- hestia_earth/models/cml2001Baseline/resourceUseMineralsAndMetalsInputsProduction.py +2 -1
- hestia_earth/models/ecoalimV9/cycle.py +1 -0
- hestia_earth/models/ecoalimV9/impact_assessment.py +1 -0
- hestia_earth/models/ecoinventV3/__init__.py +1 -0
- hestia_earth/models/ecoinventV3AndEmberClimate/__init__.py +1 -0
- hestia_earth/models/linkedImpactAssessment/emissions.py +1 -0
- hestia_earth/models/linkedImpactAssessment/utils.py +16 -16
- hestia_earth/models/mocking/search-results.json +708 -708
- hestia_earth/models/version.py +1 -1
- {hestia_earth_models-0.72.1.dist-info → hestia_earth_models-0.72.2.dist-info}/METADATA +1 -1
- {hestia_earth_models-0.72.1.dist-info → hestia_earth_models-0.72.2.dist-info}/RECORD +15 -15
- {hestia_earth_models-0.72.1.dist-info → hestia_earth_models-0.72.2.dist-info}/LICENSE +0 -0
- {hestia_earth_models-0.72.1.dist-info → hestia_earth_models-0.72.2.dist-info}/WHEEL +0 -0
- {hestia_earth_models-0.72.1.dist-info → hestia_earth_models-0.72.2.dist-info}/top_level.txt +0 -0
@@ -1,4 +1,5 @@
|
|
1
1
|
from hestia_earth.models.linkedImpactAssessment.utils import run_inputs_production
|
2
|
+
from . import MODEL
|
2
3
|
|
3
4
|
REQUIREMENTS = {
|
4
5
|
"ImpactAssessment": {
|
@@ -37,4 +38,4 @@ RETURNS = {
|
|
37
38
|
TERM_ID = 'resourceUseEnergyDepletionInputsProduction'
|
38
39
|
|
39
40
|
|
40
|
-
def run(impact_assessment: dict): return run_inputs_production(impact_assessment, TERM_ID)
|
41
|
+
def run(impact_assessment: dict): return run_inputs_production(impact_assessment, TERM_ID, MODEL)
|
@@ -1,4 +1,5 @@
|
|
1
1
|
from hestia_earth.models.linkedImpactAssessment.utils import run_inputs_production
|
2
|
+
from . import MODEL
|
2
3
|
|
3
4
|
REQUIREMENTS = {
|
4
5
|
"ImpactAssessment": {
|
@@ -37,4 +38,4 @@ RETURNS = {
|
|
37
38
|
TERM_ID = 'resourceUseMineralsAndMetalsInputsProduction'
|
38
39
|
|
39
40
|
|
40
|
-
def run(impact_assessment: dict): return run_inputs_production(impact_assessment, TERM_ID)
|
41
|
+
def run(impact_assessment: dict): return run_inputs_production(impact_assessment, TERM_ID, MODEL)
|
@@ -81,6 +81,7 @@ def _add_emission(cycle: dict, input: dict):
|
|
81
81
|
emissions = ecoalim_values(ecoalim_key, 'emission')
|
82
82
|
for emission_term_id, value in emissions:
|
83
83
|
# log run on each emission so we know it did run
|
84
|
+
logShouldRun(cycle, MODEL, input_term_id, True, methodTier=TIER, emission_id=emission_term_id)
|
84
85
|
debugValues(cycle, model=MODEL, term=emission_term_id, model_key=MODEL_KEY,
|
85
86
|
value=value,
|
86
87
|
coefficient=coefficient,
|
@@ -81,6 +81,7 @@ def _add_indicator(cycle: dict, input: dict):
|
|
81
81
|
indicators = ecoalim_values(ecoalim_key, 'resourceUse')
|
82
82
|
for indicator_term_id, value in indicators:
|
83
83
|
# log run on each indicator so we know it did run
|
84
|
+
logShouldRun(cycle, MODEL, input_term_id, True, methodTier=TIER, emission_id=indicator_term_id)
|
84
85
|
debugValues(cycle, model=MODEL, term=indicator_term_id, model_key=MODEL_KEY,
|
85
86
|
value=value,
|
86
87
|
coefficient=coefficient,
|
@@ -89,6 +89,7 @@ def _add_emission(cycle: dict, input: dict):
|
|
89
89
|
emissions = ecoinventV3_emissions(ecoinventName)
|
90
90
|
for emission_term_id, value in emissions:
|
91
91
|
# log run on each emission so we know it did run
|
92
|
+
logShouldRun(cycle, MODEL, input_term_id, True, methodTier=TIER, emission_id=emission_term_id)
|
92
93
|
debugValues(cycle, model=MODEL, term=emission_term_id,
|
93
94
|
value=value,
|
94
95
|
coefficient=coefficient,
|
@@ -89,6 +89,7 @@ def _add_emission(cycle: dict, input: dict):
|
|
89
89
|
emissions = ecoinventV3_emissions(ecoinventName)
|
90
90
|
for emission_term_id, value in emissions:
|
91
91
|
# log run on each emission so we know it did run
|
92
|
+
logShouldRun(cycle, MODEL, input_term_id, True, methodTier=TIER, emission_id=emission_term_id)
|
92
93
|
debugValues(cycle, model=MODEL, term=emission_term_id,
|
93
94
|
value=value,
|
94
95
|
coefficient=coefficient,
|
@@ -77,6 +77,7 @@ def _run_emission(cycle: dict, emission_term_id: str, data: dict):
|
|
77
77
|
|
78
78
|
# log run on each emission so we know it did run
|
79
79
|
details = values.get('details', {})
|
80
|
+
logShouldRun(cycle, MODEL, input_term_id, True, methodTier=TIER, emission_id=emission_term_id)
|
80
81
|
debugValues(cycle, model=model, term=emission_term_id,
|
81
82
|
value=value,
|
82
83
|
coefficient=1,
|
@@ -8,14 +8,14 @@ from hestia_earth.models.utils.input import load_impacts
|
|
8
8
|
from . import MODEL
|
9
9
|
|
10
10
|
|
11
|
-
def _indicator(term_id: str, value: float, input: dict):
|
12
|
-
indicator = _new_indicator(term_id,
|
11
|
+
def _indicator(model: str, term_id: str, value: float, input: dict):
|
12
|
+
indicator = _new_indicator(term_id, model)
|
13
13
|
indicator['value'] = value
|
14
14
|
indicator['inputs'] = [input]
|
15
15
|
return indicator
|
16
16
|
|
17
17
|
|
18
|
-
def _run_indicators(impact_assessment: dict, product: dict, term_id: str):
|
18
|
+
def _run_indicators(impact_assessment: dict, product: dict, term_id: str, model: str):
|
19
19
|
def run(values: list):
|
20
20
|
input = values[0].get('input').get('term', {})
|
21
21
|
indicator = values[0].get('indicator')
|
@@ -24,22 +24,22 @@ def _run_indicators(impact_assessment: dict, product: dict, term_id: str):
|
|
24
24
|
for value in values
|
25
25
|
])
|
26
26
|
value = convert_value_from_cycle(
|
27
|
-
impact_assessment, product, sum_values(values_from_cycle), model=
|
27
|
+
impact_assessment, product, sum_values(values_from_cycle), model=model, term_id=term_id
|
28
28
|
)
|
29
29
|
|
30
30
|
# show values per input in the logs
|
31
|
-
debugValues(impact_assessment, model=
|
31
|
+
debugValues(impact_assessment, model=model, term=term_id,
|
32
32
|
value=value,
|
33
33
|
coefficient=1,
|
34
34
|
input=input.get('@id'))
|
35
35
|
|
36
36
|
return (
|
37
|
-
_indicator(term_id, value, input) | _include(indicator, ['landCover', 'previousLandCover'])
|
37
|
+
_indicator(model, term_id, value, input) | _include(indicator, ['landCover', 'previousLandCover'])
|
38
38
|
) if value is not None else None
|
39
39
|
return run
|
40
40
|
|
41
41
|
|
42
|
-
def _run_inputs_production(impact_assessment: dict, product: dict, term_id: str):
|
42
|
+
def _run_inputs_production(impact_assessment: dict, product: dict, term_id: str, model: str):
|
43
43
|
cycle = impact_assessment.get('cycle', {})
|
44
44
|
|
45
45
|
# group all indicators per `landCover` and `previousLandCover`
|
@@ -71,7 +71,7 @@ def _run_inputs_production(impact_assessment: dict, product: dict, term_id: str)
|
|
71
71
|
])
|
72
72
|
has_indicators = bool(valid_indicators)
|
73
73
|
|
74
|
-
logRequirements(impact_assessment, model=
|
74
|
+
logRequirements(impact_assessment, model=model, term=term_id,
|
75
75
|
indicators=log_as_table([
|
76
76
|
{
|
77
77
|
'indicator-id': value.get('indicator').get('term', {}).get('@id'),
|
@@ -83,30 +83,30 @@ def _run_inputs_production(impact_assessment: dict, product: dict, term_id: str)
|
|
83
83
|
]))
|
84
84
|
|
85
85
|
should_run = all([has_indicators])
|
86
|
-
logShouldRun(impact_assessment,
|
86
|
+
logShouldRun(impact_assessment, model, term_id, should_run)
|
87
87
|
|
88
88
|
return non_empty_list(flatten(
|
89
|
-
map(_run_indicators(impact_assessment, product, term_id), grouped_indicators.values())
|
89
|
+
map(_run_indicators(impact_assessment, product, term_id, model), grouped_indicators.values())
|
90
90
|
))
|
91
91
|
|
92
92
|
|
93
|
-
def _should_run_inputs_production(impact_assessment: dict, term_id: str):
|
93
|
+
def _should_run_inputs_production(impact_assessment: dict, term_id: str, model: str):
|
94
94
|
product = get_product(impact_assessment) or {}
|
95
95
|
product_id = product.get('term', {}).get('@id')
|
96
96
|
|
97
97
|
product_value = list_sum(product.get('value', []), default=None)
|
98
98
|
economic_value = product.get('economicValueShare')
|
99
99
|
|
100
|
-
logRequirements(impact_assessment, model=
|
100
|
+
logRequirements(impact_assessment, model=model, term=term_id,
|
101
101
|
product_id=product_id,
|
102
102
|
product_value=product_value,
|
103
103
|
product_economicValueShare=economic_value)
|
104
104
|
|
105
105
|
should_run = all([product, product_value, economic_value])
|
106
|
-
logShouldRun(impact_assessment,
|
106
|
+
logShouldRun(impact_assessment, model, term_id, should_run)
|
107
107
|
return should_run, product
|
108
108
|
|
109
109
|
|
110
|
-
def run_inputs_production(impact_assessment: dict, term_id: str):
|
111
|
-
should_run, product = _should_run_inputs_production(impact_assessment, term_id)
|
112
|
-
return _run_inputs_production(impact_assessment, product, term_id) if should_run else []
|
110
|
+
def run_inputs_production(impact_assessment: dict, term_id: str, model: str = MODEL):
|
111
|
+
should_run, product = _should_run_inputs_production(impact_assessment, term_id, model)
|
112
|
+
return _run_inputs_production(impact_assessment, product, term_id, model) if should_run else []
|