hestia-earth-models 0.64.2__py3-none-any.whl → 0.64.4__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/agribalyse2016/machineryInfrastructureDepreciatedAmountPerCycle.py +2 -2
- hestia_earth/models/cycle/animal/input/hestiaAggregatedData.py +5 -2
- hestia_earth/models/cycle/animal/input/properties.py +2 -1
- hestia_earth/models/cycle/animal/milkYield.py +2 -1
- hestia_earth/models/cycle/concentrateFeed.py +8 -8
- hestia_earth/models/cycle/cycleDuration.py +4 -5
- hestia_earth/models/cycle/siteDuration.py +15 -5
- hestia_earth/models/cycle/startDateDefinition.py +3 -4
- hestia_earth/models/cycle/stockingDensityAnimalHousingAverage.py +52 -0
- hestia_earth/models/fantkeEtAl2016/__init__.py +13 -0
- hestia_earth/models/fantkeEtAl2016/damageToHumanHealthParticulateMatterFormation.py +49 -0
- hestia_earth/models/frischknechtEtAl2000/__init__.py +13 -0
- hestia_earth/models/frischknechtEtAl2000/ionisingRadiationKbqU235Eq.py +90 -0
- hestia_earth/models/ipcc2019/aboveGroundBiomass.py +762 -0
- hestia_earth/models/ipcc2019/aboveGroundBiomass_utils.py +180 -0
- hestia_earth/models/ipcc2019/animal/liveweightGain.py +89 -0
- hestia_earth/models/ipcc2019/animal/liveweightPerHead.py +89 -0
- hestia_earth/models/ipcc2019/animal/pastureGrass.py +51 -42
- hestia_earth/models/ipcc2019/animal/utils.py +20 -0
- hestia_earth/models/ipcc2019/animal/weightAtMaturity.py +15 -19
- hestia_earth/models/ipcc2019/ch4ToAirExcreta.py +2 -2
- hestia_earth/models/ipcc2019/organicCarbonPerHa_tier_1_utils.py +37 -50
- hestia_earth/models/ipcc2019/organicCarbonPerHa_utils.py +0 -19
- hestia_earth/models/ipcc2019/pastureGrass.py +44 -31
- hestia_earth/models/ipcc2019/pastureGrass_utils.py +38 -22
- hestia_earth/models/mocking/search-results.json +228 -228
- hestia_earth/models/poschEtAl2008/terrestrialEutrophicationPotentialAccumulatedExceedance.py +40 -0
- hestia_earth/models/site/soilMeasurement.py +2 -2
- hestia_earth/models/utils/blank_node.py +20 -1
- hestia_earth/models/utils/crop.py +4 -0
- hestia_earth/models/utils/ecoClimateZone.py +99 -0
- hestia_earth/models/utils/emission.py +6 -2
- hestia_earth/models/utils/impact_assessment.py +10 -5
- hestia_earth/models/utils/lookup.py +5 -3
- hestia_earth/models/utils/productivity.py +1 -1
- hestia_earth/models/utils/property.py +2 -2
- hestia_earth/models/version.py +1 -1
- {hestia_earth_models-0.64.2.dist-info → hestia_earth_models-0.64.4.dist-info}/METADATA +1 -1
- {hestia_earth_models-0.64.2.dist-info → hestia_earth_models-0.64.4.dist-info}/RECORD +57 -35
- tests/models/cycle/test_siteDuration.py +22 -0
- tests/models/cycle/test_stockingDensityAnimalHousingAverage.py +42 -0
- tests/models/fantkeEtAl2016/__init__.py +0 -0
- tests/models/fantkeEtAl2016/test_damageToHumanHealthParticulateMatterFormation.py +20 -0
- tests/models/frischknechtEtAl2000/__init__.py +0 -0
- tests/models/frischknechtEtAl2000/test_ionisingRadiationKbqU235Eq.py +70 -0
- tests/models/ipcc2019/animal/test_liveweightGain.py +20 -0
- tests/models/ipcc2019/animal/test_liveweightPerHead.py +20 -0
- tests/models/ipcc2019/animal/test_pastureGrass.py +1 -1
- tests/models/ipcc2019/test_aboveGroundBiomass.py +182 -0
- tests/models/ipcc2019/test_aboveGroundBiomass_utils.py +92 -0
- tests/models/ipcc2019/test_organicCarbonPerHa_tier_1_utils.py +3 -2
- tests/models/ipcc2019/test_pastureGrass.py +2 -2
- tests/models/poschEtAl2008/test_terrestrialEutrophicationPotentialAccumulatedExceedance.py +44 -0
- tests/models/utils/test_ecoClimateZone.py +152 -0
- {hestia_earth_models-0.64.2.dist-info → hestia_earth_models-0.64.4.dist-info}/LICENSE +0 -0
- {hestia_earth_models-0.64.2.dist-info → hestia_earth_models-0.64.4.dist-info}/WHEEL +0 -0
- {hestia_earth_models-0.64.2.dist-info → hestia_earth_models-0.64.4.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
from pytest import mark
|
|
2
|
+
from typing import Any
|
|
3
|
+
from unittest.mock import MagicMock, patch
|
|
4
|
+
|
|
5
|
+
from hestia_earth.models.utils.ecoClimateZone import (
|
|
6
|
+
_eco_climate_zone_node_value_to_enum, EcoClimateZone, get_eco_climate_zone_value,
|
|
7
|
+
get_ecoClimateZone_lookup_grouped_value
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
class_path = "hestia_earth.models.utils.ecoClimateZone"
|
|
11
|
+
|
|
12
|
+
# value, expected
|
|
13
|
+
PARAMS_TO_ENUM = [
|
|
14
|
+
(0, None),
|
|
15
|
+
(1, EcoClimateZone.WARM_TEMPERATE_MOIST),
|
|
16
|
+
(2, EcoClimateZone.WARM_TEMPERATE_DRY),
|
|
17
|
+
(3, EcoClimateZone.COOL_TEMPERATE_MOIST),
|
|
18
|
+
(4, EcoClimateZone.COOL_TEMPERATE_DRY),
|
|
19
|
+
(5, EcoClimateZone.POLAR_MOIST),
|
|
20
|
+
(6, EcoClimateZone.POLAR_DRY),
|
|
21
|
+
(7, EcoClimateZone.BOREAL_MOIST),
|
|
22
|
+
(8, EcoClimateZone.BOREAL_DRY),
|
|
23
|
+
(9, EcoClimateZone.TROPICAL_MONTANE),
|
|
24
|
+
(10, EcoClimateZone.TROPICAL_WET),
|
|
25
|
+
(11, EcoClimateZone.TROPICAL_MOIST),
|
|
26
|
+
(12, EcoClimateZone.TROPICAL_DRY),
|
|
27
|
+
(13, None),
|
|
28
|
+
("string", None),
|
|
29
|
+
(None, None)
|
|
30
|
+
]
|
|
31
|
+
IDS_TO_ENUM = [str(input_) for input_, _ in PARAMS_TO_ENUM]
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
@mark.parametrize("value, expected", PARAMS_TO_ENUM, ids=IDS_TO_ENUM)
|
|
35
|
+
def test_eco_climate_zone_node_value_to_enum(value, expected):
|
|
36
|
+
assert _eco_climate_zone_node_value_to_enum(value) == expected
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
# node, as_enum, expected
|
|
40
|
+
PARAMS_GET_ECZ_VALUE = [
|
|
41
|
+
(
|
|
42
|
+
{
|
|
43
|
+
"@type": "Site",
|
|
44
|
+
"measurements": [
|
|
45
|
+
{
|
|
46
|
+
"@type": "Measurement",
|
|
47
|
+
"term": {
|
|
48
|
+
"@type": "Term",
|
|
49
|
+
"@id": "ecoClimateZone"
|
|
50
|
+
},
|
|
51
|
+
"value": [2],
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
False,
|
|
56
|
+
2
|
|
57
|
+
),
|
|
58
|
+
(
|
|
59
|
+
{
|
|
60
|
+
"@type": "Site",
|
|
61
|
+
"measurements": [
|
|
62
|
+
{
|
|
63
|
+
"@type": "Measurement",
|
|
64
|
+
"term": {
|
|
65
|
+
"@type": "Term",
|
|
66
|
+
"@id": "ecoClimateZone"
|
|
67
|
+
},
|
|
68
|
+
"value": [2],
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
},
|
|
72
|
+
True,
|
|
73
|
+
EcoClimateZone.WARM_TEMPERATE_DRY
|
|
74
|
+
),
|
|
75
|
+
(
|
|
76
|
+
{
|
|
77
|
+
"@type": "Cycle",
|
|
78
|
+
"site": {
|
|
79
|
+
"@type": "Site",
|
|
80
|
+
"measurements": [
|
|
81
|
+
{
|
|
82
|
+
"@type": "Measurement",
|
|
83
|
+
"term": {
|
|
84
|
+
"@type": "Term",
|
|
85
|
+
"@id": "ecoClimateZone"
|
|
86
|
+
},
|
|
87
|
+
"value": [2],
|
|
88
|
+
}
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
False,
|
|
93
|
+
2
|
|
94
|
+
),
|
|
95
|
+
(
|
|
96
|
+
{
|
|
97
|
+
"@type": "Cycle",
|
|
98
|
+
"site": {
|
|
99
|
+
"@type": "Site",
|
|
100
|
+
"measurements": [
|
|
101
|
+
{
|
|
102
|
+
"@type": "Measurement",
|
|
103
|
+
"term": {
|
|
104
|
+
"@type": "Term",
|
|
105
|
+
"@id": "ecoClimateZone"
|
|
106
|
+
},
|
|
107
|
+
"value": [2],
|
|
108
|
+
}
|
|
109
|
+
]
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
True,
|
|
113
|
+
EcoClimateZone.WARM_TEMPERATE_DRY
|
|
114
|
+
),
|
|
115
|
+
({}, False, None),
|
|
116
|
+
({}, True, None),
|
|
117
|
+
]
|
|
118
|
+
IDS_GET_ECZ_VALUE = [
|
|
119
|
+
"site", "site as enum",
|
|
120
|
+
"cycle", "cycle as enum",
|
|
121
|
+
"other", "other as enum"
|
|
122
|
+
]
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
@mark.parametrize("node, as_enum, expected", PARAMS_GET_ECZ_VALUE, ids=IDS_GET_ECZ_VALUE)
|
|
126
|
+
def test_get_eco_climate_zone_value(node, as_enum, expected):
|
|
127
|
+
assert get_eco_climate_zone_value(node, as_enum=as_enum) == expected
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
# lookup_return_value, expected
|
|
131
|
+
PARAMS_LOOKUP_GROUPED = [
|
|
132
|
+
("1", None),
|
|
133
|
+
("-", None),
|
|
134
|
+
("", None),
|
|
135
|
+
("value:1", {"value": 1}),
|
|
136
|
+
("value:-1", {"value": -1}),
|
|
137
|
+
("value:1;sd:0.5", {"value": 1, "sd": 0.5})
|
|
138
|
+
]
|
|
139
|
+
IDS_LOOKUP_GROUPED = [p[0] for p in PARAMS_LOOKUP_GROUPED]
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
@mark.parametrize("lookup_return_value, expected", PARAMS_LOOKUP_GROUPED, ids=IDS_LOOKUP_GROUPED)
|
|
143
|
+
@patch(f"{class_path}.download_lookup", return_value=None)
|
|
144
|
+
@patch(f"{class_path}._get_single_table_value")
|
|
145
|
+
def test_get_ecoClimateZone_lookup_grouped_value(
|
|
146
|
+
get_single_table_value_mock: MagicMock,
|
|
147
|
+
_download_lookup_mock: MagicMock,
|
|
148
|
+
lookup_return_value: str,
|
|
149
|
+
expected: Any
|
|
150
|
+
):
|
|
151
|
+
get_single_table_value_mock.return_value = lookup_return_value
|
|
152
|
+
assert get_ecoClimateZone_lookup_grouped_value(1, "TEST") == expected
|
|
File without changes
|
|
File without changes
|
|
File without changes
|