hestia-earth-models 0.62.0__py3-none-any.whl → 0.62.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/blonkConsultants2016/utils.py +3 -2
- hestia_earth/models/cycle/coldCarcassWeightPerHead.py +4 -2
- hestia_earth/models/cycle/coldDressedCarcassWeightPerHead.py +2 -2
- hestia_earth/models/cycle/concentrateFeed.py +3 -3
- hestia_earth/models/cycle/feedConversionRatio/feedConversionRatioNitrogen.py +2 -1
- hestia_earth/models/cycle/post_checks/__init__.py +3 -2
- hestia_earth/models/cycle/post_checks/otherSites.py +40 -0
- hestia_earth/models/cycle/pre_checks/__init__.py +2 -1
- hestia_earth/models/cycle/pre_checks/otherSites.py +42 -0
- hestia_earth/models/cycle/pre_checks/site.py +1 -1
- hestia_earth/models/cycle/readyToCookWeightPerHead.py +2 -2
- hestia_earth/models/ecoinventV3AndEmberClimate/utils.py +1 -1
- hestia_earth/models/emepEea2019/utils.py +4 -3
- hestia_earth/models/geospatialDatabase/heavyWinterPrecipitation.py +1 -1
- hestia_earth/models/ipcc2019/animal/pastureGrass.py +53 -43
- hestia_earth/models/ipcc2019/co2ToAirSoilOrganicCarbonStockChangeManagementChange.py +30 -4
- hestia_earth/models/ipcc2019/n2OToAirExcretaDirect.py +6 -2
- hestia_earth/models/ipcc2019/n2OToAirExcretaIndirect.py +1 -1
- hestia_earth/models/ipcc2019/n2OToAirInorganicFertiliserDirect.py +1 -1
- hestia_earth/models/ipcc2019/n2OToAirInorganicFertiliserIndirect.py +1 -1
- hestia_earth/models/ipcc2019/n2OToAirOrganicFertiliserIndirect.py +1 -1
- hestia_earth/models/ipcc2019/organicCarbonPerHa_tier_1_utils.py +4 -2
- hestia_earth/models/ipcc2019/organicCarbonPerHa_tier_2_utils.py +210 -40
- hestia_earth/models/ipcc2019/organicCarbonPerHa_utils.py +2 -6
- hestia_earth/models/ipcc2019/pastureGrass.py +44 -42
- hestia_earth/models/ipcc2019/pastureGrass_utils.py +46 -92
- hestia_earth/models/mocking/search-results.json +378 -234
- hestia_earth/models/schererPfister2015/utils.py +2 -2
- hestia_earth/models/site/brackishWater.py +1 -1
- hestia_earth/models/site/flowingWater.py +1 -1
- hestia_earth/models/site/freshWater.py +1 -1
- hestia_earth/models/site/management.py +79 -38
- hestia_earth/models/site/pre_checks/cache_sources.py +9 -13
- hestia_earth/models/site/salineWater.py +1 -1
- hestia_earth/models/stehfestBouwman2006/n2OToAirCropResidueDecompositionDirect.py +12 -2
- hestia_earth/models/stehfestBouwman2006/n2OToAirExcretaDirect.py +12 -2
- hestia_earth/models/stehfestBouwman2006/n2OToAirInorganicFertiliserDirect.py +11 -1
- hestia_earth/models/stehfestBouwman2006/n2OToAirOrganicFertiliserDirect.py +11 -1
- hestia_earth/models/stehfestBouwman2006/noxToAirCropResidueDecomposition.py +12 -2
- hestia_earth/models/stehfestBouwman2006/noxToAirExcreta.py +12 -2
- hestia_earth/models/stehfestBouwman2006/noxToAirInorganicFertiliser.py +11 -1
- hestia_earth/models/stehfestBouwman2006/noxToAirOrganicFertiliser.py +11 -1
- hestia_earth/models/stehfestBouwman2006GisImplementation/noxToAirCropResidueDecomposition.py +12 -2
- hestia_earth/models/stehfestBouwman2006GisImplementation/noxToAirExcreta.py +12 -2
- hestia_earth/models/stehfestBouwman2006GisImplementation/noxToAirInorganicFertiliser.py +11 -1
- hestia_earth/models/stehfestBouwman2006GisImplementation/noxToAirOrganicFertiliser.py +11 -1
- hestia_earth/models/utils/blank_node.py +144 -110
- hestia_earth/models/utils/constant.py +2 -0
- hestia_earth/models/utils/lookup.py +19 -6
- hestia_earth/models/utils/property.py +6 -6
- hestia_earth/models/utils/site.py +7 -0
- hestia_earth/models/utils/source.py +1 -1
- hestia_earth/models/utils/term.py +21 -1
- hestia_earth/models/version.py +1 -1
- {hestia_earth_models-0.62.0.dist-info → hestia_earth_models-0.62.2.dist-info}/METADATA +2 -2
- {hestia_earth_models-0.62.0.dist-info → hestia_earth_models-0.62.2.dist-info}/RECORD +68 -63
- tests/models/cycle/post_checks/test_otherSites.py +15 -0
- tests/models/cycle/pre_checks/test_otherSites.py +21 -0
- tests/models/ipcc2019/test_co2ToAirSoilOrganicCarbonStockChangeManagementChange.py +5 -3
- tests/models/ipcc2019/test_organicCarbonPerHa.py +10 -20
- tests/models/ipcc2019/test_organicCarbonPerHa_tier_2_utils.py +0 -8
- tests/models/site/pre_checks/test_cache_sources.py +6 -10
- tests/models/site/test_management.py +192 -4
- tests/models/utils/test_blank_node.py +0 -281
- tests/models/utils/test_lookup.py +10 -0
- {hestia_earth_models-0.62.0.dist-info → hestia_earth_models-0.62.2.dist-info}/LICENSE +0 -0
- {hestia_earth_models-0.62.0.dist-info → hestia_earth_models-0.62.2.dist-info}/WHEEL +0 -0
- {hestia_earth_models-0.62.0.dist-info → hestia_earth_models-0.62.2.dist-info}/top_level.txt +0 -0
|
@@ -68,8 +68,8 @@ def get_water(cycle: dict, precipitation: float):
|
|
|
68
68
|
return list_sum([irrigation/10, precipitation or 0])
|
|
69
69
|
|
|
70
70
|
|
|
71
|
-
def calculate_R(heavy_winter_precipitation:
|
|
72
|
-
winter_precipitation = 1 if heavy_winter_precipitation
|
|
71
|
+
def calculate_R(heavy_winter_precipitation: bool, water: float):
|
|
72
|
+
winter_precipitation = 1 if heavy_winter_precipitation else 0.1
|
|
73
73
|
water_coeff = (587.8 - 1.219 * water) + (0.004105 * water ** 2) if water > 850 else (0.0483 * water ** 1.61)
|
|
74
74
|
return water_coeff * winter_precipitation
|
|
75
75
|
|
|
@@ -23,7 +23,7 @@ TERM_ID = 'brackishWater'
|
|
|
23
23
|
|
|
24
24
|
def _measurement():
|
|
25
25
|
data = _new_measurement(TERM_ID)
|
|
26
|
-
data['value'] = [
|
|
26
|
+
data['value'] = [True]
|
|
27
27
|
data['methodClassification'] = MeasurementMethodClassification.MODELLED_USING_OTHER_MEASUREMENTS.value
|
|
28
28
|
return data
|
|
29
29
|
|
|
@@ -31,7 +31,7 @@ SITE_TYPE_TO_TERM_ID = {
|
|
|
31
31
|
|
|
32
32
|
def _measurement(site: dict, term_id: str):
|
|
33
33
|
data = _new_measurement(term_id)
|
|
34
|
-
data['value'] = [
|
|
34
|
+
data['value'] = [True]
|
|
35
35
|
data['methodClassification'] = MeasurementMethodClassification.MODELLED_USING_OTHER_MEASUREMENTS.value
|
|
36
36
|
return data | get_source(site, BIBLIO_TITLE)
|
|
37
37
|
|
|
@@ -1,17 +1,31 @@
|
|
|
1
1
|
"""
|
|
2
|
-
Management node
|
|
2
|
+
Management node
|
|
3
|
+
|
|
4
|
+
This model provides data gap-filled data from cycles in the form of a list of management nodes
|
|
5
|
+
(https://www.hestia.earth/schema/Management).
|
|
6
|
+
|
|
7
|
+
It includes products of type crop, forage, landCover (gap-filled with a value of 100) and practices of type waterRegime,
|
|
8
|
+
tillage, cropResidueManagement and landUseManagement.
|
|
9
|
+
|
|
10
|
+
All values are copied from the source node, except for crop and forage terms in which case the dates are copied from the
|
|
11
|
+
cycle.
|
|
12
|
+
|
|
13
|
+
When nodes are chronologically consecutive with "% area" or "boolean" units and the same term and value, they are
|
|
14
|
+
condensed into a single node to aid readability.
|
|
3
15
|
"""
|
|
4
|
-
from typing import List, Any, Callable
|
|
5
16
|
from functools import reduce
|
|
17
|
+
|
|
6
18
|
from hestia_earth.schema import SchemaType, TermTermType
|
|
7
19
|
from hestia_earth.utils.api import download_hestia
|
|
8
20
|
from hestia_earth.utils.model import filter_list_term_type, linked_node
|
|
9
|
-
from hestia_earth.utils.tools import
|
|
21
|
+
from hestia_earth.utils.tools import safe_parse_float
|
|
22
|
+
from hestia_earth.utils.blank_node import get_node_value
|
|
10
23
|
|
|
11
24
|
from hestia_earth.models.log import logRequirements, logShouldRun, log_blank_nodes_id
|
|
12
25
|
from hestia_earth.models.utils.term import get_lookup_value
|
|
13
|
-
from hestia_earth.models.utils.blank_node import
|
|
26
|
+
from hestia_earth.models.utils.blank_node import condense_nodes
|
|
14
27
|
from hestia_earth.models.utils.site import related_cycles
|
|
28
|
+
from hestia_earth.models.utils.site import get_land_cover_term_id as get_landCover_term_id_from_site_type
|
|
15
29
|
from . import MODEL
|
|
16
30
|
|
|
17
31
|
REQUIREMENTS = {
|
|
@@ -24,7 +38,8 @@ REQUIREMENTS = {
|
|
|
24
38
|
"products": [
|
|
25
39
|
{
|
|
26
40
|
"@type": "Product",
|
|
27
|
-
"term.termType": ["crop", "forage", "landCover"]
|
|
41
|
+
"term.termType": ["crop", "forage", "landCover"],
|
|
42
|
+
"units": ["% area", "boolean"]
|
|
28
43
|
}
|
|
29
44
|
],
|
|
30
45
|
"practices": [
|
|
@@ -35,6 +50,7 @@ REQUIREMENTS = {
|
|
|
35
50
|
"cropResidueManagement",
|
|
36
51
|
"landUseManagement"
|
|
37
52
|
],
|
|
53
|
+
"units": ["% area", "boolean"],
|
|
38
54
|
"value": ""
|
|
39
55
|
}
|
|
40
56
|
],
|
|
@@ -115,18 +131,20 @@ def _extract_node_value(node: dict) -> dict:
|
|
|
115
131
|
return node | {'value': get_node_value(node)}
|
|
116
132
|
|
|
117
133
|
|
|
118
|
-
def _include(value: dict, keys: list): return {k: v for k, v in value.items() if k in keys}
|
|
134
|
+
def _include(value: dict, keys: list) -> dict: return {k: v for k, v in value.items() if k in keys}
|
|
119
135
|
|
|
120
136
|
|
|
121
|
-
def _default_dates(cycle: dict, values: list):
|
|
137
|
+
def _default_dates(cycle: dict, values: list) -> list:
|
|
138
|
+
"""Only uses the dates from the cycle if they are missing from the item."""
|
|
122
139
|
return [(_include(cycle, ["startDate", "endDate"]) | v) for v in values]
|
|
123
140
|
|
|
124
141
|
|
|
125
142
|
def _overwrite_dates(cycle: dict, values: list) -> list:
|
|
143
|
+
"""Always uses the dates from the cycle."""
|
|
126
144
|
return [v | _include(cycle, ["startDate", "endDate"]) for v in values]
|
|
127
145
|
|
|
128
146
|
|
|
129
|
-
def _copy_item_if_exists(source: dict, keys:
|
|
147
|
+
def _copy_item_if_exists(source: dict, keys: list[str] = None, dest: dict = None) -> dict:
|
|
130
148
|
keys = keys or []
|
|
131
149
|
dest = dest or {}
|
|
132
150
|
return reduce(lambda p, c: p | ({c: source[c]} if c in source else {}), keys, dest)
|
|
@@ -134,25 +152,24 @@ def _copy_item_if_exists(source: dict, keys: List[str] = None, dest: dict = None
|
|
|
134
152
|
|
|
135
153
|
def _get_landCover_term_id(product: dict) -> str:
|
|
136
154
|
value = get_lookup_value(product.get('term', {}), LAND_COVER_KEY, model=MODEL, model_key=LAND_COVER_KEY)
|
|
137
|
-
# TODO: what should happen when there are multiple values?
|
|
138
155
|
return value.split(';')[0] if value else None
|
|
139
156
|
|
|
140
157
|
|
|
141
|
-
def
|
|
142
|
-
|
|
143
|
-
):
|
|
144
|
-
"""
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
]
|
|
152
|
-
|
|
158
|
+
def _get_relevant_items(
|
|
159
|
+
cycles: list[dict], item_name: str, relevant_terms: list, date_fill: callable = _default_dates
|
|
160
|
+
) -> list[tuple]:
|
|
161
|
+
"""
|
|
162
|
+
Get items (optionally in tuples with site_type) from the list of cycles with any of the relevant terms.
|
|
163
|
+
Also adds dates if missing.
|
|
164
|
+
"""
|
|
165
|
+
return [
|
|
166
|
+
(item, cycle.get("site", {}).get("siteType", ""))
|
|
167
|
+
for cycle in cycles
|
|
168
|
+
for item in date_fill(cycle=cycle, values=filter_list_term_type(cycle.get(item_name, []), relevant_terms))
|
|
169
|
+
]
|
|
153
170
|
|
|
154
171
|
|
|
155
|
-
def _get_lookup_with_debug(term: dict, column: str) ->
|
|
172
|
+
def _get_lookup_with_debug(term: dict, column: str) -> any:
|
|
156
173
|
get_lookup_value(term, column, model_key=MODEL_KEY, land_cover_key=LAND_COVER_KEY)
|
|
157
174
|
|
|
158
175
|
|
|
@@ -169,7 +186,7 @@ def _data_from_input(cycle: dict, term_id: str) -> dict:
|
|
|
169
186
|
}
|
|
170
187
|
|
|
171
188
|
|
|
172
|
-
def _process_rule(cycle, term, term_type) ->
|
|
189
|
+
def _process_rule(cycle, term, term_type) -> list:
|
|
173
190
|
relevant_terms = []
|
|
174
191
|
for column, condition, new_term in INPUT_RULES[term_type]:
|
|
175
192
|
lookup_result = _get_lookup_with_debug(term, LOOKUPS[column])
|
|
@@ -180,7 +197,7 @@ def _process_rule(cycle, term, term_type) -> List:
|
|
|
180
197
|
return relevant_terms
|
|
181
198
|
|
|
182
199
|
|
|
183
|
-
def _get_relevant_inputs(cycles:
|
|
200
|
+
def _get_relevant_inputs(cycles: list[dict]) -> list:
|
|
184
201
|
relevant_inputs = []
|
|
185
202
|
for cycle in [c for c in cycles if "inputs" in c]:
|
|
186
203
|
for i in cycle["inputs"]:
|
|
@@ -196,27 +213,23 @@ def _get_relevant_inputs(cycles: List[dict]) -> List:
|
|
|
196
213
|
return relevant_inputs
|
|
197
214
|
|
|
198
215
|
|
|
199
|
-
def
|
|
200
|
-
# Only get related cycles once.
|
|
201
|
-
cycles = related_cycles(site)
|
|
202
|
-
|
|
216
|
+
def _should_run_all_products(cycles):
|
|
203
217
|
products_land_cover = [
|
|
204
218
|
_extract_node_value(
|
|
205
219
|
_include(
|
|
206
220
|
value=product,
|
|
207
221
|
keys=["term", "value", "startDate", "endDate", "properties"]
|
|
208
222
|
)
|
|
209
|
-
) for product in
|
|
223
|
+
) for product, _ in _get_relevant_items(
|
|
210
224
|
cycles=cycles,
|
|
211
225
|
item_name="products",
|
|
212
|
-
|
|
226
|
+
relevant_terms=[TermTermType.LANDCOVER]
|
|
213
227
|
)
|
|
214
228
|
]
|
|
215
|
-
|
|
216
|
-
products_crop_forage = _get_items_with_relevant_term_type(
|
|
229
|
+
products_crop_forage = _get_relevant_items(
|
|
217
230
|
cycles=cycles,
|
|
218
231
|
item_name="products",
|
|
219
|
-
|
|
232
|
+
relevant_terms=[TermTermType.CROP, TermTermType.FORAGE],
|
|
220
233
|
date_fill=_overwrite_dates
|
|
221
234
|
)
|
|
222
235
|
products_crop_forage = [
|
|
@@ -228,19 +241,45 @@ def _should_run(site: dict):
|
|
|
228
241
|
"value": 100
|
|
229
242
|
}
|
|
230
243
|
)
|
|
231
|
-
for product in list(filter(_get_landCover_term_id, products_crop_forage))
|
|
244
|
+
for product in list(filter(_get_landCover_term_id, [i[0] for i in products_crop_forage]))
|
|
245
|
+
]
|
|
246
|
+
products_animal_with_site_type = _get_relevant_items(
|
|
247
|
+
cycles=cycles,
|
|
248
|
+
item_name="products",
|
|
249
|
+
relevant_terms=[TermTermType.LIVEANIMAL, TermTermType.ANIMALPRODUCT]
|
|
250
|
+
)
|
|
251
|
+
products_animal = [
|
|
252
|
+
_copy_item_if_exists(
|
|
253
|
+
source=product,
|
|
254
|
+
keys=["startDate", "endDate", "properties"],
|
|
255
|
+
dest={
|
|
256
|
+
"term": linked_node(download_hestia(get_landCover_term_id_from_site_type(site_type))),
|
|
257
|
+
"value": 100
|
|
258
|
+
}
|
|
259
|
+
)
|
|
260
|
+
for product, site_type in products_animal_with_site_type if product
|
|
232
261
|
]
|
|
233
262
|
|
|
263
|
+
return products_animal, products_crop_forage, products_land_cover
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
def _should_run(site: dict):
|
|
267
|
+
cycles = related_cycles(site)
|
|
268
|
+
|
|
269
|
+
products_animal, products_crop_forage, products_land_cover = _should_run_all_products(cycles)
|
|
270
|
+
all_products = products_land_cover + products_crop_forage + products_animal
|
|
271
|
+
all_products = condense_nodes(all_products)
|
|
272
|
+
|
|
234
273
|
practices = [
|
|
235
274
|
_extract_node_value(
|
|
236
275
|
_include(
|
|
237
276
|
value=practice,
|
|
238
277
|
keys=["term", "value", "startDate", "endDate"]
|
|
239
278
|
)
|
|
240
|
-
) for practice in
|
|
279
|
+
) for practice, _ in _get_relevant_items(
|
|
241
280
|
cycles=cycles,
|
|
242
281
|
item_name="practices",
|
|
243
|
-
|
|
282
|
+
relevant_terms=[
|
|
244
283
|
TermTermType.WATERREGIME,
|
|
245
284
|
TermTermType.TILLAGE,
|
|
246
285
|
TermTermType.CROPRESIDUEMANAGEMENT,
|
|
@@ -248,6 +287,7 @@ def _should_run(site: dict):
|
|
|
248
287
|
]
|
|
249
288
|
)
|
|
250
289
|
]
|
|
290
|
+
practices = condense_nodes(practices)
|
|
251
291
|
|
|
252
292
|
relevant_inputs = _get_relevant_inputs(cycles)
|
|
253
293
|
logRequirements(
|
|
@@ -257,12 +297,13 @@ def _should_run(site: dict):
|
|
|
257
297
|
model_key=MODEL_KEY,
|
|
258
298
|
products_crop_forage_ids=log_blank_nodes_id(products_crop_forage),
|
|
259
299
|
products_land_cover_ids=log_blank_nodes_id(products_land_cover),
|
|
300
|
+
products_animal=log_blank_nodes_id(products_animal),
|
|
260
301
|
practice_ids=log_blank_nodes_id(practices),
|
|
261
302
|
inputs=log_blank_nodes_id(relevant_inputs)
|
|
262
303
|
)
|
|
263
|
-
should_run = any(
|
|
304
|
+
should_run = any(all_products + practices + relevant_inputs)
|
|
264
305
|
logShouldRun(site, MODEL, None, should_run=should_run, model_key=MODEL_KEY)
|
|
265
|
-
return should_run,
|
|
306
|
+
return should_run, all_products, practices, relevant_inputs
|
|
266
307
|
|
|
267
308
|
|
|
268
309
|
def run(site: dict):
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Pre Checks Cache Sources
|
|
3
3
|
|
|
4
|
-
This model caches the sources of all models.
|
|
4
|
+
This model caches the sources of all Site models.
|
|
5
5
|
"""
|
|
6
6
|
from hestia_earth.models.log import debugValues
|
|
7
7
|
from hestia_earth.models.utils import CACHE_KEY, cached_value
|
|
@@ -15,24 +15,20 @@ RETURNS = {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
def
|
|
18
|
+
def _run(site: dict):
|
|
19
19
|
sources = find_sources()
|
|
20
|
-
|
|
20
|
+
debugValues(site, sources=';'.join([str(title) for title in sources.keys()]))
|
|
21
|
+
return sources
|
|
21
22
|
|
|
22
|
-
debugValues(site,
|
|
23
|
-
sources=';'.join([str(title) for title in sources.keys()]),
|
|
24
|
-
has_cache=has_cache)
|
|
25
23
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
])
|
|
30
|
-
return should_run, sources
|
|
24
|
+
def _should_run(site: dict):
|
|
25
|
+
has_cache = cached_value(site, CACHE_SOURCES_KEY)
|
|
26
|
+
return not bool(has_cache)
|
|
31
27
|
|
|
32
28
|
|
|
33
29
|
def run(site: dict):
|
|
34
|
-
should_run
|
|
30
|
+
should_run = _should_run(site)
|
|
35
31
|
return {
|
|
36
32
|
**site,
|
|
37
|
-
CACHE_KEY: cached_value(site) | {CACHE_SOURCES_KEY:
|
|
33
|
+
CACHE_KEY: cached_value(site) | {CACHE_SOURCES_KEY: _run(site)}
|
|
38
34
|
} if should_run else site
|
|
@@ -23,7 +23,7 @@ TERM_ID = 'salineWater'
|
|
|
23
23
|
|
|
24
24
|
def _measurement():
|
|
25
25
|
data = _new_measurement(TERM_ID)
|
|
26
|
-
data['value'] = [
|
|
26
|
+
data['value'] = [True]
|
|
27
27
|
data['methodClassification'] = MeasurementMethodClassification.MODELLED_USING_OTHER_MEASUREMENTS.value
|
|
28
28
|
return data
|
|
29
29
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
from hestia_earth.schema import EmissionMethodTier
|
|
1
|
+
from hestia_earth.schema import EmissionMethodTier, TermTermType
|
|
2
2
|
|
|
3
|
+
from hestia_earth.models.log import logRequirements, logShouldRun
|
|
3
4
|
from hestia_earth.models.utils.cycle import get_crop_residue_decomposition_N_total
|
|
5
|
+
from hestia_earth.models.utils.completeness import _is_term_type_complete
|
|
4
6
|
from hestia_earth.models.utils.emission import _new_emission
|
|
5
7
|
from .n2OToAirSoilFlux import _should_run, _get_value
|
|
6
8
|
from . import MODEL
|
|
@@ -59,5 +61,13 @@ def _run(cycle: dict, content_list_of_items: list, N_total: float):
|
|
|
59
61
|
|
|
60
62
|
|
|
61
63
|
def run(cycle: dict):
|
|
62
|
-
|
|
64
|
+
default_should_run, N_total, content_list_of_items = _should_run(cycle, TERM_ID, TIER)
|
|
65
|
+
term_type_complete = _is_term_type_complete(cycle, TermTermType.CROPRESIDUE)
|
|
66
|
+
|
|
67
|
+
logRequirements(cycle, model=MODEL, term=TERM_ID,
|
|
68
|
+
term_type_cropResidue_complete=term_type_complete)
|
|
69
|
+
|
|
70
|
+
should_run = all([default_should_run, term_type_complete])
|
|
71
|
+
logShouldRun(cycle, MODEL, TERM_ID, should_run)
|
|
72
|
+
|
|
63
73
|
return _run(cycle, content_list_of_items, N_total) if should_run else []
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
from hestia_earth.schema import EmissionMethodTier
|
|
1
|
+
from hestia_earth.schema import EmissionMethodTier, TermTermType
|
|
2
2
|
|
|
3
|
+
from hestia_earth.models.log import logRequirements, logShouldRun
|
|
3
4
|
from hestia_earth.models.utils.cycle import get_excreta_N_total
|
|
5
|
+
from hestia_earth.models.utils.completeness import _is_term_type_complete
|
|
4
6
|
from hestia_earth.models.utils.emission import _new_emission
|
|
5
7
|
from .n2OToAirSoilFlux import _get_value, _should_run
|
|
6
8
|
from . import MODEL
|
|
@@ -66,5 +68,13 @@ def _run(cycle: dict, content_list_of_items: list, N_total: float):
|
|
|
66
68
|
|
|
67
69
|
|
|
68
70
|
def run(cycle: dict):
|
|
69
|
-
|
|
71
|
+
default_should_run, N_total, content_list_of_items = _should_run(cycle, TERM_ID, TIER)
|
|
72
|
+
term_type_complete = _is_term_type_complete(cycle, TermTermType.EXCRETA)
|
|
73
|
+
|
|
74
|
+
logRequirements(cycle, model=MODEL, term=TERM_ID,
|
|
75
|
+
term_type_excreta_complete=term_type_complete)
|
|
76
|
+
|
|
77
|
+
should_run = all([default_should_run, term_type_complete])
|
|
78
|
+
logShouldRun(cycle, MODEL, TERM_ID, should_run)
|
|
79
|
+
|
|
70
80
|
return _run(cycle, content_list_of_items, N_total) if should_run else []
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
from hestia_earth.schema import EmissionMethodTier
|
|
2
2
|
|
|
3
|
+
from hestia_earth.models.log import logRequirements, logShouldRun
|
|
3
4
|
from hestia_earth.models.utils.emission import _new_emission
|
|
5
|
+
from hestia_earth.models.utils.completeness import _is_term_type_complete
|
|
4
6
|
from hestia_earth.models.utils.cycle import get_inorganic_fertiliser_N_total
|
|
5
7
|
from .n2OToAirSoilFlux import _get_value, _should_run
|
|
6
8
|
from . import MODEL
|
|
@@ -69,5 +71,13 @@ def _run(cycle: dict, content_list_of_items: list, N_total: float):
|
|
|
69
71
|
|
|
70
72
|
|
|
71
73
|
def run(cycle: dict):
|
|
72
|
-
|
|
74
|
+
default_should_run, N_total, content_list_of_items = _should_run(cycle, TERM_ID, TIER)
|
|
75
|
+
term_type_complete = _is_term_type_complete(cycle, 'fertiliser')
|
|
76
|
+
|
|
77
|
+
logRequirements(cycle, model=MODEL, term=TERM_ID,
|
|
78
|
+
term_type_fertiliser_complete=term_type_complete)
|
|
79
|
+
|
|
80
|
+
should_run = all([default_should_run, term_type_complete])
|
|
81
|
+
logShouldRun(cycle, MODEL, TERM_ID, should_run)
|
|
82
|
+
|
|
73
83
|
return _run(cycle, content_list_of_items, N_total) if should_run else []
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
from hestia_earth.schema import EmissionMethodTier
|
|
2
2
|
|
|
3
|
+
from hestia_earth.models.log import logRequirements, logShouldRun
|
|
3
4
|
from hestia_earth.models.utils.emission import _new_emission
|
|
5
|
+
from hestia_earth.models.utils.completeness import _is_term_type_complete
|
|
4
6
|
from hestia_earth.models.utils.cycle import get_organic_fertiliser_N_total
|
|
5
7
|
from .n2OToAirSoilFlux import _get_value, _should_run
|
|
6
8
|
from . import MODEL
|
|
@@ -69,5 +71,13 @@ def _run(cycle: dict, content_list_of_items: list, N_total: float):
|
|
|
69
71
|
|
|
70
72
|
|
|
71
73
|
def run(cycle: dict):
|
|
72
|
-
|
|
74
|
+
default_should_run, N_total, content_list_of_items = _should_run(cycle, TERM_ID, TIER)
|
|
75
|
+
term_type_complete = _is_term_type_complete(cycle, 'fertiliser')
|
|
76
|
+
|
|
77
|
+
logRequirements(cycle, model=MODEL, term=TERM_ID,
|
|
78
|
+
term_type_fertiliser_complete=term_type_complete)
|
|
79
|
+
|
|
80
|
+
should_run = all([default_should_run, term_type_complete])
|
|
81
|
+
logShouldRun(cycle, MODEL, TERM_ID, should_run)
|
|
82
|
+
|
|
73
83
|
return _run(cycle, content_list_of_items, N_total) if should_run else []
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
from hestia_earth.schema import EmissionMethodTier
|
|
1
|
+
from hestia_earth.schema import EmissionMethodTier, TermTermType
|
|
2
2
|
|
|
3
|
+
from hestia_earth.models.log import logRequirements, logShouldRun
|
|
3
4
|
from hestia_earth.models.utils.cycle import get_crop_residue_decomposition_N_total
|
|
5
|
+
from hestia_earth.models.utils.completeness import _is_term_type_complete
|
|
4
6
|
from hestia_earth.models.utils.emission import _new_emission
|
|
5
7
|
from .noxToAirSoilFlux import _should_run, _get_value
|
|
6
8
|
from . import MODEL
|
|
@@ -54,5 +56,13 @@ def _run(cycle: dict, ecoClimateZone: str, nitrogenContent: float, N_total: floa
|
|
|
54
56
|
|
|
55
57
|
|
|
56
58
|
def run(cycle: dict):
|
|
57
|
-
|
|
59
|
+
default_should_run, ecoClimateZone, nitrogenContent, N_total = _should_run(cycle, TERM_ID, TIER)
|
|
60
|
+
term_type_complete = _is_term_type_complete(cycle, TermTermType.CROPRESIDUE)
|
|
61
|
+
|
|
62
|
+
logRequirements(cycle, model=MODEL, term=TERM_ID,
|
|
63
|
+
term_type_cropResidue_complete=term_type_complete)
|
|
64
|
+
|
|
65
|
+
should_run = all([default_should_run, term_type_complete])
|
|
66
|
+
logShouldRun(cycle, MODEL, TERM_ID, should_run)
|
|
67
|
+
|
|
58
68
|
return _run(cycle, ecoClimateZone, nitrogenContent, N_total) if should_run else []
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
from hestia_earth.schema import EmissionMethodTier
|
|
1
|
+
from hestia_earth.schema import EmissionMethodTier, TermTermType
|
|
2
2
|
|
|
3
|
+
from hestia_earth.models.log import logRequirements, logShouldRun
|
|
3
4
|
from hestia_earth.models.utils.cycle import get_excreta_N_total
|
|
5
|
+
from hestia_earth.models.utils.completeness import _is_term_type_complete
|
|
4
6
|
from hestia_earth.models.utils.emission import _new_emission
|
|
5
7
|
from .noxToAirSoilFlux import _should_run, _get_value
|
|
6
8
|
from . import MODEL
|
|
@@ -61,5 +63,13 @@ def _run(cycle: dict, ecoClimateZone: str, nitrogenContent: float, N_total: floa
|
|
|
61
63
|
|
|
62
64
|
|
|
63
65
|
def run(cycle: dict):
|
|
64
|
-
|
|
66
|
+
default_should_run, ecoClimateZone, nitrogenContent, N_total = _should_run(cycle, TERM_ID, TIER)
|
|
67
|
+
term_type_complete = _is_term_type_complete(cycle, TermTermType.EXCRETA)
|
|
68
|
+
|
|
69
|
+
logRequirements(cycle, model=MODEL, term=TERM_ID,
|
|
70
|
+
term_type_excreta_complete=term_type_complete)
|
|
71
|
+
|
|
72
|
+
should_run = all([default_should_run, term_type_complete])
|
|
73
|
+
logShouldRun(cycle, MODEL, TERM_ID, should_run)
|
|
74
|
+
|
|
65
75
|
return _run(cycle, ecoClimateZone, nitrogenContent, N_total) if should_run else []
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
from hestia_earth.schema import EmissionMethodTier
|
|
2
2
|
|
|
3
|
+
from hestia_earth.models.log import logRequirements, logShouldRun
|
|
3
4
|
from hestia_earth.models.utils.cycle import get_inorganic_fertiliser_N_total
|
|
5
|
+
from hestia_earth.models.utils.completeness import _is_term_type_complete
|
|
4
6
|
from hestia_earth.models.utils.emission import _new_emission
|
|
5
7
|
from .noxToAirSoilFlux import _should_run, _get_value
|
|
6
8
|
from . import MODEL
|
|
@@ -64,5 +66,13 @@ def _run(cycle: dict, ecoClimateZone: str, nitrogenContent: float, N_total: floa
|
|
|
64
66
|
|
|
65
67
|
|
|
66
68
|
def run(cycle: dict):
|
|
67
|
-
|
|
69
|
+
default_should_run, ecoClimateZone, nitrogenContent, N_total = _should_run(cycle, TERM_ID, TIER)
|
|
70
|
+
term_type_complete = _is_term_type_complete(cycle, 'fertiliser')
|
|
71
|
+
|
|
72
|
+
logRequirements(cycle, model=MODEL, term=TERM_ID,
|
|
73
|
+
term_type_fertiliser_complete=term_type_complete)
|
|
74
|
+
|
|
75
|
+
should_run = all([default_should_run, term_type_complete])
|
|
76
|
+
logShouldRun(cycle, MODEL, TERM_ID, should_run)
|
|
77
|
+
|
|
68
78
|
return _run(cycle, ecoClimateZone, nitrogenContent, N_total) if should_run else []
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
from hestia_earth.schema import EmissionMethodTier
|
|
2
2
|
|
|
3
|
+
from hestia_earth.models.log import logRequirements, logShouldRun
|
|
3
4
|
from hestia_earth.models.utils.cycle import get_organic_fertiliser_N_total
|
|
5
|
+
from hestia_earth.models.utils.completeness import _is_term_type_complete
|
|
4
6
|
from hestia_earth.models.utils.emission import _new_emission
|
|
5
7
|
from .noxToAirSoilFlux import _should_run, _get_value
|
|
6
8
|
from . import MODEL
|
|
@@ -64,5 +66,13 @@ def _run(cycle: dict, ecoClimateZone: str, nitrogenContent: float, N_total: floa
|
|
|
64
66
|
|
|
65
67
|
|
|
66
68
|
def run(cycle: dict):
|
|
67
|
-
|
|
69
|
+
default_should_run, ecoClimateZone, nitrogenContent, N_total = _should_run(cycle, TERM_ID, TIER)
|
|
70
|
+
term_type_complete = _is_term_type_complete(cycle, 'fertiliser')
|
|
71
|
+
|
|
72
|
+
logRequirements(cycle, model=MODEL, term=TERM_ID,
|
|
73
|
+
term_type_fertiliser_complete=term_type_complete)
|
|
74
|
+
|
|
75
|
+
should_run = all([default_should_run, term_type_complete])
|
|
76
|
+
logShouldRun(cycle, MODEL, TERM_ID, should_run)
|
|
77
|
+
|
|
68
78
|
return _run(cycle, ecoClimateZone, nitrogenContent, N_total) if should_run else []
|
hestia_earth/models/stehfestBouwman2006GisImplementation/noxToAirCropResidueDecomposition.py
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
from hestia_earth.schema import EmissionMethodTier
|
|
1
|
+
from hestia_earth.schema import EmissionMethodTier, TermTermType
|
|
2
2
|
|
|
3
|
+
from hestia_earth.models.log import logRequirements, logShouldRun
|
|
3
4
|
from hestia_earth.models.utils.cycle import get_crop_residue_decomposition_N_total
|
|
5
|
+
from hestia_earth.models.utils.completeness import _is_term_type_complete
|
|
4
6
|
from hestia_earth.models.utils.emission import _new_emission
|
|
5
7
|
from .noxToAirSoilFlux import _should_run, _get_value
|
|
6
8
|
from . import MODEL
|
|
@@ -51,5 +53,13 @@ def _run(cycle: dict, country_id: str, N_total: float):
|
|
|
51
53
|
|
|
52
54
|
|
|
53
55
|
def run(cycle: dict):
|
|
54
|
-
|
|
56
|
+
default_should_run, country_id, N_total, *args = _should_run(cycle, TERM_ID, TIER)
|
|
57
|
+
term_type_complete = _is_term_type_complete(cycle, TermTermType.CROPRESIDUE)
|
|
58
|
+
|
|
59
|
+
logRequirements(cycle, model=MODEL, term=TERM_ID,
|
|
60
|
+
term_type_cropResidue_complete=term_type_complete)
|
|
61
|
+
|
|
62
|
+
should_run = all([default_should_run, term_type_complete])
|
|
63
|
+
logShouldRun(cycle, MODEL, TERM_ID, should_run)
|
|
64
|
+
|
|
55
65
|
return _run(cycle, country_id, N_total) if should_run else []
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
from hestia_earth.schema import EmissionMethodTier
|
|
1
|
+
from hestia_earth.schema import EmissionMethodTier, TermTermType
|
|
2
2
|
|
|
3
|
+
from hestia_earth.models.log import logRequirements, logShouldRun
|
|
3
4
|
from hestia_earth.models.utils.cycle import get_excreta_N_total
|
|
5
|
+
from hestia_earth.models.utils.completeness import _is_term_type_complete
|
|
4
6
|
from hestia_earth.models.utils.emission import _new_emission
|
|
5
7
|
from .noxToAirSoilFlux import _should_run, _get_value
|
|
6
8
|
from . import MODEL
|
|
@@ -58,5 +60,13 @@ def _run(cycle: dict, country_id: str, N_total: float):
|
|
|
58
60
|
|
|
59
61
|
|
|
60
62
|
def run(cycle: dict):
|
|
61
|
-
|
|
63
|
+
default_should_run, country_id, N_total, *args = _should_run(cycle, TERM_ID, TIER)
|
|
64
|
+
term_type_complete = _is_term_type_complete(cycle, TermTermType.EXCRETA)
|
|
65
|
+
|
|
66
|
+
logRequirements(cycle, model=MODEL, term=TERM_ID,
|
|
67
|
+
term_type_excreta_complete=term_type_complete)
|
|
68
|
+
|
|
69
|
+
should_run = all([default_should_run, term_type_complete])
|
|
70
|
+
logShouldRun(cycle, MODEL, TERM_ID, should_run)
|
|
71
|
+
|
|
62
72
|
return _run(cycle, country_id, N_total) if should_run else []
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
from hestia_earth.schema import EmissionMethodTier
|
|
2
2
|
|
|
3
|
+
from hestia_earth.models.log import logRequirements, logShouldRun
|
|
3
4
|
from hestia_earth.models.utils.cycle import get_inorganic_fertiliser_N_total
|
|
5
|
+
from hestia_earth.models.utils.completeness import _is_term_type_complete
|
|
4
6
|
from hestia_earth.models.utils.emission import _new_emission
|
|
5
7
|
from .noxToAirSoilFlux import _should_run, _get_value
|
|
6
8
|
from . import MODEL
|
|
@@ -61,5 +63,13 @@ def _run(cycle: dict, country_id: str, N_total: float):
|
|
|
61
63
|
|
|
62
64
|
|
|
63
65
|
def run(cycle: dict):
|
|
64
|
-
|
|
66
|
+
default_should_run, country_id, N_total, *args = _should_run(cycle, TERM_ID, TIER)
|
|
67
|
+
term_type_complete = _is_term_type_complete(cycle, 'fertiliser')
|
|
68
|
+
|
|
69
|
+
logRequirements(cycle, model=MODEL, term=TERM_ID,
|
|
70
|
+
term_type_fertiliser_complete=term_type_complete)
|
|
71
|
+
|
|
72
|
+
should_run = all([default_should_run, term_type_complete])
|
|
73
|
+
logShouldRun(cycle, MODEL, TERM_ID, should_run)
|
|
74
|
+
|
|
65
75
|
return _run(cycle, country_id, N_total) if should_run else []
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
from hestia_earth.schema import EmissionMethodTier
|
|
2
2
|
|
|
3
|
+
from hestia_earth.models.log import logRequirements, logShouldRun
|
|
3
4
|
from hestia_earth.models.utils.cycle import get_organic_fertiliser_N_total
|
|
5
|
+
from hestia_earth.models.utils.completeness import _is_term_type_complete
|
|
4
6
|
from hestia_earth.models.utils.emission import _new_emission
|
|
5
7
|
from .noxToAirSoilFlux import _should_run, _get_value
|
|
6
8
|
from . import MODEL
|
|
@@ -61,5 +63,13 @@ def _run(cycle: dict, country_id: str, N_total: float):
|
|
|
61
63
|
|
|
62
64
|
|
|
63
65
|
def run(cycle: dict):
|
|
64
|
-
|
|
66
|
+
default_should_run, country_id, N_total, *args = _should_run(cycle, TERM_ID, TIER)
|
|
67
|
+
term_type_complete = _is_term_type_complete(cycle, 'fertiliser')
|
|
68
|
+
|
|
69
|
+
logRequirements(cycle, model=MODEL, term=TERM_ID,
|
|
70
|
+
term_type_fertiliser_complete=term_type_complete)
|
|
71
|
+
|
|
72
|
+
should_run = all([default_should_run, term_type_complete])
|
|
73
|
+
logShouldRun(cycle, MODEL, TERM_ID, should_run)
|
|
74
|
+
|
|
65
75
|
return _run(cycle, country_id, N_total) if should_run else []
|