hestia-earth-models 0.61.8__py3-none-any.whl → 0.62.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of hestia-earth-models might be problematic. Click here for more details.

Files changed (64) hide show
  1. hestia_earth/models/blonkConsultants2016/utils.py +3 -2
  2. hestia_earth/models/cycle/completeness/electricityFuel.py +5 -1
  3. hestia_earth/models/cycle/post_checks/__init__.py +3 -2
  4. hestia_earth/models/cycle/post_checks/otherSites.py +40 -0
  5. hestia_earth/models/cycle/pre_checks/__init__.py +2 -1
  6. hestia_earth/models/cycle/pre_checks/otherSites.py +42 -0
  7. hestia_earth/models/cycle/pre_checks/site.py +1 -1
  8. hestia_earth/models/cycle/product/economicValueShare.py +47 -31
  9. hestia_earth/models/ecoinventV3AndEmberClimate/utils.py +1 -1
  10. hestia_earth/models/emepEea2019/utils.py +4 -3
  11. hestia_earth/models/geospatialDatabase/heavyWinterPrecipitation.py +1 -1
  12. hestia_earth/models/ipcc2019/animal/pastureGrass.py +36 -30
  13. hestia_earth/models/ipcc2019/co2ToAirSoilOrganicCarbonStockChangeManagementChange.py +30 -4
  14. hestia_earth/models/ipcc2019/n2OToAirExcretaDirect.py +6 -2
  15. hestia_earth/models/ipcc2019/n2OToAirExcretaIndirect.py +1 -1
  16. hestia_earth/models/ipcc2019/n2OToAirInorganicFertiliserDirect.py +1 -1
  17. hestia_earth/models/ipcc2019/n2OToAirInorganicFertiliserIndirect.py +1 -1
  18. hestia_earth/models/ipcc2019/n2OToAirOrganicFertiliserIndirect.py +1 -1
  19. hestia_earth/models/ipcc2019/organicCarbonPerHa.py +4 -6
  20. hestia_earth/models/ipcc2019/organicCarbonPerHa_tier_1_utils.py +4 -2
  21. hestia_earth/models/ipcc2019/organicCarbonPerHa_tier_2_utils.py +12 -11
  22. hestia_earth/models/ipcc2019/pastureGrass.py +40 -22
  23. hestia_earth/models/ipcc2019/pastureGrass_utils.py +43 -60
  24. hestia_earth/models/mocking/search-results.json +261 -257
  25. hestia_earth/models/schererPfister2015/utils.py +2 -2
  26. hestia_earth/models/site/brackishWater.py +1 -1
  27. hestia_earth/models/site/flowingWater.py +1 -1
  28. hestia_earth/models/site/freshWater.py +1 -1
  29. hestia_earth/models/site/management.py +29 -11
  30. hestia_earth/models/site/pre_checks/cache_sources.py +9 -13
  31. hestia_earth/models/site/salineWater.py +1 -1
  32. hestia_earth/models/stehfestBouwman2006/n2OToAirCropResidueDecompositionDirect.py +12 -2
  33. hestia_earth/models/stehfestBouwman2006/n2OToAirExcretaDirect.py +12 -2
  34. hestia_earth/models/stehfestBouwman2006/n2OToAirInorganicFertiliserDirect.py +11 -1
  35. hestia_earth/models/stehfestBouwman2006/n2OToAirOrganicFertiliserDirect.py +11 -1
  36. hestia_earth/models/stehfestBouwman2006/noxToAirCropResidueDecomposition.py +12 -2
  37. hestia_earth/models/stehfestBouwman2006/noxToAirExcreta.py +12 -2
  38. hestia_earth/models/stehfestBouwman2006/noxToAirInorganicFertiliser.py +11 -1
  39. hestia_earth/models/stehfestBouwman2006/noxToAirOrganicFertiliser.py +11 -1
  40. hestia_earth/models/stehfestBouwman2006GisImplementation/noxToAirCropResidueDecomposition.py +12 -2
  41. hestia_earth/models/stehfestBouwman2006GisImplementation/noxToAirExcreta.py +12 -2
  42. hestia_earth/models/stehfestBouwman2006GisImplementation/noxToAirInorganicFertiliser.py +11 -1
  43. hestia_earth/models/stehfestBouwman2006GisImplementation/noxToAirOrganicFertiliser.py +11 -1
  44. hestia_earth/models/utils/blank_node.py +159 -146
  45. hestia_earth/models/utils/constant.py +2 -0
  46. hestia_earth/models/utils/lookup.py +19 -6
  47. hestia_earth/models/utils/source.py +1 -1
  48. hestia_earth/models/version.py +1 -1
  49. {hestia_earth_models-0.61.8.dist-info → hestia_earth_models-0.62.1.dist-info}/METADATA +3 -3
  50. {hestia_earth_models-0.61.8.dist-info → hestia_earth_models-0.62.1.dist-info}/RECORD +64 -59
  51. tests/models/cycle/post_checks/test_otherSites.py +15 -0
  52. tests/models/cycle/pre_checks/test_otherSites.py +21 -0
  53. tests/models/cycle/product/test_economicValueShare.py +8 -0
  54. tests/models/ipcc2019/animal/test_pastureGrass.py +2 -2
  55. tests/models/ipcc2019/test_co2ToAirSoilOrganicCarbonStockChangeManagementChange.py +5 -2
  56. tests/models/ipcc2019/test_organicCarbonPerHa.py +2 -1
  57. tests/models/ipcc2019/test_pastureGrass.py +0 -16
  58. tests/models/site/pre_checks/test_cache_sources.py +6 -10
  59. tests/models/site/test_management.py +162 -2
  60. tests/models/utils/test_blank_node.py +154 -296
  61. tests/models/utils/test_lookup.py +10 -0
  62. {hestia_earth_models-0.61.8.dist-info → hestia_earth_models-0.62.1.dist-info}/LICENSE +0 -0
  63. {hestia_earth_models-0.61.8.dist-info → hestia_earth_models-0.62.1.dist-info}/WHEEL +0 -0
  64. {hestia_earth_models-0.61.8.dist-info → hestia_earth_models-0.62.1.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: float, water: float):
