hestia-earth-models 0.65.10__py3-none-any.whl → 0.65.11__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- hestia_earth/models/hestia/landCover.py +15 -5
- hestia_earth/models/hestia/resourceUse_utils.py +24 -12
- hestia_earth/models/hestia/utils.py +1 -2
- hestia_earth/models/ipcc2019/animal/pastureGrass.py +1 -1
- hestia_earth/models/ipcc2019/pastureGrass.py +1 -1
- hestia_earth/models/mocking/search-results.json +5 -5
- hestia_earth/models/pooreNemecek2018/freshwaterWithdrawalsDuringCycle.py +0 -1
- hestia_earth/models/pooreNemecek2018/landOccupationDuringCycle.py +13 -10
- hestia_earth/models/site/management.py +1 -1
- hestia_earth/models/utils/blank_node.py +1 -1
- hestia_earth/models/utils/crop.py +1 -1
- hestia_earth/models/utils/cycle.py +3 -3
- hestia_earth/models/version.py +1 -1
- {hestia_earth_models-0.65.10.dist-info → hestia_earth_models-0.65.11.dist-info}/METADATA +1 -1
- {hestia_earth_models-0.65.10.dist-info → hestia_earth_models-0.65.11.dist-info}/RECORD +22 -22
- tests/models/hestia/test_landCover.py +2 -1
- tests/models/hestia/test_landTransformation20YearAverageDuringCycle.py +2 -1
- tests/models/pooreNemecek2018/test_landOccupationDuringCycle.py +1 -3
- tests/models/utils/test_crop.py +14 -2
- {hestia_earth_models-0.65.10.dist-info → hestia_earth_models-0.65.11.dist-info}/LICENSE +0 -0
- {hestia_earth_models-0.65.10.dist-info → hestia_earth_models-0.65.11.dist-info}/WHEEL +0 -0
- {hestia_earth_models-0.65.10.dist-info → hestia_earth_models-0.65.11.dist-info}/top_level.txt +0 -0
@@ -82,7 +82,8 @@ LOOKUPS = {
|
|
82
82
|
"Permanent meadows and pastures"
|
83
83
|
],
|
84
84
|
"crop": ["cropGroupingFaostatArea", "IPCC_LAND_USE_CATEGORY"],
|
85
|
-
"landCover": ["cropGroupingFaostatProduction", "FAOSTAT_LAND_AREA_CATEGORY"]
|
85
|
+
"landCover": ["cropGroupingFaostatProduction", "FAOSTAT_LAND_AREA_CATEGORY"],
|
86
|
+
"property": "CALCULATE_TOTAL_LAND_COVER_SHARE_SEPARATELY"
|
86
87
|
}
|
87
88
|
MODEL_KEY = 'landCover'
|
88
89
|
|
@@ -120,6 +121,13 @@ def site_area_sum_to_100(dict_of_percentages: dict):
|
|
120
121
|
math.isclose(sum(dict_of_percentages.values()), 0.0, rel_tol=0.01))
|
121
122
|
|
122
123
|
|
124
|
+
def _should_group_landCover(term: dict):
|
125
|
+
return any(
|
126
|
+
bool(get_lookup_value(lookup_term=prop.get("term", {}), column="CALCULATE_TOTAL_LAND_COVER_SHARE_SEPARATELY"))
|
127
|
+
for prop in term.get("properties", [])
|
128
|
+
)
|
129
|
+
|
130
|
+
|
123
131
|
def get_changes(country_id: str, end_year: int) -> dict:
|
124
132
|
"""
|
125
133
|
For each entry in ALL_LAND_USE_TERMS, creates a key: value in output dictionary, also TOTAL
|
@@ -714,8 +722,7 @@ def _no_prior_land_cover_data(nodes: list, end_date: str) -> bool:
|
|
714
722
|
return len(previous_nodes) == 0
|
715
723
|
|
716
724
|
|
717
|
-
def _should_run(site: dict) -> tuple[bool, dict]:
|
718
|
-
management_nodes = filter_list_term_type(site.get("management", []), TermTermType.LANDCOVER)
|
725
|
+
def _should_run(site: dict, management_nodes: list) -> tuple[bool, dict]:
|
719
726
|
summarised_nodes = _collect_land_use_types(management_nodes)
|
720
727
|
allowed_land_use_types = [ANNUAL_CROPLAND, PERMANENT_CROPLAND, PERMANENT_PASTURE]
|
721
728
|
relevant_nodes = sorted(
|
@@ -751,8 +758,11 @@ def _should_run(site: dict) -> tuple[bool, dict]:
|
|
751
758
|
|
752
759
|
|
753
760
|
def run(site: dict) -> list:
|
754
|
-
|
755
|
-
|
761
|
+
management_nodes = [
|
762
|
+
node for node in filter_list_term_type(site.get("management", []), TermTermType.LANDCOVER)
|
763
|
+
if not _should_group_landCover(node)
|
764
|
+
]
|
765
|
+
should_run, site_area = _should_run(site=site, management_nodes=management_nodes)
|
756
766
|
return _run_make_management_nodes(
|
757
767
|
existing_nodes=management_nodes,
|
758
768
|
percentage_transformed_from=site_area,
|
@@ -8,7 +8,7 @@ from dateutil.relativedelta import relativedelta
|
|
8
8
|
from hestia_earth.schema import TermTermType
|
9
9
|
from hestia_earth.utils.tools import to_precision
|
10
10
|
|
11
|
-
from hestia_earth.models.log import logRequirements, logShouldRun
|
11
|
+
from hestia_earth.models.log import logRequirements, logShouldRun, debugValues
|
12
12
|
from hestia_earth.models.utils.blank_node import _gapfill_datestr, DatestrGapfillMode, DatestrFormat, _str_dates_match
|
13
13
|
from hestia_earth.models.utils.impact_assessment import get_site
|
14
14
|
from hestia_earth.models.utils.indicator import _new_indicator
|
@@ -78,11 +78,15 @@ def should_run(
|
|
78
78
|
node for node in impact_assessment.get("emissionsResourceUse", [])
|
79
79
|
if node.get("term", {}).get("@id", "") == _RESOURCE_USE_TERM_ID and node.get("value", -1) >= 0
|
80
80
|
]
|
81
|
-
|
82
81
|
filtered_management_nodes = [
|
83
82
|
node for node in site.get("management", [])
|
84
83
|
if node.get("value", -1) >= 0 and node.get("term", {}).get("termType", "") == TermTermType.LANDCOVER.value
|
85
84
|
]
|
85
|
+
land_occupation_during_cycle_found = any(
|
86
|
+
node.get("term", {}).get("@id") in
|
87
|
+
{node.get("landCover", {}).get("@id") for node in relevant_emission_resource_use}
|
88
|
+
for node in filtered_management_nodes
|
89
|
+
)
|
86
90
|
current_node_index = next(
|
87
91
|
(i for i, node in enumerate(filtered_management_nodes)
|
88
92
|
if _str_dates_match(node.get("endDate", ""), impact_assessment.get("endDate", ""))),
|
@@ -96,19 +100,18 @@ def should_run(
|
|
96
100
|
historic_date_offset=historic_date_offset
|
97
101
|
)
|
98
102
|
|
99
|
-
logRequirements(
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
site=site
|
104
|
-
)
|
103
|
+
logRequirements(impact_assessment, model=MODEL, term=term_id,
|
104
|
+
closest_date=closest_date_str,
|
105
|
+
land_occupation_during_cycle_found=land_occupation_during_cycle_found,
|
106
|
+
land_cover_term_id=(current_node or {}).get('term', {}).get('@id'))
|
105
107
|
|
106
108
|
should_run_result = all([
|
107
|
-
relevant_emission_resource_use
|
109
|
+
relevant_emission_resource_use,
|
110
|
+
land_occupation_during_cycle_found,
|
108
111
|
current_node,
|
109
112
|
close_date_found
|
110
113
|
])
|
111
|
-
logShouldRun(
|
114
|
+
logShouldRun(impact_assessment, MODEL, term=term_id, should_run=should_run_result)
|
112
115
|
|
113
116
|
return should_run_result, current_node, closest_date_str
|
114
117
|
|
@@ -126,6 +129,7 @@ def _get_land_occupation_for_land_use_type(impact_assessment: dict, ipcc_land_us
|
|
126
129
|
|
127
130
|
def _calculate_indicator_value(
|
128
131
|
impact_assessment: dict,
|
132
|
+
term_id: str,
|
129
133
|
management_nodes: list,
|
130
134
|
ipcc_land_use_category: str,
|
131
135
|
previous_land_cover_id: str,
|
@@ -143,6 +147,13 @@ def _calculate_indicator_value(
|
|
143
147
|
node.get("value", 0) for node in management_nodes
|
144
148
|
if node.get("term", {}).get("@id", "") == previous_land_cover_id
|
145
149
|
)
|
150
|
+
|
151
|
+
debugValues(impact_assessment, model=MODEL, term=term_id,
|
152
|
+
ipcc_land_use_category=ipcc_land_use_category,
|
153
|
+
land_occupation_for_cycle=land_occupation_for_cycle,
|
154
|
+
historical_land_use=historical_land_use,
|
155
|
+
historic_date_offset=historic_date_offset)
|
156
|
+
|
146
157
|
return ((land_occupation_for_cycle * historical_land_use) / 100) / historic_date_offset
|
147
158
|
|
148
159
|
|
@@ -164,6 +175,7 @@ def _run_calculate_transformation(
|
|
164
175
|
previous_land_cover_id=previous_land_cover_id,
|
165
176
|
value=_calculate_indicator_value(
|
166
177
|
impact_assessment=impact_assessment,
|
178
|
+
term_id=term_id,
|
167
179
|
management_nodes=[
|
168
180
|
node for node in site.get("management", [])
|
169
181
|
if _str_dates_match(node.get("endDate", ""), closest_date_str)
|
@@ -191,10 +203,10 @@ def run_resource_use(
|
|
191
203
|
historic_date_offset=historic_date_offset
|
192
204
|
)
|
193
205
|
return _run_calculate_transformation(
|
206
|
+
impact_assessment=impact_assessment,
|
207
|
+
site=site,
|
194
208
|
term_id=term_id,
|
195
209
|
current_node=current_node,
|
196
210
|
closest_date_str=closest_date_str,
|
197
|
-
site=site,
|
198
|
-
impact_assessment=impact_assessment,
|
199
211
|
historic_date_offset=historic_date_offset
|
200
212
|
) if _should_run else []
|
@@ -43,6 +43,5 @@ def crop_ipcc_land_use_category(
|
|
43
43
|
return get_lookup_value(
|
44
44
|
lookup_term={"@id": crop_term_id, "type": "Term", "termType": lookup_term_type},
|
45
45
|
column='IPCC_LAND_USE_CATEGORY',
|
46
|
-
model=MODEL
|
47
|
-
term={"@id": crop_term_id, "type": "Term", "termType": lookup_term_type}
|
46
|
+
model=MODEL
|
48
47
|
)
|
@@ -233,7 +233,7 @@ def _run_practice(animal: dict, values: dict, meanDE: float, meanECHHV: float, R
|
|
233
233
|
'weightAtOneYear',
|
234
234
|
'weightAtSlaughter'
|
235
235
|
])
|
236
|
-
has_positive_feed_values = all([NEm_feed
|
236
|
+
has_positive_feed_values = all([NEm_feed >= 0, NEg_feed >= 0])
|
237
237
|
|
238
238
|
logRequirements(animal, model=MODEL, term=input_term_id, model_key=MODEL_KEY,
|
239
239
|
feed_logs=log_as_table(log_feed),
|
@@ -212,7 +212,7 @@ def _run_practice(cycle: dict, meanDE: float, meanECHHV: float, REM: float, REG:
|
|
212
212
|
'weightAtOneYear',
|
213
213
|
'weightAtSlaughter'
|
214
214
|
])
|
215
|
-
has_positive_feed_values = all([NEm_feed
|
215
|
+
has_positive_feed_values = all([NEm_feed >= 0, NEg_feed >= 0])
|
216
216
|
|
217
217
|
logRequirements(cycle, model=MODEL, term=input_term_id, model_key=MODEL_KEY,
|
218
218
|
feed_logs=log_as_table(log_feed),
|
@@ -2022,13 +2022,13 @@
|
|
2022
2022
|
"@type": "Term",
|
2023
2023
|
"name": "Other natural vegetation",
|
2024
2024
|
"@id": "otherNaturalVegetation",
|
2025
|
-
"_score": 43.
|
2025
|
+
"_score": 43.053535
|
2026
2026
|
},
|
2027
2027
|
{
|
2028
2028
|
"@type": "Term",
|
2029
2029
|
"name": "Agri-food processor",
|
2030
2030
|
"@id": "agriFoodProcessor",
|
2031
|
-
"_score": 42.
|
2031
|
+
"_score": 42.061752
|
2032
2032
|
},
|
2033
2033
|
{
|
2034
2034
|
"@type": "Term",
|
@@ -2046,7 +2046,7 @@
|
|
2046
2046
|
"@type": "Term",
|
2047
2047
|
"name": "Permanent pasture",
|
2048
2048
|
"@id": "permanentPasture",
|
2049
|
-
"_score": 28.
|
2049
|
+
"_score": 28.696854
|
2050
2050
|
},
|
2051
2051
|
{
|
2052
2052
|
"@type": "Term",
|
@@ -2070,7 +2070,7 @@
|
|
2070
2070
|
"@type": "Term",
|
2071
2071
|
"name": "Forest",
|
2072
2072
|
"@id": "forest",
|
2073
|
-
"_score": 20.
|
2073
|
+
"_score": 20.619322
|
2074
2074
|
},
|
2075
2075
|
{
|
2076
2076
|
"@type": "Term",
|
@@ -2082,7 +2082,7 @@
|
|
2082
2082
|
"@type": "Term",
|
2083
2083
|
"name": "Other land",
|
2084
2084
|
"@id": "otherLand",
|
2085
|
-
"_score": 19.
|
2085
|
+
"_score": 19.758368
|
2086
2086
|
},
|
2087
2087
|
{
|
2088
2088
|
"@type": "Term",
|
@@ -2,7 +2,8 @@ from hestia_earth.models.log import logRequirements, logShouldRun
|
|
2
2
|
from hestia_earth.models.utils.indicator import _new_indicator
|
3
3
|
from hestia_earth.models.utils.impact_assessment import get_product, get_site
|
4
4
|
from hestia_earth.models.utils.cycle import land_occupation_per_kg
|
5
|
-
from hestia_earth.models.utils.site import get_land_cover_term_id
|
5
|
+
from hestia_earth.models.utils.site import get_land_cover_term_id as get_landCover_term_id_from_site_type
|
6
|
+
from hestia_earth.models.utils.crop import get_landCover_term_id
|
6
7
|
from . import MODEL
|
7
8
|
|
8
9
|
REQUIREMENTS = {
|
@@ -16,7 +17,6 @@ REQUIREMENTS = {
|
|
16
17
|
"cycleDuration": "",
|
17
18
|
"products": [{
|
18
19
|
"@type": "Product",
|
19
|
-
"primary": "True",
|
20
20
|
"value": "> 0",
|
21
21
|
"economicValueShare": "> 0"
|
22
22
|
}],
|
@@ -46,8 +46,8 @@ RETURNS = {
|
|
46
46
|
TERM_ID = 'landOccupationDuringCycle'
|
47
47
|
|
48
48
|
|
49
|
-
def _indicator(term_id: str, value: float,
|
50
|
-
indicator = _new_indicator(term_id, MODEL,
|
49
|
+
def _indicator(term_id: str, value: float, land_cover_term_id: str):
|
50
|
+
indicator = _new_indicator(term_id, MODEL, land_cover_term_id)
|
51
51
|
indicator['value'] = value
|
52
52
|
return indicator
|
53
53
|
|
@@ -56,18 +56,21 @@ def _should_run(impact_assessment: dict):
|
|
56
56
|
product = get_product(impact_assessment)
|
57
57
|
cycle = impact_assessment.get('cycle', {})
|
58
58
|
site = get_site(impact_assessment)
|
59
|
-
|
59
|
+
land_cover_from_product = get_landCover_term_id(product.get('term', {}))
|
60
|
+
land_cover_from_site = get_landCover_term_id_from_site_type(site.get('siteType'))
|
61
|
+
land_cover_term_id = land_cover_from_product or land_cover_from_site
|
60
62
|
land_occupation_m2_kg = land_occupation_per_kg(MODEL, TERM_ID, cycle, site, product)
|
61
63
|
|
62
64
|
logRequirements(impact_assessment, model=MODEL, term=TERM_ID,
|
63
65
|
land_occupation_kg=land_occupation_m2_kg,
|
64
|
-
|
66
|
+
land_cover_from_product=land_cover_from_product,
|
67
|
+
land_cover_from_site=land_cover_from_site)
|
65
68
|
|
66
|
-
should_run = all([
|
69
|
+
should_run = all([land_cover_term_id, land_occupation_m2_kg is not None])
|
67
70
|
logShouldRun(impact_assessment, MODEL, TERM_ID, should_run)
|
68
|
-
return should_run, land_occupation_m2_kg,
|
71
|
+
return should_run, land_occupation_m2_kg, land_cover_term_id
|
69
72
|
|
70
73
|
|
71
74
|
def run(impact_assessment: dict):
|
72
|
-
should_run, land_occupation_kg,
|
73
|
-
return [_indicator(TERM_ID, land_occupation_kg,
|
75
|
+
should_run, land_occupation_kg, land_cover_term_id = _should_run(impact_assessment)
|
76
|
+
return [_indicator(TERM_ID, land_occupation_kg, land_cover_term_id)] if should_run else []
|
@@ -31,11 +31,11 @@ from hestia_earth.models.utils import _include, _omit, group_by
|
|
31
31
|
from hestia_earth.models.utils.management import _new_management
|
32
32
|
from hestia_earth.models.utils.term import get_lookup_value
|
33
33
|
from hestia_earth.models.utils.blank_node import condense_nodes, DatestrFormat, _gapfill_datestr, DatestrGapfillMode
|
34
|
+
from hestia_earth.models.utils.crop import get_landCover_term_id
|
34
35
|
from hestia_earth.models.utils.site import (
|
35
36
|
related_cycles, get_land_cover_term_id as get_landCover_term_id_from_site_type
|
36
37
|
)
|
37
38
|
from . import MODEL
|
38
|
-
from ..utils.crop import get_landCover_term_id
|
39
39
|
|
40
40
|
REQUIREMENTS = {
|
41
41
|
"Site": {
|
@@ -73,7 +73,7 @@ def lookups_logs(model: str, blank_nodes: list, lookups_per_termType: dict, **lo
|
|
73
73
|
|
74
74
|
def _reduce_lookups_logs(logs: dict, column: str):
|
75
75
|
lookup_value = get_lookup_value(term, column, model=model, **log_args)
|
76
|
-
return logs | {column: lookup_value}
|
76
|
+
return logs | {column: str(lookup_value).replace(':', '-')}
|
77
77
|
|
78
78
|
return reduce(_reduce_lookups_logs, lookups, {'id': term_id})
|
79
79
|
|
@@ -67,6 +67,6 @@ def get_landCover_term_id(lookup_term: dict, **log_args) -> str:
|
|
67
67
|
value = get_lookup_value(lookup_term, 'landCoverTermId', **log_args)
|
68
68
|
return (
|
69
69
|
lookup_term.get("@id") if lookup_term.get("termType") == TermTermType.LANDCOVER.value else
|
70
|
-
value.split(';')[0] if value else
|
70
|
+
value.split(';')[0] if isinstance(value, str) else
|
71
71
|
None
|
72
72
|
)
|
@@ -291,7 +291,7 @@ def _land_occupation_per_kg(model: str, term_id: str, cycle: dict, product: dict
|
|
291
291
|
return value
|
292
292
|
|
293
293
|
|
294
|
-
def land_occupation_per_kg(model: str, term_id: str, cycle: dict, site: dict,
|
294
|
+
def land_occupation_per_kg(model: str, term_id: str, cycle: dict, site: dict, product: dict):
|
295
295
|
"""
|
296
296
|
Get the land occupation of the cycle per kg in meter square.
|
297
297
|
|
@@ -305,7 +305,7 @@ def land_occupation_per_kg(model: str, term_id: str, cycle: dict, site: dict, pr
|
|
305
305
|
The `Cycle` as defined in the HESTIA Schema.
|
306
306
|
site : dict
|
307
307
|
The `Site` as defined in the HESTIA Schema.
|
308
|
-
|
308
|
+
product : dict
|
309
309
|
The primary `Product` of the `Cycle`.
|
310
310
|
|
311
311
|
Returns
|
@@ -325,7 +325,7 @@ def land_occupation_per_kg(model: str, term_id: str, cycle: dict, site: dict, pr
|
|
325
325
|
SiteSiteType.RIVER_OR_STREAM.value,
|
326
326
|
SiteSiteType.SEA_OR_OCEAN.value
|
327
327
|
] else (
|
328
|
-
_land_occupation_per_kg(model, term_id, cycle,
|
328
|
+
_land_occupation_per_kg(model, term_id, cycle, product, value) if value is not None else None
|
329
329
|
)
|
330
330
|
|
331
331
|
|
hestia_earth/models/version.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
VERSION = '0.65.
|
1
|
+
VERSION = '0.65.11'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: hestia-earth-models
|
3
|
-
Version: 0.65.
|
3
|
+
Version: 0.65.11
|
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
|
@@ -4,7 +4,7 @@ hestia_earth/models/cache_sites.py,sha256=Llo2SH1Lp-R8x1JRxJ2Ta-vw5RbdUj2FHXUP-c
|
|
4
4
|
hestia_earth/models/log.py,sha256=_zAfyOkL_VknEnMFvcpvenSMghadlDfZhiSx28545Gk,3558
|
5
5
|
hestia_earth/models/preload_requests.py,sha256=vK_G1UzhNMhYy7ymnCtHUz_vv3cfApCSKqv29VREEBQ,1943
|
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=6LpNoOHn7BXGQSdeOERwYSNo64BVnj0d53V5FW5wWHY,20
|
8
8
|
hestia_earth/models/agribalyse2016/__init__.py,sha256=WvK0qCQbnYtg9oZxrACd1wGormZyXibPtpCnIQeDqbw,415
|
9
9
|
hestia_earth/models/agribalyse2016/fuelElectricity.py,sha256=rm5ZaRAzJ08m2y4BxkGh-RjudkDWgozmg3XumoRm-fQ,4511
|
10
10
|
hestia_earth/models/agribalyse2016/machineryInfrastructureDepreciatedAmountPerCycle.py,sha256=BPjnWmg73i_OxM2ouCdMTWZtPIqyoUAXrvutntyteE0,3390
|
@@ -206,12 +206,12 @@ hestia_earth/models/haversineFormula/__init__.py,sha256=o155nR-XI67iCSBVNYIu4sPR
|
|
206
206
|
hestia_earth/models/haversineFormula/transport/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
207
207
|
hestia_earth/models/haversineFormula/transport/distance.py,sha256=163KrmKzlEQuKYT1ZvpPgmKlv_-mmvxp0A1_uKya99w,4203
|
208
208
|
hestia_earth/models/hestia/__init__.py,sha256=o5vAmPzSaK9XPgL8GCne3-lugfCOgZhHELYolNgqyyY,407
|
209
|
-
hestia_earth/models/hestia/landCover.py,sha256=
|
209
|
+
hestia_earth/models/hestia/landCover.py,sha256=P1kKasnLwmwHyxCMNKxaVEDPdcSBfOuicG-94kLnBro,29846
|
210
210
|
hestia_earth/models/hestia/landTransformation100YearAverageDuringCycle.py,sha256=-7ToRvCVPD6AAcjxorPS5jSWio7JAglHrdSS9PPyPqQ,1551
|
211
211
|
hestia_earth/models/hestia/landTransformation20YearAverageDuringCycle.py,sha256=TCskVLhYXBMxdeZM-gN4Tdixk5ua7eVn-o5dfIT_H7o,1543
|
212
|
-
hestia_earth/models/hestia/resourceUse_utils.py,sha256=
|
212
|
+
hestia_earth/models/hestia/resourceUse_utils.py,sha256=b-0g_xArf_4Ln7JCqaSdCk7nXonAHYo_mLzmJnGLlhQ,7939
|
213
213
|
hestia_earth/models/hestia/seed_emissions.py,sha256=58hmHAgemOuGVIsij-FWF7EsGmEbCSfzFAEfXkXSyEE,11566
|
214
|
-
hestia_earth/models/hestia/utils.py,sha256=
|
214
|
+
hestia_earth/models/hestia/utils.py,sha256=TX53XPLeu3XgBcy9XN8xDD3J7y7fjmVweRNKaEZ-qzE,1455
|
215
215
|
hestia_earth/models/impact_assessment/__init__.py,sha256=gTR_PhWps593fPhm-V826VLLrZVH8CNQTqxExB7GGNI,418
|
216
216
|
hestia_earth/models/impact_assessment/allocationMethod.py,sha256=Qz41nTtMpDCcPy7PjhVtafE13dfJLX_D3Rg3yNhdY_Q,1279
|
217
217
|
hestia_earth/models/impact_assessment/emissions.py,sha256=oHWXFZgvxYktH6gAawEjphyLtPCmH0FWt_mDwphc2I8,4394
|
@@ -285,7 +285,7 @@ hestia_earth/models/ipcc2019/organicCarbonPerHa.py,sha256=C9ef41fd-gYixEV3sTs9VM
|
|
285
285
|
hestia_earth/models/ipcc2019/organicCarbonPerHa_tier_1_utils.py,sha256=hgMh3p7tflTo06LJjAkoz8btrl8Rc6lYYvZp1ooJIaI,76214
|
286
286
|
hestia_earth/models/ipcc2019/organicCarbonPerHa_tier_2_utils.py,sha256=e2O4yZ9bCJWMPQ8s-DEwnaDImGGCnpJya6SO0tWy0RY,63367
|
287
287
|
hestia_earth/models/ipcc2019/organicCarbonPerHa_utils.py,sha256=FFcjdkYq5NJwAu4bWZJUao4MoDHvgbXmXCnUNKD-a3w,9842
|
288
|
-
hestia_earth/models/ipcc2019/pastureGrass.py,sha256=
|
288
|
+
hestia_earth/models/ipcc2019/pastureGrass.py,sha256=HWRkpYpGqvMfol2dPb9pFkNzoGj7n6sRpyIjGSVM9lQ,10306
|
289
289
|
hestia_earth/models/ipcc2019/pastureGrass_utils.py,sha256=nL31uS3c77PH_5nA2E2MvB1NS2mMvhD341taGl5YWNE,13842
|
290
290
|
hestia_earth/models/ipcc2019/utils.py,sha256=MSDMu15D9DnilFUgi4_6jYXC0FaKso3OODauGTMB6hs,6229
|
291
291
|
hestia_earth/models/ipcc2019/animal/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -294,7 +294,7 @@ hestia_earth/models/ipcc2019/animal/hoursWorkedPerDay.py,sha256=f-zcslXkbIY9ef-p
|
|
294
294
|
hestia_earth/models/ipcc2019/animal/liveweightGain.py,sha256=UElmAdB4yQEFAOT5RrURn0Yt7U3gB2qiCWvNXyLk8Hw,971
|
295
295
|
hestia_earth/models/ipcc2019/animal/liveweightPerHead.py,sha256=cq88VTxPYVPyEr2NLPb0Zmmppn_eMp9Xtw6Nxnta4-M,984
|
296
296
|
hestia_earth/models/ipcc2019/animal/milkYieldPerAnimal.py,sha256=XxgSvQLi1Xu6ZpUg1a-7OFZEkItkUK-nVPTDxApUnuY,2777
|
297
|
-
hestia_earth/models/ipcc2019/animal/pastureGrass.py,sha256=
|
297
|
+
hestia_earth/models/ipcc2019/animal/pastureGrass.py,sha256=M-6SigPr3Yfw-Iq1hVyh38tuh6_J5GR5rfGbjDqEPgU,12214
|
298
298
|
hestia_earth/models/ipcc2019/animal/pregnancyRateTotal.py,sha256=MWPnuT4WeKJCGjJ_DAJnYelsX2Ld0C5e8eN__0Ws0E0,982
|
299
299
|
hestia_earth/models/ipcc2019/animal/trueProteinContent.py,sha256=9hOg5KAFQ6Q-2_5h8pduYiYg9QBr22UnHdJYmkh8qi0,1023
|
300
300
|
hestia_earth/models/ipcc2019/animal/utils.py,sha256=HPOjdJGUxn4Ls4jnr0kD5_w-JrzG1C7_cwdMpCCA1kk,4514
|
@@ -406,15 +406,15 @@ hestia_earth/models/linkedImpactAssessment/utils.py,sha256=S1zlux02gU2Lajrtoq-zQ
|
|
406
406
|
hestia_earth/models/mocking/__init__.py,sha256=9VX50c-grz-snfd-7MBS0KfF7AadtbKuj7kK6PqtsgE,687
|
407
407
|
hestia_earth/models/mocking/build_mock_search.py,sha256=p15ccEUmkmLp1RiGNznxMz3OFHbI8P1-29ExuohiQN8,1355
|
408
408
|
hestia_earth/models/mocking/mock_search.py,sha256=ccFe_WrI73JElFmxp4hPNLCX7eeU--lBC1JFR901KJY,1069
|
409
|
-
hestia_earth/models/mocking/search-results.json,sha256=
|
409
|
+
hestia_earth/models/mocking/search-results.json,sha256=EFCT8ggjUM49bin_Hxq6de9Ceu1BTx0JdQ_LHGVLC8M,102057
|
410
410
|
hestia_earth/models/pooreNemecek2018/__init__.py,sha256=nPboL7ULJzL5nJD5q7q9VOZt_fxbKVm8fmn1Az5YkVY,417
|
411
411
|
hestia_earth/models/pooreNemecek2018/aboveGroundCropResidueTotal.py,sha256=Qt-mel4dkhK6N5uUOutNOinCTFjbjtGzITaaI0LvYc4,2396
|
412
412
|
hestia_earth/models/pooreNemecek2018/belowGroundCropResidue.py,sha256=JT0RybbvWVlo01FO8K0Yj41HrEaJT3Kj1xfayr2X-xw,2315
|
413
413
|
hestia_earth/models/pooreNemecek2018/ch4ToAirAquacultureSystems.py,sha256=CxjhFinScTebBGNVheEdbdw36DdHwoPszAnbxtd6_9s,6590
|
414
414
|
hestia_earth/models/pooreNemecek2018/excretaKgN.py,sha256=WI0SJJR8uJFfG1hTHDSOeiuTMhAW1fKcm0MX1QEvxcg,6340
|
415
415
|
hestia_earth/models/pooreNemecek2018/excretaKgVs.py,sha256=TW0lF752Ljlx7zj1v3TkAYLYASsYsYpEy8KH9y2yTQ8,9446
|
416
|
-
hestia_earth/models/pooreNemecek2018/freshwaterWithdrawalsDuringCycle.py,sha256=
|
417
|
-
hestia_earth/models/pooreNemecek2018/landOccupationDuringCycle.py,sha256=
|
416
|
+
hestia_earth/models/pooreNemecek2018/freshwaterWithdrawalsDuringCycle.py,sha256=rBWK_SzR9siorMxNORqB_BGQEadjyvzSh_SKOqRwFV0,3947
|
417
|
+
hestia_earth/models/pooreNemecek2018/landOccupationDuringCycle.py,sha256=gSUzPuzzLwQsBiX_Tgx6mWJ4pEB5qhlKoOtaEdmDGQ4,3431
|
418
418
|
hestia_earth/models/pooreNemecek2018/longFallowDuration.py,sha256=Wdm6QyOttCFP9Y3OjbaYrvdMmivOmMIT-m5Eg9SM9rY,1511
|
419
419
|
hestia_earth/models/pooreNemecek2018/n2OToAirAquacultureSystemsDirect.py,sha256=HJ7IstImGyasIKosK2lQZ-v6Lqt3_aEfZhoiC4CY0rM,2586
|
420
420
|
hestia_earth/models/pooreNemecek2018/n2ToAirAquacultureSystems.py,sha256=SoZlogDd7_4kq5S9gc8KmVeIXacWWhaUkWlKTuho_OA,2431
|
@@ -510,7 +510,7 @@ hestia_earth/models/site/defaultMethodClassification.py,sha256=mqy3P3DLf7cr4-TU_
|
|
510
510
|
hestia_earth/models/site/defaultMethodClassificationDescription.py,sha256=5rm9LUINmHF579HaqWfHZpFTjwZSgglE6TgAwBPs1uc,1250
|
511
511
|
hestia_earth/models/site/flowingWater.py,sha256=v3g5722GIA4zQAUQI9yGFiZvFvI1QAVZqlQrY-6_B3A,1731
|
512
512
|
hestia_earth/models/site/freshWater.py,sha256=FXs3Vt8V4e-wn325_dwSTOKlZtn5ksNUpvYGDeLJShY,1255
|
513
|
-
hestia_earth/models/site/management.py,sha256=
|
513
|
+
hestia_earth/models/site/management.py,sha256=GFM8d3AzGUxojLiTpcPnKk0wbYX8RhryNKSZhz8bio4,15034
|
514
514
|
hestia_earth/models/site/netPrimaryProduction.py,sha256=UIIQkYd911qVzrWjxBLrC37e-RARIVgDwLdARY9BuLw,1849
|
515
515
|
hestia_earth/models/site/organicCarbonPerHa.py,sha256=F2ShinHf0m9qKa1nCYBspsDkRY6jzOl0wM8mSDre22I,14916
|
516
516
|
hestia_earth/models/site/organicCarbonPerKgSoil.py,sha256=t--wAshiAKS-JvEKhLFRadGvgSBv5NFZ68jdyms_wh4,1945
|
@@ -573,15 +573,15 @@ hestia_earth/models/utils/aggregated.py,sha256=01V5RDvO9EZAEiApY7M2dUoR4GcGxvAH5
|
|
573
573
|
hestia_earth/models/utils/animalProduct.py,sha256=M5IunAKGY6oZv3j1Ascl34ywyeLWApqOIlBzbtlA2FE,721
|
574
574
|
hestia_earth/models/utils/aquacultureManagement.py,sha256=dxrbC1Xf140cohxTbSw6TxLAnAASWTdNZwBBam4yQnw,171
|
575
575
|
hestia_earth/models/utils/array_builders.py,sha256=QEkM7e75Y9aq5yEPEk3R8md36IuvCDkpekdGm3uA0uk,19397
|
576
|
-
hestia_earth/models/utils/blank_node.py,sha256
|
576
|
+
hestia_earth/models/utils/blank_node.py,sha256=m1-ZOHt0ImOzCRZDhr5uI44SrKAmRRXyT_tfUGg5uqk,52015
|
577
577
|
hestia_earth/models/utils/cache_sources.py,sha256=MBkrPpjwNiC4ApDjeYVHZjWBbpvAerXRDrMHpjasAZ0,377
|
578
578
|
hestia_earth/models/utils/completeness.py,sha256=2-GusD9UycobDZq8y5jar0ZcOjyqnSbzPRT_5XMc4YA,1259
|
579
579
|
hestia_earth/models/utils/constant.py,sha256=6wLx8xb2R8HtpEpVy5e-PbioOo7QCu2n-W72fs6OvgE,3411
|
580
|
-
hestia_earth/models/utils/crop.py,sha256=
|
580
|
+
hestia_earth/models/utils/crop.py,sha256=JF9vsXOlViiwsIkV-mQ9iRl4dZGgeP2mrgdAmKuhYaY,2713
|
581
581
|
hestia_earth/models/utils/cropResidue.py,sha256=_0Q35CrliJeo31xGHsPWe8A2oHxijdIsOrf3gBEqhlA,612
|
582
582
|
hestia_earth/models/utils/cropResidueManagement.py,sha256=nIDFjf39rDD10UHSVudfDyu-EiL261g8jyrgS-2aDKw,347
|
583
583
|
hestia_earth/models/utils/currency.py,sha256=f_ArJANb--pZq4LL49SXQ1AMX_oKroqwBXKRRQqZwsM,578
|
584
|
-
hestia_earth/models/utils/cycle.py,sha256=
|
584
|
+
hestia_earth/models/utils/cycle.py,sha256=PmloVCSU4TtXnEe0ltP--bTIZBXVB-rEFJrV6IYsdeo,16209
|
585
585
|
hestia_earth/models/utils/descriptive_stats.py,sha256=EMVwFvg2OnZgKRAfireAoWY2EbrSvqR0V0bK9B53p28,1583
|
586
586
|
hestia_earth/models/utils/ecoClimateZone.py,sha256=kD5DGActHAfMCJykKQGkwEEicWt7PQlEIX9_PkqXfP0,4265
|
587
587
|
hestia_earth/models/utils/emission.py,sha256=H_apu-Og9SJTLVU2lU56IsvSU22-9J7OrqXk1b2qnSE,3638
|
@@ -818,9 +818,9 @@ tests/models/haversineFormula/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5N
|
|
818
818
|
tests/models/haversineFormula/transport/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
819
819
|
tests/models/haversineFormula/transport/test_distance.py,sha256=hqzIOA1nGao8uiBE16J0ou52McwV4w30ZLpEAqtfi9k,970
|
820
820
|
tests/models/hestia/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
821
|
-
tests/models/hestia/test_landCover.py,sha256=
|
821
|
+
tests/models/hestia/test_landCover.py,sha256=mcjzAaQy8a2V45lExLuUQiQLpBShTKIn4FK2-lIvy4o,6129
|
822
822
|
tests/models/hestia/test_landTransformation100YearAverageDuringCycle.py,sha256=3qa4rWUFqP1VM5-vm_182rhiBYJDxPqJwWtBqJ5K028,956
|
823
|
-
tests/models/hestia/test_landTransformation20YearAverageDuringCycle.py,sha256=
|
823
|
+
tests/models/hestia/test_landTransformation20YearAverageDuringCycle.py,sha256=gMK0kGIucX9nbYPNbvYreCCJ2BmHGjrhx52hcy1uPGc,979
|
824
824
|
tests/models/hestia/test_seed_emissions.py,sha256=dCUuJBkhwNFBhhcypQN7eMqrWZ9iGCnypoidO5DfQYw,921
|
825
825
|
tests/models/impact_assessment/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
826
826
|
tests/models/impact_assessment/test_allocationMethod.py,sha256=HkUt6oWdEyFSdxMpx8y_Oxk0nO2Fi9B_kUZcVte9tzg,1223
|
@@ -1017,7 +1017,7 @@ tests/models/pooreNemecek2018/test_ch4ToAirAquacultureSystems.py,sha256=rUxD57yl
|
|
1017
1017
|
tests/models/pooreNemecek2018/test_excretaKgN.py,sha256=4YSri6_P5YXLx8cCAV4SJD36MEL_wWB8ZK-_AwGn0zQ,4064
|
1018
1018
|
tests/models/pooreNemecek2018/test_excretaKgVs.py,sha256=h41KnwQDo4Jp3HrbXTGK-qLU4ZPsWzhDZ5jIwDrmLuo,3256
|
1019
1019
|
tests/models/pooreNemecek2018/test_freshwaterWithdrawalsDuringCycle.py,sha256=5QxDU6VzcwWup3Nuhn32kJoIlAkqcSggGr4CmoRqrFA,1623
|
1020
|
-
tests/models/pooreNemecek2018/test_landOccupationDuringCycle.py,sha256=
|
1020
|
+
tests/models/pooreNemecek2018/test_landOccupationDuringCycle.py,sha256=rEhRHN6h6i4l89mZpyHE-pfsFM8lQUHw__jLu6FKz54,1728
|
1021
1021
|
tests/models/pooreNemecek2018/test_longFallowDuration.py,sha256=kelZajIbKyvVm1vX_grRZy0IUrtejGI5GPn03qbElnw,925
|
1022
1022
|
tests/models/pooreNemecek2018/test_n2OToAirAquacultureSystemsDirect.py,sha256=4YAoUhIwfEmRe2B5BvNg247VeB7UXHNeZqr2mRtJA7Y,2207
|
1023
1023
|
tests/models/pooreNemecek2018/test_n2ToAirAquacultureSystems.py,sha256=YqwAvbYfLVamfkUJUwGTEWEnz8ts66jVF8831QcWNkg,2200
|
@@ -1166,7 +1166,7 @@ tests/models/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
|
|
1166
1166
|
tests/models/utils/test_array_builders.py,sha256=uHxO4beJhdJD-1lI5aPEAsYziQP8SN7AJ9PEY67DpaI,8417
|
1167
1167
|
tests/models/utils/test_blank_node.py,sha256=G_hH-Gk3__1ZtHQcsdYMbUMwVNSTmYcVBs5jcReIYGM,39945
|
1168
1168
|
tests/models/utils/test_cache_sources.py,sha256=xcGMVbYoV23YC4HLBTL_4qZP1ME2cp3DFebgJMxI2TE,721
|
1169
|
-
tests/models/utils/test_crop.py,sha256=
|
1169
|
+
tests/models/utils/test_crop.py,sha256=d508vQdtB_Q_6hEahNueXed5PaEiLeN7ScbwZIKCiDI,862
|
1170
1170
|
tests/models/utils/test_cropResidueManagement.py,sha256=RQt8lexeJzCyxZceIutgDpw7BpcqmjsUB0C0yZC2QpY,930
|
1171
1171
|
tests/models/utils/test_currency.py,sha256=BPsojPsY9QW2aj8vgbjkPQXU8GU6wDwwtPZ3HdC4KTU,277
|
1172
1172
|
tests/models/utils/test_dataCompleteness.py,sha256=mW6rA7ddhtjZsLxwo5xDnvBdxmqTsivy4RTIU-2Lvk0,1713
|
@@ -1208,8 +1208,8 @@ tests/orchestrator/strategies/run/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeR
|
|
1208
1208
|
tests/orchestrator/strategies/run/test_add_blank_node_if_missing.py,sha256=lGqeebvgAwGathB8NLZ14Js5JV_-KyHueaD6I8IH8mU,3615
|
1209
1209
|
tests/orchestrator/strategies/run/test_add_key_if_missing.py,sha256=hKwvk1ohcBVnQUCTiDhRW99J0xEa29BpwFi1KC0yWLE,329
|
1210
1210
|
tests/orchestrator/strategies/run/test_always.py,sha256=w5-Dhp6yLzgZGAeMRz3OrqZbbAed9gZ1O266a3z9k7w,134
|
1211
|
-
hestia_earth_models-0.65.
|
1212
|
-
hestia_earth_models-0.65.
|
1213
|
-
hestia_earth_models-0.65.
|
1214
|
-
hestia_earth_models-0.65.
|
1215
|
-
hestia_earth_models-0.65.
|
1211
|
+
hestia_earth_models-0.65.11.dist-info/LICENSE,sha256=TD25LoiRJsA5CPUNrcyt1PXlGcbUGFMAeZoBcfCrCNE,1154
|
1212
|
+
hestia_earth_models-0.65.11.dist-info/METADATA,sha256=36kRKh8wpenfujTV4awKBVoP9is-KFfwyA8e6IRE6YU,4047
|
1213
|
+
hestia_earth_models-0.65.11.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
1214
|
+
hestia_earth_models-0.65.11.dist-info/top_level.txt,sha256=1dqA9TqpOLTEgpqa-YBsmbCmmNU1y56AtfFGEceZ2A0,19
|
1215
|
+
hestia_earth_models-0.65.11.dist-info/RECORD,,
|
@@ -14,7 +14,8 @@ fixtures_folder = f"{fixtures_path}/{MODEL}/{TERM_ID}"
|
|
14
14
|
@pytest.mark.parametrize(
|
15
15
|
"subfolder",
|
16
16
|
[
|
17
|
-
"maize_brazil"
|
17
|
+
"maize_brazil",
|
18
|
+
"orange_iran"
|
18
19
|
]
|
19
20
|
)
|
20
21
|
@patch("hestia_earth.models.hestia.resourceUse_utils._new_indicator", side_effect=fake_new_indicator)
|
@@ -9,7 +9,7 @@ class_path = f"hestia_earth.models.{MODEL}.{TERM_ID}"
|
|
9
9
|
fixtures_folder = f"{fixtures_path}/{MODEL}/{TERM_ID}"
|
10
10
|
|
11
11
|
|
12
|
-
@patch(f"{class_path}.
|
12
|
+
@patch(f"{class_path}.get_landCover_term_id", return_value='cropland')
|
13
13
|
@patch(f"{class_path}.land_occupation_per_kg", return_value=None)
|
14
14
|
def test_should_run(mock_land_occupation, *args):
|
15
15
|
# with a cycle and functionalUnit = 1 ha => no run
|
@@ -23,7 +23,6 @@ def test_should_run(mock_land_occupation, *args):
|
|
23
23
|
assert should_run is True
|
24
24
|
|
25
25
|
|
26
|
-
@patch(f"{class_path}.get_land_cover_term_id", return_value='cropland')
|
27
26
|
@patch(f"{class_path}._new_indicator", side_effect=fake_new_indicator)
|
28
27
|
def test_run(*args):
|
29
28
|
with open(f"{fixtures_folder}/impact-assessment.jsonld", encoding='utf-8') as f:
|
@@ -36,7 +35,6 @@ def test_run(*args):
|
|
36
35
|
assert value == expected
|
37
36
|
|
38
37
|
|
39
|
-
@patch(f"{class_path}.get_land_cover_term_id", return_value='cropland')
|
40
38
|
@patch(f"{class_path}._new_indicator", side_effect=fake_new_indicator)
|
41
39
|
def test_run_with_plantation(*args):
|
42
40
|
with open(f"{fixtures_folder}/with-orchard-crop/impact-assessment.jsonld", encoding='utf-8') as f:
|
tests/models/utils/test_crop.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
|
1
|
+
import pytest
|
2
|
+
from hestia_earth.schema import SiteSiteType, TermTermType
|
2
3
|
|
3
|
-
from hestia_earth.models.utils.crop import valid_site_type
|
4
|
+
from hestia_earth.models.utils.crop import valid_site_type, get_landCover_term_id
|
4
5
|
|
5
6
|
class_path = 'hestia_earth.models.utils.crop'
|
6
7
|
|
@@ -13,3 +14,14 @@ def test_valid_site_type():
|
|
13
14
|
cycle['site']['siteType'] = SiteSiteType.PERMANENT_PASTURE.value
|
14
15
|
assert not valid_site_type(cycle)
|
15
16
|
assert not valid_site_type(site, True) is True
|
17
|
+
|
18
|
+
|
19
|
+
@pytest.mark.parametrize(
|
20
|
+
'term,expected',
|
21
|
+
[
|
22
|
+
({'termType': TermTermType.CROP.value, '@id': 'wheatGrain'}, 'wheatPlant'),
|
23
|
+
({'termType': TermTermType.SEED.value, '@id': 'saplings'}, None),
|
24
|
+
]
|
25
|
+
)
|
26
|
+
def test_get_landCover_term_id(term: dict, expected: str):
|
27
|
+
assert get_landCover_term_id(term) == expected, term.get('@id')
|
File without changes
|
File without changes
|
{hestia_earth_models-0.65.10.dist-info → hestia_earth_models-0.65.11.dist-info}/top_level.txt
RENAMED
File without changes
|