hestia-earth-models 0.64.0__py3-none-any.whl → 0.64.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.
Potentially problematic release.
This version of hestia-earth-models might be problematic. Click here for more details.
- hestia_earth/models/cycle/concentrateFeed.py +12 -3
- 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/ipcc2019/ch4ToAirAquacultureSystems.py +96 -0
- hestia_earth/models/mocking/search-results.json +500 -260
- 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.2.dist-info}/METADATA +2 -2
- {hestia_earth_models-0.64.0.dist-info → hestia_earth_models-0.64.2.dist-info}/RECORD +29 -15
- 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/ipcc2019/test_ch4ToAirAquacultureSystems.py +60 -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.2.dist-info}/LICENSE +0 -0
- {hestia_earth_models-0.64.0.dist-info → hestia_earth_models-0.64.2.dist-info}/WHEEL +0 -0
- {hestia_earth_models-0.64.0.dist-info → hestia_earth_models-0.64.2.dist-info}/top_level.txt +0 -0
|
@@ -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.2'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: hestia-earth-models
|
|
3
|
-
Version: 0.64.
|
|
3
|
+
Version: 0.64.2
|
|
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=zhuRvhTOGAr79_4TdettlTNm_GVkWPyvMGpCa_UD5hQ,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
|
|
@@ -37,10 +37,11 @@ hestia_earth/models/cycle/__init__.py,sha256=VowO3kOHb0LpURsljNaJsYO7s6vgjhul6bF
|
|
|
37
37
|
hestia_earth/models/cycle/aboveGroundCropResidueTotal.py,sha256=9swq4YEeJQ2YjVOmghgBYWkMZWdNU4MKCUBY5FsmBSU,3088
|
|
38
38
|
hestia_earth/models/cycle/coldCarcassWeightPerHead.py,sha256=fQ7huuxyS5PQkRmR_tRCOz9rV3LJwLfLQJjH_TcTz6k,2955
|
|
39
39
|
hestia_earth/models/cycle/coldDressedCarcassWeightPerHead.py,sha256=k0xg5SIfJGwEKteFr2Fh-lh8yDC_sqQw_lBnnfwl9zU,3069
|
|
40
|
-
hestia_earth/models/cycle/concentrateFeed.py,sha256=
|
|
40
|
+
hestia_earth/models/cycle/concentrateFeed.py,sha256=vE6cKhwDflU2IMn3Dpy8tvmZxqCLEp5r8vLC65eQDGI,5863
|
|
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
|
|
@@ -228,6 +232,7 @@ hestia_earth/models/ipcc2019/__init__.py,sha256=LdRpu8KbEc-MroIwXfKDjfj-xbgmfUYg
|
|
|
228
232
|
hestia_earth/models/ipcc2019/aboveGroundCropResidueTotal.py,sha256=lT2QVV5c2LvQqZRfPEvFT_bMTayMXgIsFLnx8I6iYzw,3089
|
|
229
233
|
hestia_earth/models/ipcc2019/belowGroundCropResidue.py,sha256=7AFU2Q0qPAvv6uEKWByS38jl77FvjTPbGm2GQ53waGg,3499
|
|
230
234
|
hestia_earth/models/ipcc2019/carbonContent.py,sha256=tlQvu4Auhpjmaz7XrZz86xwxVrJhsYYf8DFA_aQeev4,7255
|
|
235
|
+
hestia_earth/models/ipcc2019/ch4ToAirAquacultureSystems.py,sha256=q6yyEiYQhHJ2VyQy2Fa84cuTl1D8bjBXOK3UpaRuo20,3196
|
|
231
236
|
hestia_earth/models/ipcc2019/ch4ToAirEntericFermentation.py,sha256=khX90NjkmlvosyRZ77QxgwTKwg42Z_ftOWTTAanHViw,11420
|
|
232
237
|
hestia_earth/models/ipcc2019/ch4ToAirExcreta.py,sha256=jEGgEUhMr0JHq_-lPJioKHOQGQXrQvblU51AppXKvB0,6719
|
|
233
238
|
hestia_earth/models/ipcc2019/ch4ToAirFloodedRice.py,sha256=TJ4J7VA5n4RPrJYZQeR3lc3ZoCw7T1E5Cb1XJewr834,7331
|
|
@@ -375,13 +380,13 @@ hestia_earth/models/linkedImpactAssessment/landTransformationFromPermanentPastur
|
|
|
375
380
|
hestia_earth/models/linkedImpactAssessment/utils.py,sha256=dGwGc2d-8_WQElTpfyPmz5vQtL-LHQRmiZnCTuPXMDs,1876
|
|
376
381
|
hestia_earth/models/mocking/__init__.py,sha256=n3Fkkrvh8zHNWiJZmnfQ7WZ91JRzAO9P6pSG1JpwtXo,687
|
|
377
382
|
hestia_earth/models/mocking/mock_search.py,sha256=qgABw-sZK37XtsALKt8AHF2VJPUrZSnHv5Qj1Dn93oA,2405
|
|
378
|
-
hestia_earth/models/mocking/search-results.json,sha256=
|
|
383
|
+
hestia_earth/models/mocking/search-results.json,sha256=mbdSj0kpcZiabKvMZipfGvwSokugpHBU4Z5fvVHnuTw,53137
|
|
379
384
|
hestia_earth/models/pooreNemecek2018/__init__.py,sha256=nPboL7ULJzL5nJD5q7q9VOZt_fxbKVm8fmn1Az5YkVY,417
|
|
380
385
|
hestia_earth/models/pooreNemecek2018/aboveGroundCropResidueTotal.py,sha256=Qt-mel4dkhK6N5uUOutNOinCTFjbjtGzITaaI0LvYc4,2396
|
|
381
386
|
hestia_earth/models/pooreNemecek2018/belowGroundCropResidue.py,sha256=JT0RybbvWVlo01FO8K0Yj41HrEaJT3Kj1xfayr2X-xw,2315
|
|
382
387
|
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=
|
|
388
|
+
hestia_earth/models/pooreNemecek2018/excretaKgN.py,sha256=kB4C1mSA9h8uUJXXaf-39ZwhzAmmvapkfA7v0nUN_Qg,6418
|
|
389
|
+
hestia_earth/models/pooreNemecek2018/excretaKgVs.py,sha256=5rK3wfI8JO2feaFRv23-s9bH09DIl4LLLcjHS3cf-Ow,8424
|
|
385
390
|
hestia_earth/models/pooreNemecek2018/freshwaterWithdrawalsDuringCycle.py,sha256=HB_9q5eE6al2Te3v29hC5wqxsYe4P46ZAPwdWNzx3v0,3939
|
|
386
391
|
hestia_earth/models/pooreNemecek2018/landOccupationDuringCycle.py,sha256=jE110XgPMgfnBMUXyKIL5SL9yZWYhdGr5NrfHcqn2h0,2785
|
|
387
392
|
hestia_earth/models/pooreNemecek2018/longFallowDuration.py,sha256=Wdm6QyOttCFP9Y3OjbaYrvdMmivOmMIT-m5Eg9SM9rY,1511
|
|
@@ -402,6 +407,8 @@ hestia_earth/models/pooreNemecek2018/plantationProductiveLifespan.py,sha256=Q54w
|
|
|
402
407
|
hestia_earth/models/pooreNemecek2018/rotationDuration.py,sha256=j5hW_NEKYQbeMcdsqp2nQIDXCnUdZIKURzAmPCiegQk,1525
|
|
403
408
|
hestia_earth/models/pooreNemecek2018/saplings.py,sha256=LS0zepV51-LlVmPBAjj5nlfgaJFnQF6wo40sgoFCr3Y,2258
|
|
404
409
|
hestia_earth/models/pooreNemecek2018/utils.py,sha256=to2vtONKCbuG1gVSDvsUcG7EnlahELfG_57gzIAHlv0,1710
|
|
410
|
+
hestia_earth/models/poschEtAl2008/__init__.py,sha256=nvyyGglxCTV4PpxcOjY7jJb0v8Bjzj435Zt1j6VcryM,414
|
|
411
|
+
hestia_earth/models/poschEtAl2008/terrestrialAcidificationPotentialAccumulatedExceedance.py,sha256=gbD8fgvdHANXsuPPWRx4Flcqhk3fPD5ROrrb2LMgmS8,1279
|
|
405
412
|
hestia_earth/models/recipe2016Egalitarian/__init__.py,sha256=OvZoSgfaMe6DWIdqr-Sx3ouzXlp994oro7Mi0Xid18Q,422
|
|
406
413
|
hestia_earth/models/recipe2016Egalitarian/damageToFreshwaterEcosystemsSpeciesYear.py,sha256=b1UZAsy3yGlHYxH2YhBhhSnjm5zzQl8Z32DcQBjgWNE,1123
|
|
407
414
|
hestia_earth/models/recipe2016Egalitarian/damageToHumanHealth.py,sha256=dJ8WinGe52wFQCMKtT_B7c1MFM_GbBo8aqfw0n2pw94,1087
|
|
@@ -493,7 +500,7 @@ hestia_earth/models/site/temperatureAnnual.py,sha256=Q3b1RH2_hpA0JWwOYA5nKgMGcXH
|
|
|
493
500
|
hestia_earth/models/site/temperatureMonthly.py,sha256=yXwpFCGT2tUqvVBNedaPyBmN_KlzZqo5yv2TWem1pBk,1890
|
|
494
501
|
hestia_earth/models/site/totalNitrogenPerKgSoil.py,sha256=8ERrTZpN_yCRUyFg_EYaX4abE9jLcyX3lx3MO4Bi6CE,1938
|
|
495
502
|
hestia_earth/models/site/utils.py,sha256=b5y6jNmTclC1Vs8FzwW22u3sVyFsvs5if3NJzvLZQLs,3176
|
|
496
|
-
hestia_earth/models/site/waterDepth.py,sha256=
|
|
503
|
+
hestia_earth/models/site/waterDepth.py,sha256=jlphpSAHp-xBlTQsl_j_3xEH50HD7YrvvB7HHuSww-M,1244
|
|
497
504
|
hestia_earth/models/site/measurement/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
498
505
|
hestia_earth/models/site/measurement/value.py,sha256=7IhUbIj7n5vB7yXoNxXsWbliEJjg1Ww3T5g_P2IyNCU,1661
|
|
499
506
|
hestia_earth/models/site/post_checks/__init__.py,sha256=CkExxesk1GuG8NjrbKfix1iDuVUgU-9i1ccM_X7MZn4,284
|
|
@@ -613,6 +620,7 @@ tests/models/cycle/test_concentrateFeed.py,sha256=tgkThL4g293CexLvb89ftO9UqUbHhN
|
|
|
613
620
|
tests/models/cycle/test_cropResidueManagement.py,sha256=vQWl7rDYLJjiKyBQlCiOA76LpzM4dI2t7JJ30uF8H9M,2020
|
|
614
621
|
tests/models/cycle/test_croppingIntensity.py,sha256=o5nA5tGbnk1IFdOhlN_Dh9oKcSq_yzSwkbBJzYfmYMg,1565
|
|
615
622
|
tests/models/cycle/test_cycleDuration.py,sha256=2KExiliuOa7_j88rJuPObJKZqq0xsRnFAb0ZEqc5KEM,846
|
|
623
|
+
tests/models/cycle/test_endDate.py,sha256=4OKaPAkIQmsEZHhuC6o1ZnC1RkVPbhrZ7DIrn4286JM,537
|
|
616
624
|
tests/models/cycle/test_energyContentLowerHeatingValue.py,sha256=ZvHigQrtneKrRc8qr7rN8aj6tuA0ds0V6Brh0UzN_T8,1204
|
|
617
625
|
tests/models/cycle/test_excretaKgMass.py,sha256=xpuq0k5HKvnGmWdJy0GmIv6A4xYk2VDFB4BMb8J2Z0g,2925
|
|
618
626
|
tests/models/cycle/test_excretaKgN.py,sha256=xoe0PF-DwhVkihN-1BonUa7u_QNM9lr7CmGXsOozQ0Y,1090
|
|
@@ -623,6 +631,7 @@ tests/models/cycle/test_irrigatedTypeUnspecified.py,sha256=9YGwpDO_RHMaldvjJZ0xd
|
|
|
623
631
|
tests/models/cycle/test_liveAnimal.py,sha256=7fRPgEnIwcir-tYwUNnr6gc2e5_vnZi-t8EuuiPioeM,2139
|
|
624
632
|
tests/models/cycle/test_longFallowRatio.py,sha256=sztr1pysldwedTC78JWUHAVWl2oL0jTIQ13c6Nxzlso,1512
|
|
625
633
|
tests/models/cycle/test_milkYield.py,sha256=7e5JJzLkc47OnQf3xni1Nkyq7N4xi1RglnE8caE9TfY,1778
|
|
634
|
+
tests/models/cycle/test_otherSitesUnusedDuration.py,sha256=zQejrYNwq14Pwe3d0zmfhxjdif5s_udbdVCiZcTuC8w,1635
|
|
626
635
|
tests/models/cycle/test_pastureGrass.py,sha256=hNRjBLYXGybzHPMfBOCgcRjGkDBmW0k_G6tn9TLrycY,1025
|
|
627
636
|
tests/models/cycle/test_pastureSystem.py,sha256=VlPn4mlaNimiu3liV5EMELJueUCqSSJ1l82yMV0UK90,1590
|
|
628
637
|
tests/models/cycle/test_post_checks.py,sha256=yeUm-uZ4Om8poct2TgpFQEy-Hg72LNacyQcQ2Qh4Yyw,286
|
|
@@ -634,7 +643,7 @@ tests/models/cycle/test_residueLeftOnField.py,sha256=_8CoSp-7z3BBLGN5Hv067FRYz8y
|
|
|
634
643
|
tests/models/cycle/test_residueRemoved.py,sha256=R5v8lwGyz_4a9_X_LnugBEmgVgcisS5LTM5GFCtKIco,1278
|
|
635
644
|
tests/models/cycle/test_siteDuration.py,sha256=43Hjb0f2lXCRGqj-UmfLVmk7OGJswawtcA2q5wlffXk,1712
|
|
636
645
|
tests/models/cycle/test_siteUnusedDuration.py,sha256=5h9R3guw6ErU_sE5omoiK9Fpke74SmQWsJYWYURE9Fo,1532
|
|
637
|
-
tests/models/cycle/test_startDate.py,sha256
|
|
646
|
+
tests/models/cycle/test_startDate.py,sha256=-U1_XIx8v5zxK3oK5fCIIsS7GFKymNh3m0SgJ0J2iZ8,1223
|
|
638
647
|
tests/models/cycle/test_startDateDefinition.py,sha256=42BmsT1I7Jq_YMVN-VNU7a0fIZ2w3i5jgwy4H_r4dNM,920
|
|
639
648
|
tests/models/cycle/test_transformations.py,sha256=Ws_8KhNqeHogGFXTQ4qZXQ5Ph2I3ZUaY0yO1itFUHLk,464
|
|
640
649
|
tests/models/cycle/test_unknownPreSeasonWaterRegime.py,sha256=4JSSpDvBQEQrDoytNVzuIcm9UVio4TzZpZm52iMWBVA,1220
|
|
@@ -678,6 +687,8 @@ tests/models/dammgen2009/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
|
|
|
678
687
|
tests/models/dammgen2009/test_noxToAirExcreta.py,sha256=RWd9QvzmJtN9M6UC6KDHkXwtKvwv0aAfMuI9HtsJLvk,1213
|
|
679
688
|
tests/models/deRuijterEtAl2010/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
680
689
|
tests/models/deRuijterEtAl2010/test_nh3ToAirCropResidueDecomposition.py,sha256=kS1nUBVohOSCb386g6Wq7iVclmx0haekUDYo7VQ4NCA,2030
|
|
690
|
+
tests/models/edip2003/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
691
|
+
tests/models/edip2003/test_ozoneDepletionPotential.py,sha256=dZAAwlhEtkhvLzJMksOIIW9YZiS7eXnwffWyY4TTU_g,1575
|
|
681
692
|
tests/models/emepEea2019/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
682
693
|
tests/models/emepEea2019/test_co2ToAirFuelCombustion.py,sha256=z1H17R_Erox2dMg8xylGB0qt9BMZSwfLAoEMVv9z878,1518
|
|
683
694
|
tests/models/emepEea2019/test_n2OToAirFuelCombustionDirect.py,sha256=4uemriZAyJBSn-xMttRpxqVHOFNBXlboVODHQYl65zQ,1524
|
|
@@ -787,6 +798,7 @@ tests/models/ipcc2019/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3h
|
|
|
787
798
|
tests/models/ipcc2019/test_aboveGroundCropResidueTotal.py,sha256=AADYB1g9vftH7YSvNyihHu8GQOiA7VhXxVQ-oJQNT88,2581
|
|
788
799
|
tests/models/ipcc2019/test_belowGroundCropResidue.py,sha256=HUxHZLBdLX_E_oc3wqTwNtGY4M4yCWcxx-1iBYPF7_s,2576
|
|
789
800
|
tests/models/ipcc2019/test_carbonContent.py,sha256=_GWF5nGy-PxiqBZ5V7W_sHMz75YRzmxr79R-sZZg7yk,4146
|
|
801
|
+
tests/models/ipcc2019/test_ch4ToAirAquacultureSystems.py,sha256=o7bHOS4JkwexRrDhLzpfr8nyYCctgRL32YZbam5RBrI,1891
|
|
790
802
|
tests/models/ipcc2019/test_ch4ToAirEntericFermentation.py,sha256=3Hv86L4X_Va2mZL4KI-36AV00z-KBbKo0cb2ABg6Rv8,7928
|
|
791
803
|
tests/models/ipcc2019/test_ch4ToAirExcreta.py,sha256=e58NXmBW2SNVLUqQO9A66Xq6jiGTyhdFZDZk51JApF8,2902
|
|
792
804
|
tests/models/ipcc2019/test_ch4ToAirFloodedRice.py,sha256=FAp5b45WdX5Ih4yGUOZ4CmVD8smW1Lw1tnulx9AKVBI,1980
|
|
@@ -954,6 +966,8 @@ tests/models/pooreNemecek2018/test_plantationLifespan.py,sha256=Pcbnhbt_HVfEet12
|
|
|
954
966
|
tests/models/pooreNemecek2018/test_plantationProductiveLifespan.py,sha256=ifvjTXJxmbS3GH4a7S9T2mgPseajX8WL4KQ5lT_2Rus,935
|
|
955
967
|
tests/models/pooreNemecek2018/test_rotationDuration.py,sha256=tD2E91beAXdyT-xf5QSqc7kp5UPDDEaCE-FgsoSGorg,923
|
|
956
968
|
tests/models/pooreNemecek2018/test_saplings.py,sha256=uJyUWUocvrcPndv-YFLs0WfxGEAG1kM8HEWZwutRhvs,1621
|
|
969
|
+
tests/models/poschEtAl2008/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
970
|
+
tests/models/poschEtAl2008/test_terrestrialAcidificationPotentialAccumulatedExceedance.py,sha256=NJ_W-ypWwjBuGiaXUeJvaQ9ZufoqlSWk1NYE9tt94ZA,1612
|
|
957
971
|
tests/models/recipe2016Egalitarian/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
958
972
|
tests/models/recipe2016Egalitarian/test_damageToFreshwaterEcosystemsSpeciesYear.py,sha256=OC8WjzPuyz5fd_E-LxFbOg3sasVc6LMJ9UK-jAKO7LU,697
|
|
959
973
|
tests/models/recipe2016Egalitarian/test_damageToHumanHealth.py,sha256=fWjzC9r6itihyW6AdmDkotbhML_0KavXernOpnK1SmY,677
|
|
@@ -1104,8 +1118,8 @@ tests/models/utils/test_source.py,sha256=_Ol-OrJs2Tt9iZAZ_RY2qRuSbnE4yz5OuEGkDSb
|
|
|
1104
1118
|
tests/models/utils/test_term.py,sha256=M5Sa26v2gzQYbZ4H_fo7DspnaCx__-WtL-MULGapCWk,3509
|
|
1105
1119
|
tests/models/webbEtAl2012AndSintermannEtAl2012/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
1106
1120
|
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.
|
|
1121
|
+
hestia_earth_models-0.64.2.dist-info/LICENSE,sha256=AC7h7GAgCZGJK_Tzh6LUCrML9gQEfowWwecEw2w54QM,1154
|
|
1122
|
+
hestia_earth_models-0.64.2.dist-info/METADATA,sha256=62AGAT6inNKY_pNYwL2qKTpk8LFW3wbjLS7DAnLCcag,3343
|
|
1123
|
+
hestia_earth_models-0.64.2.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
|
|
1124
|
+
hestia_earth_models-0.64.2.dist-info/top_level.txt,sha256=1dqA9TqpOLTEgpqa-YBsmbCmmNU1y56AtfFGEceZ2A0,19
|
|
1125
|
+
hestia_earth_models-0.64.2.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
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import pytest
|
|
3
|
+
from unittest.mock import patch
|
|
4
|
+
from tests.utils import fixtures_path, fake_new_emission
|
|
5
|
+
|
|
6
|
+
from hestia_earth.models.ipcc2019.ch4ToAirAquacultureSystems import MODEL, TERM_ID, run, _should_run
|
|
7
|
+
|
|
8
|
+
class_path = f"hestia_earth.models.{MODEL}.{TERM_ID}"
|
|
9
|
+
fixtures_folder = f"{fixtures_path}/{MODEL}/{TERM_ID}"
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@pytest.mark.parametrize(
|
|
13
|
+
'test_name,cycle,expected_should_run',
|
|
14
|
+
[
|
|
15
|
+
(
|
|
16
|
+
'no cycleDuration => no run',
|
|
17
|
+
{},
|
|
18
|
+
False
|
|
19
|
+
),
|
|
20
|
+
(
|
|
21
|
+
'with cycleDuration not relative unit => no run',
|
|
22
|
+
{'cycleDuration': 150, 'functionalUnit': '1 ha'},
|
|
23
|
+
False
|
|
24
|
+
),
|
|
25
|
+
(
|
|
26
|
+
'with cycleDuration, relative unit, no area => no run',
|
|
27
|
+
{'cycleDuration': 150, 'functionalUnit': 'relative'},
|
|
28
|
+
False
|
|
29
|
+
),
|
|
30
|
+
(
|
|
31
|
+
'with cycleDuration, relative unit, with area, no measurement => no run',
|
|
32
|
+
{'cycleDuration': 150, 'functionalUnit': 'relative', 'site': {'area': 1000}},
|
|
33
|
+
False
|
|
34
|
+
),
|
|
35
|
+
(
|
|
36
|
+
'with cycleDuration, relative unit, with area, and measurement => run',
|
|
37
|
+
{
|
|
38
|
+
'cycleDuration': 150,
|
|
39
|
+
'functionalUnit': 'relative',
|
|
40
|
+
'site': {'area': 1000, 'measurements': [{'term': {'@id': 'salineWater'}}]}
|
|
41
|
+
},
|
|
42
|
+
True
|
|
43
|
+
)
|
|
44
|
+
]
|
|
45
|
+
)
|
|
46
|
+
def test_should_run(test_name, cycle, expected_should_run):
|
|
47
|
+
should_run = _should_run(cycle)
|
|
48
|
+
assert should_run == expected_should_run, test_name
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
@patch(f"{class_path}._new_emission", side_effect=fake_new_emission)
|
|
52
|
+
def test_run(*args):
|
|
53
|
+
with open(f"{fixtures_folder}/cycle.jsonld", encoding='utf-8') as f:
|
|
54
|
+
cycle = json.load(f)
|
|
55
|
+
|
|
56
|
+
with open(f"{fixtures_folder}/result.jsonld", encoding='utf-8') as f:
|
|
57
|
+
expected = json.load(f)
|
|
58
|
+
|
|
59
|
+
value = run(cycle)
|
|
60
|
+
assert value == expected
|
|
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
|