72
- winter_precipitation = 1 if heavy_winter_precipitation > 0 else 0.1
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'] = [100]
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'] = [1]
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
 
@@ -23,7 +23,7 @@ TERM_ID = 'freshWater'
23
23
 
24
24
  def _measurement():
25
25
  data = _new_measurement(TERM_ID)
26
- data['value'] = [100]
26
+ data['value'] = [True]
27
27
  data['methodClassification'] = MeasurementMethodClassification.MODELLED_USING_OTHER_MEASUREMENTS.value
28
28
  return data
29
29
 
@@ -1,16 +1,29 @@
1
1
  """
2
- Management node with data gap-filled data from cycles.
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
21
  from hestia_earth.utils.tools import flatten, 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 get_node_value
26
+ from hestia_earth.models.utils.blank_node import condense_nodes
14
27
  from hestia_earth.models.utils.site import related_cycles
15
28
  from . import MODEL
16
29
 
@@ -24,7 +37,8 @@ REQUIREMENTS = {
24
37
  "products": [
25
38
  {
26
39
  "@type": "Product",
27
- "term.termType": ["crop", "forage", "landCover"]
40
+ "term.termType": ["crop", "forage", "landCover"],
41
+ "units": ["% area", "boolean"]
28
42
  }
29
43
  ],
30
44
  "practices": [
@@ -35,6 +49,7 @@ REQUIREMENTS = {
35
49
  "cropResidueManagement",
36
50
  "landUseManagement"
37
51
  ],
52
+ "units": ["% area", "boolean"],
38
53
  "value": ""
39
54
  }
40
55
  ],
@@ -126,7 +141,7 @@ def _overwrite_dates(cycle: dict, values: list) -> list:
126
141
  return [v | _include(cycle, ["startDate", "endDate"]) for v in values]
127
142
 
128
143
 
129
- def _copy_item_if_exists(source: dict, keys: List[str] = None, dest: dict = None) -> dict:
144
+ def _copy_item_if_exists(source: dict, keys: list[str] = None, dest: dict = None) -> dict:
130
145
  keys = keys or []
131
146
  dest = dest or {}
132
147
  return reduce(lambda p, c: p | ({c: source[c]} if c in source else {}), keys, dest)
@@ -139,7 +154,7 @@ def _get_landCover_term_id(product: dict) -> str:
139
154
 
140
155
 
141
156
  def _get_items_with_relevant_term_type(
142
- cycles: List[dict], item_name: str, relevant_values: list, date_fill: Callable = _default_dates
157
+ cycles: list[dict], item_name: str, relevant_values: list, date_fill: callable = _default_dates
143
158
  ):
144
159
  """Get items from the list of cycles with any of the relevant values. Also adds dates if missing."""
145
160
  return flatten(
@@ -152,7 +167,7 @@ def _get_items_with_relevant_term_type(
152
167
  )
153
168
 
154
169
 
155
- def _get_lookup_with_debug(term: dict, column: str) -> Any:
170
+ def _get_lookup_with_debug(term: dict, column: str) -> any:
156
171
  get_lookup_value(term, column, model_key=MODEL_KEY, land_cover_key=LAND_COVER_KEY)
157
172
 
158
173
 
@@ -169,7 +184,7 @@ def _data_from_input(cycle: dict, term_id: str) -> dict:
169
184
  }
170
185
 
171
186
 
172
- def _process_rule(cycle, term, term_type) -> List:
187
+ def _process_rule(cycle, term, term_type) -> list:
173
188
  relevant_terms = []
174
189
  for column, condition, new_term in INPUT_RULES[term_type]:
175
190
  lookup_result = _get_lookup_with_debug(term, LOOKUPS[column])
@@ -180,7 +195,7 @@ def _process_rule(cycle, term, term_type) -> List:
180
195
  return relevant_terms
181
196
 
182
197
 
183
- def _get_relevant_inputs(cycles: List[dict]) -> List:
198
+ def _get_relevant_inputs(cycles: list[dict]) -> list:
184
199
  relevant_inputs = []
185
200
  for cycle in [c for c in cycles if "inputs" in c]:
186
201
  for i in cycle["inputs"]:
@@ -230,6 +245,8 @@ def _should_run(site: dict):
230
245
  )
231
246
  for product in list(filter(_get_landCover_term_id, products_crop_forage))
232
247
  ]
248
+ all_products = products_land_cover + products_crop_forage
249
+ all_products = condense_nodes(all_products)
233
250
 
234
251
  practices = [
235
252
  _extract_node_value(
@@ -248,6 +265,7 @@ def _should_run(site: dict):
248
265
  ]
249
266
  )
250
267
  ]
268
+ practices = condense_nodes(practices)
251
269
 
252
270
  relevant_inputs = _get_relevant_inputs(cycles)
253
271
  logRequirements(
@@ -260,9 +278,9 @@ def _should_run(site: dict):
260
278
  practice_ids=log_blank_nodes_id(practices),
261
279
  inputs=log_blank_nodes_id(relevant_inputs)
262
280
  )
263
- should_run = any(products_crop_forage + products_land_cover + practices + relevant_inputs)
281
+ should_run = any(all_products + practices + relevant_inputs)
264
282
  logShouldRun(site, MODEL, None, should_run=should_run, model_key=MODEL_KEY)
265
- return should_run, products_crop_forage + products_land_cover, practices, relevant_inputs
283
+ return should_run, all_products, practices, relevant_inputs
266
284
 
267
285
 
268
286
  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 _should_run(site: dict):
18
+ def _run(site: dict):
19
19
  sources = find_sources()
20
- has_cache = cached_value(site, CACHE_SOURCES_KEY) is not None
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
- should_run = all([
27
- not has_cache,
28
- len(sources.keys()) > 0
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, sources = _should_run(site)
30
+ should_run = _should_run(site)
35
31
  return {
36
32
  **site,
37
- CACHE_KEY: cached_value(site) | {CACHE_SOURCES_KEY: sources}
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'] = [100]
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
- should_run, N_total, content_list_of_items = _should_run(cycle, TERM_ID, TIER)
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
- should_run, N_total, content_list_of_items = _should_run(cycle, TERM_ID, TIER)
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
- should_run, N_total, content_list_of_items = _should_run(cycle, TERM_ID, TIER)
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
- should_run, N_total, content_list_of_items = _should_run(cycle, TERM_ID, TIER)
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
- should_run, ecoClimateZone, nitrogenContent, N_total = _should_run(cycle, TERM_ID, TIER)
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
- should_run, ecoClimateZone, nitrogenContent, N_total = _should_run(cycle, TERM_ID, TIER)
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
- should_run, ecoClimateZone, nitrogenContent, N_total = _should_run(cycle, TERM_ID, TIER)
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
- should_run, ecoClimateZone, nitrogenContent, N_total = _should_run(cycle, TERM_ID, TIER)
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
- 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
- should_run, country_id, N_total = _should_run(cycle, TERM_ID, TIER)
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
- should_run, country_id, N_total = _should_run(cycle, TERM_ID, TIER)
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
- should_run, country_id, N_total, *args = _should_run(cycle, TERM_ID, TIER)
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
- should_run, country_id, N_total, *args = _should_run(cycle, TERM_ID, TIER)
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 []