hestia-earth-models 0.64.0__py3-none-any.whl → 0.64.1__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/cycle/endDate.py +47 -0
- hestia_earth/models/cycle/otherSitesUnusedDuration.py +91 -0
- hestia_earth/models/cycle/siteUnusedDuration.py +2 -1
- hestia_earth/models/cycle/startDate.py +38 -10
- hestia_earth/models/cycle/startDateDefinition.py +2 -2
- hestia_earth/models/edip2003/__init__.py +13 -0
- hestia_earth/models/edip2003/ozoneDepletionPotential.py +34 -0
- hestia_earth/models/mocking/search-results.json +23 -23
- hestia_earth/models/pooreNemecek2018/excretaKgN.py +9 -9
- hestia_earth/models/pooreNemecek2018/excretaKgVs.py +6 -8
- hestia_earth/models/poschEtAl2008/__init__.py +13 -0
- hestia_earth/models/poschEtAl2008/terrestrialAcidificationPotentialAccumulatedExceedance.py +40 -0
- hestia_earth/models/site/waterDepth.py +0 -3
- hestia_earth/models/version.py +1 -1
- {hestia_earth_models-0.64.0.dist-info → hestia_earth_models-0.64.1.dist-info}/METADATA +2 -2
- {hestia_earth_models-0.64.0.dist-info → hestia_earth_models-0.64.1.dist-info}/RECORD +26 -14
- tests/models/cycle/test_endDate.py +22 -0
- tests/models/cycle/test_otherSitesUnusedDuration.py +54 -0
- tests/models/cycle/test_startDate.py +23 -5
- tests/models/edip2003/__init__.py +0 -0
- tests/models/edip2003/test_ozoneDepletionPotential.py +46 -0
- tests/models/poschEtAl2008/__init__.py +0 -0
- tests/models/poschEtAl2008/test_terrestrialAcidificationPotentialAccumulatedExceedance.py +45 -0
- {hestia_earth_models-0.64.0.dist-info → hestia_earth_models-0.64.1.dist-info}/LICENSE +0 -0
- {hestia_earth_models-0.64.0.dist-info → hestia_earth_models-0.64.1.dist-info}/WHEEL +0 -0
- {hestia_earth_models-0.64.0.dist-info → hestia_earth_models-0.64.1.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"""
|
|
2
|
+
End Date
|
|
3
|
+
|
|
4
|
+
This model sets the [Cycle endDate](https://hestia.earth/schema/Cycle#endDate) based on:
|
|
5
|
+
* if no `cycleDuration` is provided, and the `endDate` is set to month precision (e.g., `2000-01`),
|
|
6
|
+
assumed it ended on the 14th of the month.
|
|
7
|
+
"""
|
|
8
|
+
from hestia_earth.utils.date import is_in_months
|
|
9
|
+
|
|
10
|
+
from hestia_earth.models.log import logRequirements, logShouldRun
|
|
11
|
+
from . import MODEL
|
|
12
|
+
|
|
13
|
+
REQUIREMENTS = {
|
|
14
|
+
"Cycle": {
|
|
15
|
+
"endDate": "month precision",
|
|
16
|
+
"none": {
|
|
17
|
+
"cycleDuration": ""
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
RETURNS = {
|
|
22
|
+
"The endDate as a string": ""
|
|
23
|
+
}
|
|
24
|
+
MODEL_KEY = 'endDate'
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def _run(cycle: dict):
|
|
28
|
+
endDate = cycle.get('endDate')
|
|
29
|
+
return f"{endDate}-14"
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _should_run(cycle: dict):
|
|
33
|
+
has_endDate = cycle.get('endDate') is not None
|
|
34
|
+
has_month_precision = has_endDate and is_in_months(cycle.get('endDate'))
|
|
35
|
+
no_cycleDuration = cycle.get('cycleDuration') is None
|
|
36
|
+
|
|
37
|
+
logRequirements(cycle, model=MODEL, key=MODEL_KEY, by='endDate',
|
|
38
|
+
has_endDate=has_endDate,
|
|
39
|
+
has_month_precision=has_month_precision,
|
|
40
|
+
no_cycleDuration=no_cycleDuration)
|
|
41
|
+
|
|
42
|
+
should_run = all([has_endDate, has_month_precision, no_cycleDuration])
|
|
43
|
+
logShouldRun(cycle, MODEL, None, should_run, key=MODEL_KEY, by='endDate')
|
|
44
|
+
return should_run
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def run(cycle: dict): return _run(cycle) if _should_run(cycle) else None
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Other Sites Unused Duration
|
|
3
|
+
|
|
4
|
+
This model sets the [Cycle otherSitesUnusedDuration](https://hestia.earth/schema/Cycle#otherSitesUnusedDuration)
|
|
5
|
+
based on the `otherSites`, `otherSitesDuration`, and the `longFallowRatio` practice associated with each.
|
|
6
|
+
"""
|
|
7
|
+
from hestia_earth.schema import SiteSiteType
|
|
8
|
+
from hestia_earth.utils.tools import list_sum
|
|
9
|
+
|
|
10
|
+
from hestia_earth.models.log import logRequirements, logShouldRun, log_as_table
|
|
11
|
+
from hestia_earth.models.utils.site import valid_site_type
|
|
12
|
+
from . import MODEL
|
|
13
|
+
|
|
14
|
+
REQUIREMENTS = {
|
|
15
|
+
"Cycle": {
|
|
16
|
+
"otherSites": [{
|
|
17
|
+
"@type": "Site",
|
|
18
|
+
"siteType": ["cropland", "glass and high accessible cover"]
|
|
19
|
+
}],
|
|
20
|
+
"otherSitesDuration": "",
|
|
21
|
+
"practices": [{
|
|
22
|
+
"@type": "Practice",
|
|
23
|
+
"value": "> 0",
|
|
24
|
+
"term.@id": "longFallowRatio",
|
|
25
|
+
"site": {"@type": "Site"}
|
|
26
|
+
}]
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
RETURNS = {
|
|
30
|
+
"The otherSitesUnusedDuration as an array of number": ""
|
|
31
|
+
}
|
|
32
|
+
MODEL_KEY = 'otherSitesUnusedDuration'
|
|
33
|
+
VALID_SITE_TYPES = [
|
|
34
|
+
SiteSiteType.CROPLAND.value,
|
|
35
|
+
SiteSiteType.GLASS_OR_HIGH_ACCESSIBLE_COVER.value
|
|
36
|
+
]
|
|
37
|
+
_PRACTICE_TERM_ID = 'longFallowRatio'
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def _run(siteDuration: float, longFallowRatio: float):
|
|
41
|
+
return siteDuration * (longFallowRatio - 1)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _find_site_practice(practices: list, site_id: str):
|
|
45
|
+
return list_sum(next(
|
|
46
|
+
(p for p in practices if all([
|
|
47
|
+
p.get('term', {}).get('@id') == _PRACTICE_TERM_ID,
|
|
48
|
+
p.get('site') is None or p.get('site', {}).get('@id', p.get('site', {}).get('id')) == site_id
|
|
49
|
+
])),
|
|
50
|
+
{}
|
|
51
|
+
).get('value'), None)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def _should_run(cycle: dict):
|
|
55
|
+
otherSitesDuration = cycle.get('otherSitesDuration', [])
|
|
56
|
+
practices = cycle.get('practices', [])
|
|
57
|
+
|
|
58
|
+
site_data = [
|
|
59
|
+
{
|
|
60
|
+
'site-id': site.get('@id', site.get('id')),
|
|
61
|
+
'siteType': site.get('siteType'),
|
|
62
|
+
'valid-site': valid_site_type(site, site_types=VALID_SITE_TYPES),
|
|
63
|
+
'site-duration': otherSitesDuration[index] if len(otherSitesDuration) > index else None,
|
|
64
|
+
_PRACTICE_TERM_ID: _find_site_practice(practices, site.get('@id'))
|
|
65
|
+
}
|
|
66
|
+
for index, site in enumerate(cycle.get('otherSites', []))
|
|
67
|
+
]
|
|
68
|
+
|
|
69
|
+
has_valid_sites = any([
|
|
70
|
+
all([
|
|
71
|
+
data.get('valid-site'),
|
|
72
|
+
data.get(_PRACTICE_TERM_ID) is not None,
|
|
73
|
+
(data.get('site-duration') or 0) >= 0
|
|
74
|
+
]) for data in site_data
|
|
75
|
+
])
|
|
76
|
+
|
|
77
|
+
logRequirements(cycle, model=MODEL, key=MODEL_KEY,
|
|
78
|
+
has_valid_sites=has_valid_sites,
|
|
79
|
+
site_data=log_as_table(site_data))
|
|
80
|
+
|
|
81
|
+
should_run = all([has_valid_sites])
|
|
82
|
+
logShouldRun(cycle, MODEL, None, should_run, key=MODEL_KEY)
|
|
83
|
+
return should_run, site_data
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def run(cycle: dict):
|
|
87
|
+
should_run, site_data = _should_run(cycle)
|
|
88
|
+
return [
|
|
89
|
+
_run(data.get('site-duration'), data.get(_PRACTICE_TERM_ID)) if data.get('valid-site') else None
|
|
90
|
+
for data in site_data
|
|
91
|
+
] if should_run else []
|
|
@@ -37,6 +37,7 @@ def _run(cycle: dict, longFallowRatio: float):
|
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
def _should_run(cycle: dict):
|
|
40
|
+
site_id = cycle.get('site', {}).get('@id', cycle.get('site', {}).get('id'))
|
|
40
41
|
site_type_valid = valid_site_type(cycle.get('site'), site_types=VALID_SITE_TYPES)
|
|
41
42
|
|
|
42
43
|
siteDuration = cycle.get('siteDuration', 0)
|
|
@@ -45,7 +46,7 @@ def _should_run(cycle: dict):
|
|
|
45
46
|
longFallowRatio = list_sum(next((
|
|
46
47
|
p for p in practices if all([
|
|
47
48
|
p.get('term', {}).get('@id') == 'longFallowRatio',
|
|
48
|
-
p.get('site') is None or p.get('site', {}).get('@id'
|
|
49
|
+
p.get('site') is None or p.get('site', {}).get('@id', p.get('site', {}).get('id')) == site_id
|
|
49
50
|
])
|
|
50
51
|
), {}).get('value'), None)
|
|
51
52
|
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Start Date
|
|
3
3
|
|
|
4
|
-
This model sets the [Cycle startDate](https://hestia.earth/schema/Cycle#startDate) based on
|
|
5
|
-
`cycleDuration
|
|
4
|
+
This model sets the [Cycle startDate](https://hestia.earth/schema/Cycle#startDate) based on:
|
|
5
|
+
* the `cycleDuration` and the `endDate` if it has been provided to a day precision (e.g., `2000-01-01`);
|
|
6
|
+
* if no `cycleDuration` is provided, and the `startDate` is set to month precision (e.g., `2000-01`),
|
|
7
|
+
assumed it started on the 15th of the month.
|
|
6
8
|
"""
|
|
7
9
|
from datetime import timedelta
|
|
8
|
-
from hestia_earth.utils.date import is_in_days
|
|
10
|
+
from hestia_earth.utils.date import is_in_days, is_in_months
|
|
9
11
|
from hestia_earth.utils.tools import safe_parse_date
|
|
10
12
|
|
|
11
13
|
from hestia_earth.models.log import logRequirements, logShouldRun
|
|
@@ -13,8 +15,11 @@ from . import MODEL
|
|
|
13
15
|
|
|
14
16
|
REQUIREMENTS = {
|
|
15
17
|
"Cycle": {
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
+
"optional": {
|
|
19
|
+
"startDate": "month precision",
|
|
20
|
+
"endDate": "day precision",
|
|
21
|
+
"cycleDuration": ""
|
|
22
|
+
}
|
|
18
23
|
}
|
|
19
24
|
}
|
|
20
25
|
RETURNS = {
|
|
@@ -23,25 +28,48 @@ RETURNS = {
|
|
|
23
28
|
MODEL_KEY = 'startDate'
|
|
24
29
|
|
|
25
30
|
|
|
26
|
-
def
|
|
31
|
+
def _run_by_cycleDuration(cycle: dict):
|
|
27
32
|
endDate = safe_parse_date(cycle.get('endDate'))
|
|
28
33
|
cycleDuration = cycle.get('cycleDuration')
|
|
29
34
|
return (endDate - timedelta(days=cycleDuration)).strftime('%Y-%m-%d')
|
|
30
35
|
|
|
31
36
|
|
|
32
|
-
def
|
|
37
|
+
def _should_run_by_cycleDuration(cycle: dict):
|
|
33
38
|
has_endDate = cycle.get('endDate') is not None
|
|
34
39
|
has_day_precision = has_endDate and is_in_days(cycle.get('endDate'))
|
|
35
40
|
has_cycleDuration = cycle.get('cycleDuration') is not None
|
|
36
41
|
|
|
37
|
-
logRequirements(cycle, model=MODEL, key=MODEL_KEY,
|
|
42
|
+
logRequirements(cycle, model=MODEL, key=MODEL_KEY, by='cycleDuration',
|
|
38
43
|
has_endDate=has_endDate,
|
|
39
44
|
has_day_precision=has_day_precision,
|
|
40
45
|
has_cycleDuration=has_cycleDuration)
|
|
41
46
|
|
|
42
47
|
should_run = all([has_endDate, has_day_precision, has_cycleDuration])
|
|
43
|
-
logShouldRun(cycle, MODEL, None, should_run, key=MODEL_KEY)
|
|
48
|
+
logShouldRun(cycle, MODEL, None, should_run, key=MODEL_KEY, by='cycleDuration')
|
|
44
49
|
return should_run
|
|
45
50
|
|
|
46
51
|
|
|
47
|
-
def
|
|
52
|
+
def _run_by_startDate(cycle: dict):
|
|
53
|
+
startDate = cycle.get('startDate')
|
|
54
|
+
return f"{startDate}-15"
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def _should_run_by_startDate(cycle: dict):
|
|
58
|
+
has_startDate = cycle.get('startDate') is not None
|
|
59
|
+
has_month_precision = has_startDate and is_in_months(cycle.get('startDate'))
|
|
60
|
+
no_cycleDuration = cycle.get('cycleDuration') is None
|
|
61
|
+
|
|
62
|
+
logRequirements(cycle, model=MODEL, key=MODEL_KEY, by='startDate',
|
|
63
|
+
has_startDate=has_startDate,
|
|
64
|
+
has_month_precision=has_month_precision,
|
|
65
|
+
no_cycleDuration=no_cycleDuration)
|
|
66
|
+
|
|
67
|
+
should_run = all([has_startDate, has_month_precision, no_cycleDuration])
|
|
68
|
+
logShouldRun(cycle, MODEL, None, should_run, key=MODEL_KEY, by='startDate')
|
|
69
|
+
return should_run
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def run(cycle: dict):
|
|
73
|
+
return _run_by_cycleDuration(cycle) if _should_run_by_cycleDuration(cycle) else (
|
|
74
|
+
_run_by_startDate(cycle) if _should_run_by_startDate(cycle) else None
|
|
75
|
+
)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from os.path import dirname, abspath
|
|
2
|
+
import sys
|
|
3
|
+
from importlib import import_module
|
|
4
|
+
|
|
5
|
+
from hestia_earth.models.utils.blank_node import run_if_required
|
|
6
|
+
|
|
7
|
+
CURRENT_DIR = dirname(abspath(__file__)) + '/'
|
|
8
|
+
sys.path.append(CURRENT_DIR)
|
|
9
|
+
MODEL = 'edip2003'
|
|
10
|
+
PKG = '.'.join(['hestia_earth', 'models', MODEL])
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def run(model: str, data): return run_if_required(MODEL, model, data, import_module(f".{model}", package=PKG))
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
from hestia_earth.models.log import logRequirements, logShouldRun
|
|
2
|
+
from hestia_earth.models.utils.indicator import _new_indicator
|
|
3
|
+
from hestia_earth.models.utils.impact_assessment import impact_lookup_value
|
|
4
|
+
from . import MODEL
|
|
5
|
+
|
|
6
|
+
REQUIREMENTS = {
|
|
7
|
+
"ImpactAssessment": {
|
|
8
|
+
"emissionsResourceUse": [{"@type": "Indicator", "value": "", "term.termType": "emission"}]
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
LOOKUPS = {
|
|
12
|
+
"emission": "ozoneDepletionPotential"
|
|
13
|
+
}
|
|
14
|
+
RETURNS = {
|
|
15
|
+
"Indicator": [{
|
|
16
|
+
"value": ""
|
|
17
|
+
}]
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
TERM_ID = 'ozoneDepletionPotential'
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def _indicator(value: float):
|
|
24
|
+
indicator = _new_indicator(TERM_ID, MODEL)
|
|
25
|
+
indicator['value'] = value
|
|
26
|
+
return indicator
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def run(impact_assessment: dict):
|
|
30
|
+
value = impact_lookup_value(MODEL, TERM_ID, impact_assessment, LOOKUPS['emission'])
|
|
31
|
+
logRequirements(impact_assessment, model=MODEL, term=TERM_ID,
|
|
32
|
+
value=value)
|
|
33
|
+
logShouldRun(impact_assessment, MODEL, TERM_ID, True)
|
|
34
|
+
return _indicator(value)
|
|
@@ -1058,15 +1058,15 @@
|
|
|
1058
1058
|
},
|
|
1059
1059
|
{
|
|
1060
1060
|
"@type": "Term",
|
|
1061
|
-
"@id": "
|
|
1061
|
+
"@id": "residueIncorporatedMoreThan30DaysBeforeCultivation"
|
|
1062
1062
|
},
|
|
1063
1063
|
{
|
|
1064
1064
|
"@type": "Term",
|
|
1065
|
-
"@id": "
|
|
1065
|
+
"@id": "residueIncorporatedLessThan30DaysBeforeCultivation"
|
|
1066
1066
|
},
|
|
1067
1067
|
{
|
|
1068
1068
|
"@type": "Term",
|
|
1069
|
-
"@id": "
|
|
1069
|
+
"@id": "residueRemoved"
|
|
1070
1070
|
},
|
|
1071
1071
|
{
|
|
1072
1072
|
"@type": "Term",
|
|
@@ -1094,19 +1094,19 @@
|
|
|
1094
1094
|
},
|
|
1095
1095
|
{
|
|
1096
1096
|
"@type": "Term",
|
|
1097
|
-
"@id": "
|
|
1097
|
+
"@id": "discardedCropLeftOnField"
|
|
1098
1098
|
},
|
|
1099
1099
|
{
|
|
1100
1100
|
"@type": "Term",
|
|
1101
|
-
"@id": "
|
|
1101
|
+
"@id": "discardedCropTotal"
|
|
1102
1102
|
},
|
|
1103
1103
|
{
|
|
1104
1104
|
"@type": "Term",
|
|
1105
|
-
"@id": "
|
|
1105
|
+
"@id": "discardedCropIncorporated"
|
|
1106
1106
|
},
|
|
1107
1107
|
{
|
|
1108
1108
|
"@type": "Term",
|
|
1109
|
-
"@id": "
|
|
1109
|
+
"@id": "aboveGroundCropResidueRemoved"
|
|
1110
1110
|
},
|
|
1111
1111
|
{
|
|
1112
1112
|
"@type": "Term",
|
|
@@ -1505,11 +1505,11 @@
|
|
|
1505
1505
|
},
|
|
1506
1506
|
{
|
|
1507
1507
|
"@type": "Term",
|
|
1508
|
-
"@id": "
|
|
1508
|
+
"@id": "nonFloodedPreSeasonLessThan180Days"
|
|
1509
1509
|
},
|
|
1510
1510
|
{
|
|
1511
1511
|
"@type": "Term",
|
|
1512
|
-
"@id": "
|
|
1512
|
+
"@id": "nonFloodedPreSeasonMoreThan180Days"
|
|
1513
1513
|
},
|
|
1514
1514
|
{
|
|
1515
1515
|
"@type": "Term",
|
|
@@ -1528,7 +1528,7 @@
|
|
|
1528
1528
|
"@type": "Term",
|
|
1529
1529
|
"name": "Generic crop, seed",
|
|
1530
1530
|
"@id": "genericCropSeed",
|
|
1531
|
-
"_score":
|
|
1531
|
+
"_score": 25.47927
|
|
1532
1532
|
}
|
|
1533
1533
|
]
|
|
1534
1534
|
},
|
|
@@ -1764,61 +1764,61 @@
|
|
|
1764
1764
|
"@type": "Term",
|
|
1765
1765
|
"name": "Glass or high accessible cover",
|
|
1766
1766
|
"@id": "glassOrHighAccessibleCover",
|
|
1767
|
-
"_score":
|
|
1767
|
+
"_score": 58.564175
|
|
1768
1768
|
},
|
|
1769
1769
|
{
|
|
1770
1770
|
"@type": "Term",
|
|
1771
1771
|
"name": "River or stream",
|
|
1772
1772
|
"@id": "riverOrStream",
|
|
1773
|
-
"_score":
|
|
1773
|
+
"_score": 50.11611
|
|
1774
1774
|
},
|
|
1775
1775
|
{
|
|
1776
1776
|
"@type": "Term",
|
|
1777
1777
|
"name": "Other natural vegetation",
|
|
1778
1778
|
"@id": "otherNaturalVegetation",
|
|
1779
|
-
"_score":
|
|
1779
|
+
"_score": 40.03552
|
|
1780
1780
|
},
|
|
1781
1781
|
{
|
|
1782
1782
|
"@type": "Term",
|
|
1783
1783
|
"name": "Natural forest",
|
|
1784
1784
|
"@id": "naturalForest",
|
|
1785
|
-
"_score":
|
|
1785
|
+
"_score": 30.704037
|
|
1786
1786
|
},
|
|
1787
1787
|
{
|
|
1788
1788
|
"@type": "Term",
|
|
1789
1789
|
"name": "Permanent pasture",
|
|
1790
1790
|
"@id": "permanentPasture",
|
|
1791
|
-
"_score":
|
|
1791
|
+
"_score": 27.611277
|
|
1792
1792
|
},
|
|
1793
1793
|
{
|
|
1794
1794
|
"@type": "Term",
|
|
1795
1795
|
"name": "Animal housing",
|
|
1796
1796
|
"@id": "animalHousing",
|
|
1797
|
-
"_score":
|
|
1797
|
+
"_score": 26.687897
|
|
1798
1798
|
},
|
|
1799
1799
|
{
|
|
1800
1800
|
"@type": "Term",
|
|
1801
1801
|
"name": "Root or tuber crop plant",
|
|
1802
1802
|
"@id": "rootOrTuberCropPlant",
|
|
1803
|
-
"_score":
|
|
1803
|
+
"_score": 24.424568
|
|
1804
1804
|
},
|
|
1805
1805
|
{
|
|
1806
1806
|
"@type": "Term",
|
|
1807
1807
|
"name": "High intensity grazing pasture",
|
|
1808
1808
|
"@id": "highIntensityGrazingPasture",
|
|
1809
|
-
"_score":
|
|
1809
|
+
"_score": 23.257332
|
|
1810
1810
|
},
|
|
1811
1811
|
{
|
|
1812
1812
|
"@type": "Term",
|
|
1813
1813
|
"name": "Permanent cropland",
|
|
1814
1814
|
"@id": "permanentCropland",
|
|
1815
|
-
"_score":
|
|
1815
|
+
"_score": 19.83205
|
|
1816
1816
|
},
|
|
1817
1817
|
{
|
|
1818
1818
|
"@type": "Term",
|
|
1819
1819
|
"name": "Forest",
|
|
1820
1820
|
"@id": "forest",
|
|
1821
|
-
"_score":
|
|
1821
|
+
"_score": 19.576632
|
|
1822
1822
|
}
|
|
1823
1823
|
]
|
|
1824
1824
|
},
|
|
@@ -2066,15 +2066,15 @@
|
|
|
2066
2066
|
"results": [
|
|
2067
2067
|
{
|
|
2068
2068
|
"@type": "Term",
|
|
2069
|
-
"@id": "
|
|
2069
|
+
"@id": "noTillage"
|
|
2070
2070
|
},
|
|
2071
2071
|
{
|
|
2072
2072
|
"@type": "Term",
|
|
2073
|
-
"@id": "
|
|
2073
|
+
"@id": "ridgeTillage"
|
|
2074
2074
|
},
|
|
2075
2075
|
{
|
|
2076
2076
|
"@type": "Term",
|
|
2077
|
-
"@id": "
|
|
2077
|
+
"@id": "verticalTillage"
|
|
2078
2078
|
},
|
|
2079
2079
|
{
|
|
2080
2080
|
"@type": "Term",
|
|
@@ -28,6 +28,14 @@ REQUIREMENTS = {
|
|
|
28
28
|
"Cycle": {
|
|
29
29
|
"completeness.animalFeed": "",
|
|
30
30
|
"completeness.product": "",
|
|
31
|
+
"products": [{
|
|
32
|
+
"@type": "Product",
|
|
33
|
+
"value": "",
|
|
34
|
+
"term.termType": ["liveAnimal", "animalProduct", "liveAquaticSpecies"],
|
|
35
|
+
"optional": {
|
|
36
|
+
"properties": [{"@type": "Property", "value": "", "term.@id": "nitrogenContent"}]
|
|
37
|
+
}
|
|
38
|
+
}],
|
|
31
39
|
"or": [
|
|
32
40
|
{
|
|
33
41
|
"animals": [{
|
|
@@ -55,15 +63,7 @@ REQUIREMENTS = {
|
|
|
55
63
|
]
|
|
56
64
|
}]
|
|
57
65
|
}
|
|
58
|
-
]
|
|
59
|
-
"products": [{
|
|
60
|
-
"@type": "Product",
|
|
61
|
-
"value": "",
|
|
62
|
-
"term.termType": ["liveAnimal", "animalProduct", "liveAquaticSpecies"],
|
|
63
|
-
"optional": {
|
|
64
|
-
"properties": [{"@type": "Property", "value": "", "term.@id": "nitrogenContent"}]
|
|
65
|
-
}
|
|
66
|
-
}]
|
|
66
|
+
]
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
RETURNS = {
|
|
@@ -26,6 +26,12 @@ from . import MODEL
|
|
|
26
26
|
|
|
27
27
|
REQUIREMENTS = {
|
|
28
28
|
"Cycle": {
|
|
29
|
+
"products": [{
|
|
30
|
+
"@type": "Product",
|
|
31
|
+
"primary": "True",
|
|
32
|
+
"value": "",
|
|
33
|
+
"term.termType": ["animalProduct", "liveAnimal", "liveAquaticSpecies"]
|
|
34
|
+
}],
|
|
29
35
|
"or": [
|
|
30
36
|
{
|
|
31
37
|
"completeness.animalFeed": "",
|
|
@@ -72,14 +78,6 @@ REQUIREMENTS = {
|
|
|
72
78
|
"@type": "Site",
|
|
73
79
|
"measurements": [{"@type": "Measurement", "value": "", "term.@id": "netPrimaryProduction"}]
|
|
74
80
|
}
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
"products": [{
|
|
78
|
-
"@type": "Product",
|
|
79
|
-
"primary": "True",
|
|
80
|
-
"value": "",
|
|
81
|
-
"term.termType": ["animalProduct", "liveAnimal", "liveAquaticSpecies"]
|
|
82
|
-
}]
|
|
83
81
|
}
|
|
84
82
|
]
|
|
85
83
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from os.path import dirname, abspath
|
|
2
|
+
import sys
|
|
3
|
+
from importlib import import_module
|
|
4
|
+
|
|
5
|
+
from hestia_earth.models.utils.blank_node import run_if_required
|
|
6
|
+
|
|
7
|
+
CURRENT_DIR = dirname(abspath(__file__)) + '/'
|
|
8
|
+
sys.path.append(CURRENT_DIR)
|
|
9
|
+
MODEL = 'poschEtAl2008'
|
|
10
|
+
PKG = '.'.join(['hestia_earth', 'models', MODEL])
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def run(model: str, data): return run_if_required(MODEL, model, data, import_module(f".{model}", package=PKG))
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
from hestia_earth.models.log import logRequirements, logShouldRun
|
|
2
|
+
from hestia_earth.models.utils.impact_assessment import impact_country_value
|
|
3
|
+
from hestia_earth.models.utils.indicator import _new_indicator
|
|
4
|
+
from . import MODEL
|
|
5
|
+
|
|
6
|
+
REQUIREMENTS = {
|
|
7
|
+
"ImpactAssessment": {
|
|
8
|
+
"or": {
|
|
9
|
+
"country": {"@type": "Term", "termType": "region"},
|
|
10
|
+
"site": {
|
|
11
|
+
"@type": "Site",
|
|
12
|
+
"region": {"@type": "Term", "termType": "region"}
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"emissionsResourceUse": [{"@type": "Indicator", "value": "", "term.termType": "emission"}]
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
RETURNS = {
|
|
19
|
+
"Indicator": {
|
|
20
|
+
"value": ""
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
LOOKUPS = {
|
|
24
|
+
"region-emission-terrestrialAcidificationPotentialAccumulatedExceedance": ""
|
|
25
|
+
}
|
|
26
|
+
TERM_ID = 'terrestrialAcidificationPotentialAccumulatedExceedance'
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def _indicator(value: float):
|
|
30
|
+
indicator = _new_indicator(TERM_ID, MODEL)
|
|
31
|
+
indicator['value'] = value
|
|
32
|
+
return indicator
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def run(impact_assessment: dict):
|
|
36
|
+
value = impact_country_value(MODEL, TERM_ID, impact_assessment, f"{list(LOOKUPS.keys())[0]}.csv")
|
|
37
|
+
logRequirements(impact_assessment, model=MODEL, term=TERM_ID,
|
|
38
|
+
value=value)
|
|
39
|
+
logShouldRun(impact_assessment, MODEL, TERM_ID, True)
|
|
40
|
+
return _indicator(value)
|
|
@@ -14,9 +14,6 @@ RETURNS = {
|
|
|
14
14
|
"methodClassification": "modelled using other measurements"
|
|
15
15
|
}]
|
|
16
16
|
}
|
|
17
|
-
LOOKUPS = {
|
|
18
|
-
"crop": "Non_bearing_duration"
|
|
19
|
-
}
|
|
20
17
|
TERM_ID = 'waterDepth'
|
|
21
18
|
BIBLIO_TITLE = 'Reducing food’s environmental impacts through producers and consumers'
|
|
22
19
|
SITE_TYPE_TO_DEPTH = {
|
hestia_earth/models/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
VERSION = '0.64.
|
|
1
|
+
VERSION = '0.64.1'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: hestia-earth-models
|
|
3
|
-
Version: 0.64.
|
|
3
|
+
Version: 0.64.1
|
|
4
4
|
Summary: HESTIA's set of modules for filling gaps in the activity data using external datasets (e.g. populating soil properties with a geospatial dataset using provided coordinates) and internal lookups (e.g. populating machinery use from fuel use). Includes rules for when gaps should be filled versus not (e.g. never gap fill yield, gap fill crop residue if yield provided etc.).
|
|
5
5
|
Home-page: https://gitlab.com/hestia-earth/hestia-engine-models
|
|
6
6
|
Author: HESTIA Team
|
|
@@ -12,7 +12,7 @@ Classifier: Programming Language :: Python :: 3.6
|
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
13
|
License-File: LICENSE
|
|
14
14
|
Requires-Dist: hestia-earth.schema==30.*
|
|
15
|
-
Requires-Dist: hestia-earth.utils>=0.13.
|
|
15
|
+
Requires-Dist: hestia-earth.utils>=0.13.4
|
|
16
16
|
Requires-Dist: python-dateutil>=2.8.1
|
|
17
17
|
Requires-Dist: CurrencyConverter==0.16.8
|
|
18
18
|
Requires-Dist: haversine>=2.7.0
|
|
@@ -4,7 +4,7 @@ hestia_earth/models/cache_sites.py,sha256=KQp9cUKE-aIcYJoMWEtKFYS8gBFfsx5LKQhqoW
|
|
|
4
4
|
hestia_earth/models/log.py,sha256=DbfNcGzaC5hzkuMDxQqW6XYoNBI4Uxw4SIoOYoZA6og,3474
|
|
5
5
|
hestia_earth/models/preload_requests.py,sha256=Ibx-YOhR_1yuyFBxsLUbvJHVK7PLyMLoPu5l9jDN_Qk,1342
|
|
6
6
|
hestia_earth/models/requirements.py,sha256=eU4yT443fx7BnaokhrLB_PCizJI7Y6m4auyo8vQauNg,17363
|
|
7
|
-
hestia_earth/models/version.py,sha256=
|
|
7
|
+
hestia_earth/models/version.py,sha256=ynV6q1Uuf9gDmUxe-eyYGdhh8GzowZGw5X9OY5kt03Y,19
|
|
8
8
|
hestia_earth/models/agribalyse2016/__init__.py,sha256=WvK0qCQbnYtg9oZxrACd1wGormZyXibPtpCnIQeDqbw,415
|
|
9
9
|
hestia_earth/models/agribalyse2016/fuelElectricity.py,sha256=tnGxBmJdPfPFfehLUQcefEqy1lHvzsSpx_s7O8nf3Zs,4412
|
|
10
10
|
hestia_earth/models/agribalyse2016/machineryInfrastructureDepreciatedAmountPerCycle.py,sha256=_Rbngu0DzHKa62JwBl58ZC_ui1zLF2que_nB7ukhOQc,3392
|
|
@@ -41,6 +41,7 @@ hestia_earth/models/cycle/concentrateFeed.py,sha256=wiq9KLRuipHz_2_CVfXDuUek0JN1
|
|
|
41
41
|
hestia_earth/models/cycle/cropResidueManagement.py,sha256=QTRCCFu9VvD_a3_8aAj216vsuhAJEhlAwTJH7ifMkDo,2237
|
|
42
42
|
hestia_earth/models/cycle/croppingIntensity.py,sha256=44CgDqXg9CBRfTPYTyOleQT-M4_tsQgPba-0vjjk_C4,1770
|
|
43
43
|
hestia_earth/models/cycle/cycleDuration.py,sha256=SuTFqCP3Zr3nOV9HuvvvIVcaHtOlTAdSaaswvRLSEwc,3242
|
|
44
|
+
hestia_earth/models/cycle/endDate.py,sha256=xxTa3Pmu7udJwGYiTn7tcp9_Pl_SM7de9ezbR7sYvUk,1382
|
|
44
45
|
hestia_earth/models/cycle/energyContentLowerHeatingValue.py,sha256=AyVKCQbb3Pto3Ca__F0KJ_wlwTxbPd7mUyehZW7AJPM,2212
|
|
45
46
|
hestia_earth/models/cycle/excretaKgMass.py,sha256=iA8Kfl3WvyxbQpx1QOGPQZ9O_Pc5rj7xhucYx3rB8Co,3949
|
|
46
47
|
hestia_earth/models/cycle/excretaKgN.py,sha256=mgJTneQIYJ9Su-rTK5ppb_k3YhICFNWsfPZtGR98RI0,2968
|
|
@@ -50,6 +51,7 @@ hestia_earth/models/cycle/irrigatedTypeUnspecified.py,sha256=KlIa5eDvT47Twz6Q1kp
|
|
|
50
51
|
hestia_earth/models/cycle/liveAnimal.py,sha256=LWAMnNKRoLDdChrGApVIN-Ns7em0Lspz5UtLbf7PPLY,3988
|
|
51
52
|
hestia_earth/models/cycle/longFallowRatio.py,sha256=_h0kub99sACO87IfjMeiu8IgdK2jaeBlgGA9A9-ViZA,1683
|
|
52
53
|
hestia_earth/models/cycle/milkYield.py,sha256=RhzePjkvEAGicTzRA4eatc0K_4NSGHhyEhYF0EbbGXw,5820
|
|
54
|
+
hestia_earth/models/cycle/otherSitesUnusedDuration.py,sha256=HkjCfllhtodAQ3LBjoEXCiii1t2LJxM9HZNyYWaAqas,2984
|
|
53
55
|
hestia_earth/models/cycle/pastureGrass.py,sha256=7PrmDMJPtsbKGa8WIOh_4NXNtbH3Pxb23pmjawQuY9o,1226
|
|
54
56
|
hestia_earth/models/cycle/pastureSystem.py,sha256=uksVgl_3bp_t2niwZ5BvS3VT-Kndx26Se6GpzqG0bX8,2709
|
|
55
57
|
hestia_earth/models/cycle/readyToCookWeightPerHead.py,sha256=R1Rt3WsTzwnI2Bqljx03RpdG0A1-bGV4M7EqmcP7Dzg,2955
|
|
@@ -58,9 +60,9 @@ hestia_earth/models/cycle/residueIncorporated.py,sha256=9_s2RMOy5D20eq9ziDBEA_Y7
|
|
|
58
60
|
hestia_earth/models/cycle/residueLeftOnField.py,sha256=qYxKGAdUORN7Vjqj7AZC2VGV_rM3MN0-padDGhgjiNU,2175
|
|
59
61
|
hestia_earth/models/cycle/residueRemoved.py,sha256=jxDu_Jfcyd-rm-qo8ZuRIf-GGxtFBMpmGy1zHOavwy0,2135
|
|
60
62
|
hestia_earth/models/cycle/siteDuration.py,sha256=793ez4IDOHxsbDIREZQ5rUgS6FQare2jL6SZ8qemxKs,2014
|
|
61
|
-
hestia_earth/models/cycle/siteUnusedDuration.py,sha256=
|
|
62
|
-
hestia_earth/models/cycle/startDate.py,sha256=
|
|
63
|
-
hestia_earth/models/cycle/startDateDefinition.py,sha256
|
|
63
|
+
hestia_earth/models/cycle/siteUnusedDuration.py,sha256=orYGlbzGMpjuDAtZe7KkCOLWrwUYR1H4A0ccAbutW3s,2189
|
|
64
|
+
hestia_earth/models/cycle/startDate.py,sha256=pbBi55b6uJezPE8EOovOCSwQVrbwpmxwmravOCIh2zg,2683
|
|
65
|
+
hestia_earth/models/cycle/startDateDefinition.py,sha256=--U3YLZjJ3WIHl8dxAOewGfMcYtOZS-M2KanJKG1cJw,2246
|
|
64
66
|
hestia_earth/models/cycle/transformation.py,sha256=06KTfVubh2I47dfnG9Iv6AbuUBbURM8BAVOkRu7XmHw,1255
|
|
65
67
|
hestia_earth/models/cycle/unknownPreSeasonWaterRegime.py,sha256=9EP8FMXO5fHqmhVNSqR_Dfe38KxwyPOCF6kMewiI_VE,1478
|
|
66
68
|
hestia_earth/models/cycle/utils.py,sha256=ZcVwvRwVNK48jZfnhrHl2ai4a96YzcmRgO-eQXwQNjo,1408
|
|
@@ -117,6 +119,8 @@ hestia_earth/models/ecoinventV3/__init__.py,sha256=FctfsXFgEz23KbKNig1bY-fhoTN2Q
|
|
|
117
119
|
hestia_earth/models/ecoinventV3/utils.py,sha256=HqtD8MzK9C_RCJ-ME-5G4J1KoCn5FqmAx4l0kjsCDbM,1577
|
|
118
120
|
hestia_earth/models/ecoinventV3AndEmberClimate/__init__.py,sha256=XYFDUNpQpzbjPgLus0YlM3UdiXX7LLwn-XJqjrH9ywM,5801
|
|
119
121
|
hestia_earth/models/ecoinventV3AndEmberClimate/utils.py,sha256=INWB7gyhzk49GQ0KAcBS-Kzwdoyd5MQJcsCtuT6XxZA,1352
|
|
122
|
+
hestia_earth/models/edip2003/__init__.py,sha256=nyB0CI2gNmRAXj-203aJHQMmETYhcY-dHbMABOhJ7YI,409
|
|
123
|
+
hestia_earth/models/edip2003/ozoneDepletionPotential.py,sha256=GdaAgDIUPcWccbbjB-CbxqelSW2vUGdIfJUbQBi4-sA,971
|
|
120
124
|
hestia_earth/models/emepEea2019/__init__.py,sha256=l90-pWrqIzt1ap1WNk0gF4iZeF5_TSG62hE83bIi4rQ,412
|
|
121
125
|
hestia_earth/models/emepEea2019/co2ToAirFuelCombustion.py,sha256=ib_xzEbIg-iQwvW2L4BosD9lV6EYOXAiIs8gYhSD9GE,1431
|
|
122
126
|
hestia_earth/models/emepEea2019/n2OToAirFuelCombustionDirect.py,sha256=H4dgGqDuvYN4S7TRxYsX3hms1xMWr8clR2gkyyO8T18,1438
|
|
@@ -375,13 +379,13 @@ hestia_earth/models/linkedImpactAssessment/landTransformationFromPermanentPastur
|
|
|
375
379
|
hestia_earth/models/linkedImpactAssessment/utils.py,sha256=dGwGc2d-8_WQElTpfyPmz5vQtL-LHQRmiZnCTuPXMDs,1876
|
|
376
380
|
hestia_earth/models/mocking/__init__.py,sha256=n3Fkkrvh8zHNWiJZmnfQ7WZ91JRzAO9P6pSG1JpwtXo,687
|
|
377
381
|
hestia_earth/models/mocking/mock_search.py,sha256=qgABw-sZK37XtsALKt8AHF2VJPUrZSnHv5Qj1Dn93oA,2405
|
|
378
|
-
hestia_earth/models/mocking/search-results.json,sha256=
|
|
382
|
+
hestia_earth/models/mocking/search-results.json,sha256=Hq-CDpm39QU5BB1x3ncyXYj5_4aIUzywOmYsjTHpDLA,47243
|
|
379
383
|
hestia_earth/models/pooreNemecek2018/__init__.py,sha256=nPboL7ULJzL5nJD5q7q9VOZt_fxbKVm8fmn1Az5YkVY,417
|
|
380
384
|
hestia_earth/models/pooreNemecek2018/aboveGroundCropResidueTotal.py,sha256=Qt-mel4dkhK6N5uUOutNOinCTFjbjtGzITaaI0LvYc4,2396
|
|
381
385
|
hestia_earth/models/pooreNemecek2018/belowGroundCropResidue.py,sha256=JT0RybbvWVlo01FO8K0Yj41HrEaJT3Kj1xfayr2X-xw,2315
|
|
382
386
|
hestia_earth/models/pooreNemecek2018/ch4ToAirAquacultureSystems.py,sha256=CxjhFinScTebBGNVheEdbdw36DdHwoPszAnbxtd6_9s,6590
|
|
383
|
-
hestia_earth/models/pooreNemecek2018/excretaKgN.py,sha256=
|
|
384
|
-
hestia_earth/models/pooreNemecek2018/excretaKgVs.py,sha256=
|
|
387
|
+
hestia_earth/models/pooreNemecek2018/excretaKgN.py,sha256=kB4C1mSA9h8uUJXXaf-39ZwhzAmmvapkfA7v0nUN_Qg,6418
|
|
388
|
+
hestia_earth/models/pooreNemecek2018/excretaKgVs.py,sha256=5rK3wfI8JO2feaFRv23-s9bH09DIl4LLLcjHS3cf-Ow,8424
|
|
385
389
|
hestia_earth/models/pooreNemecek2018/freshwaterWithdrawalsDuringCycle.py,sha256=HB_9q5eE6al2Te3v29hC5wqxsYe4P46ZAPwdWNzx3v0,3939
|
|
386
390
|
hestia_earth/models/pooreNemecek2018/landOccupationDuringCycle.py,sha256=jE110XgPMgfnBMUXyKIL5SL9yZWYhdGr5NrfHcqn2h0,2785
|
|
387
391
|
hestia_earth/models/pooreNemecek2018/longFallowDuration.py,sha256=Wdm6QyOttCFP9Y3OjbaYrvdMmivOmMIT-m5Eg9SM9rY,1511
|
|
@@ -402,6 +406,8 @@ hestia_earth/models/pooreNemecek2018/plantationProductiveLifespan.py,sha256=Q54w
|
|
|
402
406
|
hestia_earth/models/pooreNemecek2018/rotationDuration.py,sha256=j5hW_NEKYQbeMcdsqp2nQIDXCnUdZIKURzAmPCiegQk,1525
|
|
403
407
|
hestia_earth/models/pooreNemecek2018/saplings.py,sha256=LS0zepV51-LlVmPBAjj5nlfgaJFnQF6wo40sgoFCr3Y,2258
|
|
404
408
|
hestia_earth/models/pooreNemecek2018/utils.py,sha256=to2vtONKCbuG1gVSDvsUcG7EnlahELfG_57gzIAHlv0,1710
|
|
409
|
+
hestia_earth/models/poschEtAl2008/__init__.py,sha256=nvyyGglxCTV4PpxcOjY7jJb0v8Bjzj435Zt1j6VcryM,414
|
|
410
|
+
hestia_earth/models/poschEtAl2008/terrestrialAcidificationPotentialAccumulatedExceedance.py,sha256=gbD8fgvdHANXsuPPWRx4Flcqhk3fPD5ROrrb2LMgmS8,1279
|
|
405
411
|
hestia_earth/models/recipe2016Egalitarian/__init__.py,sha256=OvZoSgfaMe6DWIdqr-Sx3ouzXlp994oro7Mi0Xid18Q,422
|
|
406
412
|
hestia_earth/models/recipe2016Egalitarian/damageToFreshwaterEcosystemsSpeciesYear.py,sha256=b1UZAsy3yGlHYxH2YhBhhSnjm5zzQl8Z32DcQBjgWNE,1123
|
|
407
413
|
hestia_earth/models/recipe2016Egalitarian/damageToHumanHealth.py,sha256=dJ8WinGe52wFQCMKtT_B7c1MFM_GbBo8aqfw0n2pw94,1087
|
|
@@ -493,7 +499,7 @@ hestia_earth/models/site/temperatureAnnual.py,sha256=Q3b1RH2_hpA0JWwOYA5nKgMGcXH
|
|
|
493
499
|
hestia_earth/models/site/temperatureMonthly.py,sha256=yXwpFCGT2tUqvVBNedaPyBmN_KlzZqo5yv2TWem1pBk,1890
|
|
494
500
|
hestia_earth/models/site/totalNitrogenPerKgSoil.py,sha256=8ERrTZpN_yCRUyFg_EYaX4abE9jLcyX3lx3MO4Bi6CE,1938
|
|
495
501
|
hestia_earth/models/site/utils.py,sha256=b5y6jNmTclC1Vs8FzwW22u3sVyFsvs5if3NJzvLZQLs,3176
|
|
496
|
-
hestia_earth/models/site/waterDepth.py,sha256=
|
|
502
|
+
hestia_earth/models/site/waterDepth.py,sha256=jlphpSAHp-xBlTQsl_j_3xEH50HD7YrvvB7HHuSww-M,1244
|
|
497
503
|
hestia_earth/models/site/measurement/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
498
504
|
hestia_earth/models/site/measurement/value.py,sha256=7IhUbIj7n5vB7yXoNxXsWbliEJjg1Ww3T5g_P2IyNCU,1661
|
|
499
505
|
hestia_earth/models/site/post_checks/__init__.py,sha256=CkExxesk1GuG8NjrbKfix1iDuVUgU-9i1ccM_X7MZn4,284
|
|
@@ -613,6 +619,7 @@ tests/models/cycle/test_concentrateFeed.py,sha256=tgkThL4g293CexLvb89ftO9UqUbHhN
|
|
|
613
619
|
tests/models/cycle/test_cropResidueManagement.py,sha256=vQWl7rDYLJjiKyBQlCiOA76LpzM4dI2t7JJ30uF8H9M,2020
|
|
614
620
|
tests/models/cycle/test_croppingIntensity.py,sha256=o5nA5tGbnk1IFdOhlN_Dh9oKcSq_yzSwkbBJzYfmYMg,1565
|
|
615
621
|
tests/models/cycle/test_cycleDuration.py,sha256=2KExiliuOa7_j88rJuPObJKZqq0xsRnFAb0ZEqc5KEM,846
|
|
622
|
+
tests/models/cycle/test_endDate.py,sha256=4OKaPAkIQmsEZHhuC6o1ZnC1RkVPbhrZ7DIrn4286JM,537
|
|
616
623
|
tests/models/cycle/test_energyContentLowerHeatingValue.py,sha256=ZvHigQrtneKrRc8qr7rN8aj6tuA0ds0V6Brh0UzN_T8,1204
|
|
617
624
|
tests/models/cycle/test_excretaKgMass.py,sha256=xpuq0k5HKvnGmWdJy0GmIv6A4xYk2VDFB4BMb8J2Z0g,2925
|
|
618
625
|
tests/models/cycle/test_excretaKgN.py,sha256=xoe0PF-DwhVkihN-1BonUa7u_QNM9lr7CmGXsOozQ0Y,1090
|
|
@@ -623,6 +630,7 @@ tests/models/cycle/test_irrigatedTypeUnspecified.py,sha256=9YGwpDO_RHMaldvjJZ0xd
|
|
|
623
630
|
tests/models/cycle/test_liveAnimal.py,sha256=7fRPgEnIwcir-tYwUNnr6gc2e5_vnZi-t8EuuiPioeM,2139
|
|
624
631
|
tests/models/cycle/test_longFallowRatio.py,sha256=sztr1pysldwedTC78JWUHAVWl2oL0jTIQ13c6Nxzlso,1512
|
|
625
632
|
tests/models/cycle/test_milkYield.py,sha256=7e5JJzLkc47OnQf3xni1Nkyq7N4xi1RglnE8caE9TfY,1778
|
|
633
|
+
tests/models/cycle/test_otherSitesUnusedDuration.py,sha256=zQejrYNwq14Pwe3d0zmfhxjdif5s_udbdVCiZcTuC8w,1635
|
|
626
634
|
tests/models/cycle/test_pastureGrass.py,sha256=hNRjBLYXGybzHPMfBOCgcRjGkDBmW0k_G6tn9TLrycY,1025
|
|
627
635
|
tests/models/cycle/test_pastureSystem.py,sha256=VlPn4mlaNimiu3liV5EMELJueUCqSSJ1l82yMV0UK90,1590
|
|
628
636
|
tests/models/cycle/test_post_checks.py,sha256=yeUm-uZ4Om8poct2TgpFQEy-Hg72LNacyQcQ2Qh4Yyw,286
|
|
@@ -634,7 +642,7 @@ tests/models/cycle/test_residueLeftOnField.py,sha256=_8CoSp-7z3BBLGN5Hv067FRYz8y
|
|
|
634
642
|
tests/models/cycle/test_residueRemoved.py,sha256=R5v8lwGyz_4a9_X_LnugBEmgVgcisS5LTM5GFCtKIco,1278
|
|
635
643
|
tests/models/cycle/test_siteDuration.py,sha256=43Hjb0f2lXCRGqj-UmfLVmk7OGJswawtcA2q5wlffXk,1712
|
|
636
644
|
tests/models/cycle/test_siteUnusedDuration.py,sha256=5h9R3guw6ErU_sE5omoiK9Fpke74SmQWsJYWYURE9Fo,1532
|
|
637
|
-
tests/models/cycle/test_startDate.py,sha256
|
|
645
|
+
tests/models/cycle/test_startDate.py,sha256=-U1_XIx8v5zxK3oK5fCIIsS7GFKymNh3m0SgJ0J2iZ8,1223
|
|
638
646
|
tests/models/cycle/test_startDateDefinition.py,sha256=42BmsT1I7Jq_YMVN-VNU7a0fIZ2w3i5jgwy4H_r4dNM,920
|
|
639
647
|
tests/models/cycle/test_transformations.py,sha256=Ws_8KhNqeHogGFXTQ4qZXQ5Ph2I3ZUaY0yO1itFUHLk,464
|
|
640
648
|
tests/models/cycle/test_unknownPreSeasonWaterRegime.py,sha256=4JSSpDvBQEQrDoytNVzuIcm9UVio4TzZpZm52iMWBVA,1220
|
|
@@ -678,6 +686,8 @@ tests/models/dammgen2009/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
|
|
|
678
686
|
tests/models/dammgen2009/test_noxToAirExcreta.py,sha256=RWd9QvzmJtN9M6UC6KDHkXwtKvwv0aAfMuI9HtsJLvk,1213
|
|
679
687
|
tests/models/deRuijterEtAl2010/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
680
688
|
tests/models/deRuijterEtAl2010/test_nh3ToAirCropResidueDecomposition.py,sha256=kS1nUBVohOSCb386g6Wq7iVclmx0haekUDYo7VQ4NCA,2030
|
|
689
|
+
tests/models/edip2003/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
690
|
+
tests/models/edip2003/test_ozoneDepletionPotential.py,sha256=dZAAwlhEtkhvLzJMksOIIW9YZiS7eXnwffWyY4TTU_g,1575
|
|
681
691
|
tests/models/emepEea2019/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
682
692
|
tests/models/emepEea2019/test_co2ToAirFuelCombustion.py,sha256=z1H17R_Erox2dMg8xylGB0qt9BMZSwfLAoEMVv9z878,1518
|
|
683
693
|
tests/models/emepEea2019/test_n2OToAirFuelCombustionDirect.py,sha256=4uemriZAyJBSn-xMttRpxqVHOFNBXlboVODHQYl65zQ,1524
|
|
@@ -954,6 +964,8 @@ tests/models/pooreNemecek2018/test_plantationLifespan.py,sha256=Pcbnhbt_HVfEet12
|
|
|
954
964
|
tests/models/pooreNemecek2018/test_plantationProductiveLifespan.py,sha256=ifvjTXJxmbS3GH4a7S9T2mgPseajX8WL4KQ5lT_2Rus,935
|
|
955
965
|
tests/models/pooreNemecek2018/test_rotationDuration.py,sha256=tD2E91beAXdyT-xf5QSqc7kp5UPDDEaCE-FgsoSGorg,923
|
|
956
966
|
tests/models/pooreNemecek2018/test_saplings.py,sha256=uJyUWUocvrcPndv-YFLs0WfxGEAG1kM8HEWZwutRhvs,1621
|
|
967
|
+
tests/models/poschEtAl2008/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
968
|
+
tests/models/poschEtAl2008/test_terrestrialAcidificationPotentialAccumulatedExceedance.py,sha256=NJ_W-ypWwjBuGiaXUeJvaQ9ZufoqlSWk1NYE9tt94ZA,1612
|
|
957
969
|
tests/models/recipe2016Egalitarian/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
958
970
|
tests/models/recipe2016Egalitarian/test_damageToFreshwaterEcosystemsSpeciesYear.py,sha256=OC8WjzPuyz5fd_E-LxFbOg3sasVc6LMJ9UK-jAKO7LU,697
|
|
959
971
|
tests/models/recipe2016Egalitarian/test_damageToHumanHealth.py,sha256=fWjzC9r6itihyW6AdmDkotbhML_0KavXernOpnK1SmY,677
|
|
@@ -1104,8 +1116,8 @@ tests/models/utils/test_source.py,sha256=_Ol-OrJs2Tt9iZAZ_RY2qRuSbnE4yz5OuEGkDSb
|
|
|
1104
1116
|
tests/models/utils/test_term.py,sha256=M5Sa26v2gzQYbZ4H_fo7DspnaCx__-WtL-MULGapCWk,3509
|
|
1105
1117
|
tests/models/webbEtAl2012AndSintermannEtAl2012/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
1106
1118
|
tests/models/webbEtAl2012AndSintermannEtAl2012/test_nh3ToAirOrganicFertiliser.py,sha256=qi2FNXS5Af2WDtm7nq_FsprH3BfCF0XxnE0XHmC4aIY,2244
|
|
1107
|
-
hestia_earth_models-0.64.
|
|
1108
|
-
hestia_earth_models-0.64.
|
|
1109
|
-
hestia_earth_models-0.64.
|
|
1110
|
-
hestia_earth_models-0.64.
|
|
1111
|
-
hestia_earth_models-0.64.
|
|
1119
|
+
hestia_earth_models-0.64.1.dist-info/LICENSE,sha256=AC7h7GAgCZGJK_Tzh6LUCrML9gQEfowWwecEw2w54QM,1154
|
|
1120
|
+
hestia_earth_models-0.64.1.dist-info/METADATA,sha256=2I5vnl3mTZYWnqfJFd_A_KY0KomvUj2GMXm7GLaEPGo,3343
|
|
1121
|
+
hestia_earth_models-0.64.1.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
|
|
1122
|
+
hestia_earth_models-0.64.1.dist-info/top_level.txt,sha256=1dqA9TqpOLTEgpqa-YBsmbCmmNU1y56AtfFGEceZ2A0,19
|
|
1123
|
+
hestia_earth_models-0.64.1.dist-info/RECORD,,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
from hestia_earth.models.cycle.endDate import _should_run, run
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def test_should_run():
|
|
5
|
+
# no endDate => no run
|
|
6
|
+
cycle = {}
|
|
7
|
+
should_run = _should_run(cycle)
|
|
8
|
+
assert not should_run
|
|
9
|
+
|
|
10
|
+
# with endDate with days => no run
|
|
11
|
+
cycle['endDate'] = '2020-01-01'
|
|
12
|
+
should_run = _should_run(cycle)
|
|
13
|
+
assert not should_run
|
|
14
|
+
|
|
15
|
+
# with endDate no days => run
|
|
16
|
+
cycle['endDate'] = '2020-01'
|
|
17
|
+
should_run = _should_run(cycle)
|
|
18
|
+
assert should_run is True
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def test_run():
|
|
22
|
+
assert run({'endDate': '2020-01'}) == '2020-01-14'
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import pytest
|
|
3
|
+
from tests.utils import fixtures_path
|
|
4
|
+
|
|
5
|
+
from hestia_earth.models.cycle.otherSitesUnusedDuration import MODEL, MODEL_KEY, _should_run, run
|
|
6
|
+
|
|
7
|
+
fixtures_folder = f"{fixtures_path}/{MODEL}/{MODEL_KEY}"
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@pytest.mark.parametrize(
|
|
11
|
+
'test_name,cycle,expected_should_run',
|
|
12
|
+
[
|
|
13
|
+
(
|
|
14
|
+
'no otherSites => no run',
|
|
15
|
+
{},
|
|
16
|
+
False
|
|
17
|
+
),
|
|
18
|
+
(
|
|
19
|
+
'with otherSites => no run',
|
|
20
|
+
{
|
|
21
|
+
'otherSites': [{'siteType': 'cropland'}, {'siteType': 'permanent pasture'}]
|
|
22
|
+
},
|
|
23
|
+
False
|
|
24
|
+
),
|
|
25
|
+
(
|
|
26
|
+
'with otherSites and otherSitesDuration => no run',
|
|
27
|
+
{
|
|
28
|
+
'otherSites': [{'siteType': 'cropland'}, {'siteType': 'permanent pasture'}],
|
|
29
|
+
'otherSitesDuration': [200, 300]
|
|
30
|
+
},
|
|
31
|
+
False
|
|
32
|
+
),
|
|
33
|
+
(
|
|
34
|
+
'with siteDuration and otherSitesDuration and longFallowRatio => run',
|
|
35
|
+
{
|
|
36
|
+
'otherSites': [{'@id': '1', 'siteType': 'cropland'}, {'@id': '2', 'siteType': 'permanent pasture'}],
|
|
37
|
+
'otherSitesDuration': [200, 300],
|
|
38
|
+
'practices': [{'term': {'@id': 'longFallowRatio'}, 'value': [10], 'site': {'@id': '1'}}]
|
|
39
|
+
},
|
|
40
|
+
True
|
|
41
|
+
)
|
|
42
|
+
]
|
|
43
|
+
)
|
|
44
|
+
def test_should_run_animal(test_name, cycle, expected_should_run):
|
|
45
|
+
should_run, *args = _should_run(cycle)
|
|
46
|
+
assert should_run == expected_should_run, test_name
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def test_run():
|
|
50
|
+
with open(f"{fixtures_folder}/cycle.jsonld", encoding='utf-8') as f:
|
|
51
|
+
data = json.load(f)
|
|
52
|
+
|
|
53
|
+
value = run(data)
|
|
54
|
+
assert value == [50, None]
|
|
@@ -1,22 +1,40 @@
|
|
|
1
|
-
from hestia_earth.models.cycle.startDate import
|
|
1
|
+
from hestia_earth.models.cycle.startDate import _should_run_by_cycleDuration, _should_run_by_startDate, run
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
def
|
|
4
|
+
def test_should_run_by_cycleDuration():
|
|
5
5
|
# no endDate => no run
|
|
6
6
|
cycle = {'cycleDuration': 365}
|
|
7
|
-
should_run =
|
|
7
|
+
should_run = _should_run_by_cycleDuration(cycle)
|
|
8
8
|
assert not should_run
|
|
9
9
|
|
|
10
10
|
# with startDate missing days => not run
|
|
11
11
|
cycle['endDate'] = '2020-01'
|
|
12
|
-
should_run =
|
|
12
|
+
should_run = _should_run_by_cycleDuration(cycle)
|
|
13
13
|
assert not should_run
|
|
14
14
|
|
|
15
15
|
# with endDate full date => run
|
|
16
16
|
cycle['endDate'] = '2020-01-01'
|
|
17
|
-
should_run =
|
|
17
|
+
should_run = _should_run_by_cycleDuration(cycle)
|
|
18
|
+
assert should_run is True
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def test_should_run_by_startDate():
|
|
22
|
+
# no startDate => no run
|
|
23
|
+
cycle = {}
|
|
24
|
+
should_run = _should_run_by_startDate(cycle)
|
|
25
|
+
assert not should_run
|
|
26
|
+
|
|
27
|
+
# with startDate with days => no run
|
|
28
|
+
cycle['startDate'] = '2020-01-01'
|
|
29
|
+
should_run = _should_run_by_startDate(cycle)
|
|
30
|
+
assert not should_run
|
|
31
|
+
|
|
32
|
+
# with startDate no days => run
|
|
33
|
+
cycle['startDate'] = '2020-01'
|
|
34
|
+
should_run = _should_run_by_startDate(cycle)
|
|
18
35
|
assert should_run is True
|
|
19
36
|
|
|
20
37
|
|
|
21
38
|
def test_run():
|
|
22
39
|
assert run({'endDate': '2020-01-01', 'cycleDuration': 365}) == '2019-01-01'
|
|
40
|
+
assert run({'startDate': '2020-01'}) == '2020-01-15'
|
|
File without changes
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
from unittest.mock import patch
|
|
2
|
+
import json
|
|
3
|
+
|
|
4
|
+
from hestia_earth.models.utils.lookup import factor_value
|
|
5
|
+
from tests.utils import fixtures_path, fake_new_indicator
|
|
6
|
+
|
|
7
|
+
from hestia_earth.models.edip2003.ozoneDepletionPotential import MODEL, TERM_ID, run
|
|
8
|
+
|
|
9
|
+
class_path = f"hestia_earth.models.{MODEL}.{TERM_ID}"
|
|
10
|
+
fixtures_folder = f"{fixtures_path}/{MODEL}/{TERM_ID}"
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@patch(f"{class_path}._new_indicator", side_effect=fake_new_indicator)
|
|
14
|
+
def test_run(*args):
|
|
15
|
+
with open(f"{fixtures_folder}/impactassessment.jsonld", encoding='utf-8') as f:
|
|
16
|
+
impactassessment = json.load(f)
|
|
17
|
+
|
|
18
|
+
with open(f"{fixtures_folder}/result.jsonld", encoding='utf-8') as f:
|
|
19
|
+
expected = json.load(f)
|
|
20
|
+
|
|
21
|
+
value = run(impactassessment)
|
|
22
|
+
assert value == expected
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
@patch(f"{class_path}._new_indicator", side_effect=fake_new_indicator)
|
|
26
|
+
def test_run_empty_input(*args):
|
|
27
|
+
"""
|
|
28
|
+
Test with impact-assessment.jsonld that does NOT contain any "emissionsResourceUse".
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
with open(f"{fixtures_path}/impact_assessment/emissions/impact-assessment.jsonld", encoding='utf-8') as f:
|
|
32
|
+
impactassessment = json.load(f)
|
|
33
|
+
|
|
34
|
+
result = run(impactassessment)
|
|
35
|
+
assert result['value'] is None
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def test_known_ozone_depletion_lookup_value(*args):
|
|
39
|
+
lookup_result = factor_value(
|
|
40
|
+
'edip2003', 'ozoneDepletionPotential', 'emission.csv', 'ozoneDepletionPotential')(
|
|
41
|
+
data={
|
|
42
|
+
'@type': 'Emission',
|
|
43
|
+
'term': {'@type': 'Term', '@id': '112TrichlorotrifluoroethaneToAirInputsProduction'},
|
|
44
|
+
'value': [1],
|
|
45
|
+
})
|
|
46
|
+
assert lookup_result == 0.81
|
|
File without changes
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import json
|
|
2
|
+
from unittest.mock import patch
|
|
3
|
+
|
|
4
|
+
from hestia_earth.models.poschEtAl2008.terrestrialAcidificationPotentialAccumulatedExceedance import MODEL, TERM_ID, run
|
|
5
|
+
from tests.utils import fixtures_path, fake_new_indicator
|
|
6
|
+
|
|
7
|
+
class_path = f"hestia_earth.models.{MODEL}.{TERM_ID}"
|
|
8
|
+
fixtures_folder = f"{fixtures_path}/{MODEL}/{TERM_ID}"
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@patch(f"{class_path}._new_indicator", side_effect=fake_new_indicator)
|
|
12
|
+
def test_run(*args):
|
|
13
|
+
with open(f"{fixtures_folder}/impact-assessment.jsonld", encoding='utf-8') as f:
|
|
14
|
+
cycle = json.load(f)
|
|
15
|
+
|
|
16
|
+
with open(f"{fixtures_folder}/result.jsonld", encoding='utf-8') as f:
|
|
17
|
+
expected = json.load(f)
|
|
18
|
+
|
|
19
|
+
value = run(cycle)
|
|
20
|
+
assert value == expected
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@patch(f"{class_path}._new_indicator", side_effect=fake_new_indicator)
|
|
24
|
+
def test_lookup_to_bad_country(*args):
|
|
25
|
+
with open(f"{fixtures_folder}/impact-assessment.jsonld", encoding='utf-8') as f:
|
|
26
|
+
cycle = json.load(f)
|
|
27
|
+
cycle['country']['@id'] = "example-land-not-real"
|
|
28
|
+
|
|
29
|
+
value = run(cycle)
|
|
30
|
+
assert value['value'] is None
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@patch(f"{class_path}._new_indicator", side_effect=fake_new_indicator)
|
|
34
|
+
def test_lookup_no_term_type(*args):
|
|
35
|
+
"""
|
|
36
|
+
We currently do not filter out bad termTypes so this is expected behavior.
|
|
37
|
+
"""
|
|
38
|
+
with open(f"{fixtures_folder}/impact-assessment.jsonld", encoding='utf-8') as f:
|
|
39
|
+
cycle = json.load(f)
|
|
40
|
+
del cycle['emissionsResourceUse'][0]['term']['termType']
|
|
41
|
+
del cycle['emissionsResourceUse'][1]['term']['termType']
|
|
42
|
+
cycle['emissionsResourceUse'][2]['term']['termType'] = "wrong-type"
|
|
43
|
+
|
|
44
|
+
value = run(cycle)
|
|
45
|
+
assert value['value'] == 0.085
|
|
File without changes
|
|
File without changes
|
|
File without changes
|