hestia-earth-models 0.75.2__py3-none-any.whl → 0.75.3__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.
- hestia_earth/models/config/Cycle.json +168 -16
- hestia_earth/models/emepEea2019/blackCarbonToAirFuelCombustion.py +33 -0
- hestia_earth/models/emepEea2019/ch4ToAirFuelCombustion.py +33 -0
- hestia_earth/models/emepEea2019/coToAirFuelCombustion.py +33 -0
- hestia_earth/models/emepEea2019/nmvocToAirFuelCombustion.py +33 -0
- hestia_earth/models/emepEea2019/pm10ToAirFuelCombustion.py +33 -0
- hestia_earth/models/emepEea2019/pm25ToAirFuelCombustion.py +33 -0
- hestia_earth/models/emepEea2019/tspToAirFuelCombustion.py +33 -0
- hestia_earth/models/faostat2018/seed.py +9 -8
- hestia_earth/models/hestia/management.py +5 -4
- hestia_earth/models/ipcc2019/animal/pastureGrass.py +16 -10
- hestia_earth/models/ipcc2019/pastureGrass.py +16 -10
- hestia_earth/models/ipcc2019/pastureGrass_utils.py +17 -10
- hestia_earth/models/linkedImpactAssessment/emissions.py +1 -1
- hestia_earth/models/mocking/search-results.json +1 -1
- hestia_earth/models/pefcrGuidanceDocument2017/__init__.py +13 -0
- hestia_earth/models/pefcrGuidanceDocument2017/pesticideToAirPesticideApplication.py +29 -0
- hestia_earth/models/pefcrGuidanceDocument2017/pesticideToSoilPesticideApplication.py +29 -0
- hestia_earth/models/pefcrGuidanceDocument2017/pesticideToWaterPesticideApplication.py +29 -0
- hestia_earth/models/pefcrGuidanceDocument2017/utils.py +55 -0
- hestia_earth/models/pooreNemecek2018/saplingsDepreciatedAmountPerCycle.py +1 -1
- hestia_earth/models/version.py +1 -1
- {hestia_earth_models-0.75.2.dist-info → hestia_earth_models-0.75.3.dist-info}/METADATA +1 -1
- {hestia_earth_models-0.75.2.dist-info → hestia_earth_models-0.75.3.dist-info}/RECORD +27 -15
- {hestia_earth_models-0.75.2.dist-info → hestia_earth_models-0.75.3.dist-info}/WHEEL +0 -0
- {hestia_earth_models-0.75.2.dist-info → hestia_earth_models-0.75.3.dist-info}/licenses/LICENSE +0 -0
- {hestia_earth_models-0.75.2.dist-info → hestia_earth_models-0.75.3.dist-info}/top_level.txt +0 -0
|
@@ -2,12 +2,13 @@ from hestia_earth.schema import TermTermType
|
|
|
2
2
|
from hestia_earth.utils.api import download_hestia
|
|
3
3
|
from hestia_earth.utils.lookup import download_lookup, get_table_value, extract_grouped_data
|
|
4
4
|
from hestia_earth.utils.tools import list_sum, safe_parse_float
|
|
5
|
+
from hestia_earth.utils.model import find_term_match
|
|
5
6
|
|
|
6
7
|
from hestia_earth.models.log import debugValues
|
|
7
8
|
from hestia_earth.models.utils import weighted_average
|
|
8
9
|
from hestia_earth.models.utils.input import get_feed_inputs
|
|
9
10
|
from hestia_earth.models.utils.term import get_lookup_value
|
|
10
|
-
from hestia_earth.models.utils.property import get_node_property, get_node_property_value
|
|
11
|
+
from hestia_earth.models.utils.property import get_node_property, get_node_property_value
|
|
11
12
|
from .utils import get_milkYield_practice
|
|
12
13
|
from . import MODEL
|
|
13
14
|
|
|
@@ -17,6 +18,9 @@ KEY_TERM_TYPES = [
|
|
|
17
18
|
]
|
|
18
19
|
|
|
19
20
|
|
|
21
|
+
def has_cycle_inputs_feed(cycle: dict): return any([i.get('isAnimalFeed', False) for i in cycle.get('inputs', [])])
|
|
22
|
+
|
|
23
|
+
|
|
20
24
|
def practice_input_id(practice: dict):
|
|
21
25
|
return get_lookup_value(practice.get('key', {}), 'grazedPastureGrassInputId', model=MODEL, model_key=MODEL_KEY)
|
|
22
26
|
|
|
@@ -217,13 +221,16 @@ def _calculate_NEg(cycle: dict, animal: dict) -> float:
|
|
|
217
221
|
return _NEg_BY_GROUPING.get(grouping, lambda *args: 0)(cycle, animal)
|
|
218
222
|
|
|
219
223
|
|
|
220
|
-
def _pastureGrass_key_property_value(
|
|
224
|
+
def _pastureGrass_key_property_value(node: dict, property_id: dict, **log_args):
|
|
221
225
|
def get_value(practice: dict):
|
|
222
226
|
term_id = practice_input_id(practice)
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
+
# try to find the input with the same id, as it can contain the properties
|
|
228
|
+
input = find_term_match(node.get('inputs', []), term_id) or {
|
|
229
|
+
'term': download_hestia(term_id)
|
|
230
|
+
}
|
|
231
|
+
property_value = get_node_property_value(MODEL, input, property_id, default=0, **log_args)
|
|
232
|
+
practice_value = list_sum(practice.get('value', [0]))
|
|
233
|
+
return (property_value, practice_value)
|
|
227
234
|
return get_value
|
|
228
235
|
|
|
229
236
|
|
|
@@ -337,16 +344,16 @@ def calculate_GE(values: list, REM: float, REG: float, NEwool: float, NEm_feed:
|
|
|
337
344
|
return ((REM_factor - NEm_feed_corrected)/REM + (REG_factor - NEg_feed_corrected)/REG) if all([REM, REG]) else 0
|
|
338
345
|
|
|
339
346
|
|
|
340
|
-
def calculate_meanECHHV(practices: list, **log_args) -> float:
|
|
341
|
-
values = list(map(_pastureGrass_key_property_value('energyContentHigherHeatingValue', **log_args), practices))
|
|
347
|
+
def calculate_meanECHHV(node: dict, practices: list, **log_args) -> float:
|
|
348
|
+
values = list(map(_pastureGrass_key_property_value(node, 'energyContentHigherHeatingValue', **log_args), practices))
|
|
342
349
|
total_weight = sum([weight/100 for _value, weight in values])
|
|
343
350
|
return sum([
|
|
344
351
|
(value * weight/100 if all([value, weight]) else 0) for value, weight in values
|
|
345
352
|
]) / total_weight if total_weight > 0 else 0
|
|
346
353
|
|
|
347
354
|
|
|
348
|
-
def calculate_meanDE(practices: list, **log_args) -> float:
|
|
349
|
-
values = list(map(_pastureGrass_key_property_value('energyDigestibilityRuminants', **log_args), practices))
|
|
355
|
+
def calculate_meanDE(node: dict, practices: list, **log_args) -> float:
|
|
356
|
+
values = list(map(_pastureGrass_key_property_value(node, 'energyDigestibilityRuminants', **log_args), practices))
|
|
350
357
|
total_weight = sum([weight/100 for _value, weight in values])
|
|
351
358
|
meanDE = sum([
|
|
352
359
|
(value * weight/100 if all([value, weight]) else 0) for value, weight in values
|
|
@@ -53,7 +53,7 @@ _GROUP_BY_KEYS = ['term', 'key', 'operation', 'animal']
|
|
|
53
53
|
|
|
54
54
|
|
|
55
55
|
def _emission(model: str, term_id: str, value: float, input: dict, animal={}, extra={}):
|
|
56
|
-
emission = _new_emission(term=term_id, model=
|
|
56
|
+
emission = _new_emission(term=term_id, model=model, value=value)
|
|
57
57
|
emission['methodTier'] = TIER
|
|
58
58
|
emission['inputs'] = [input]
|
|
59
59
|
if animal:
|