hestia-earth-models 0.68.0__py3-none-any.whl → 0.69.0__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.
Files changed (190) hide show
  1. hestia_earth/models/agribalyse2016/fuelElectricity.py +0 -5
  2. hestia_earth/models/agribalyse2016/machineryInfrastructureDepreciatedAmountPerCycle.py +0 -11
  3. hestia_earth/models/aware/scarcityWeightedWaterUse.py +0 -4
  4. hestia_earth/models/cache_sites.py +18 -9
  5. hestia_earth/models/cml2001Baseline/abioticResourceDepletionFossilFuels.py +0 -18
  6. hestia_earth/models/cml2001Baseline/abioticResourceDepletionMineralsAndMetals.py +0 -12
  7. hestia_earth/models/cml2001Baseline/resourceUseEnergyDepletionDuringCycle.py +0 -5
  8. hestia_earth/models/cml2001Baseline/resourceUseMineralsAndMetalsDuringCycle.py +0 -4
  9. hestia_earth/models/config/Cycle.json +23 -30
  10. hestia_earth/models/cycle/aboveGroundCropResidueTotal.py +0 -6
  11. hestia_earth/models/cycle/animal/input/hestiaAggregatedData.py +0 -8
  12. hestia_earth/models/cycle/animal/input/properties.py +0 -9
  13. hestia_earth/models/cycle/animal/milkYield.py +0 -6
  14. hestia_earth/models/cycle/animal/properties.py +0 -6
  15. hestia_earth/models/cycle/completeness/animalFeed.py +0 -6
  16. hestia_earth/models/cycle/completeness/cropResidue.py +0 -6
  17. hestia_earth/models/cycle/completeness/electricityFuel.py +0 -6
  18. hestia_earth/models/cycle/completeness/excreta.py +0 -6
  19. hestia_earth/models/cycle/completeness/freshForage.py +0 -6
  20. hestia_earth/models/cycle/completeness/material.py +0 -6
  21. hestia_earth/models/cycle/completeness/seed.py +0 -6
  22. hestia_earth/models/cycle/completeness/soilAmendment.py +0 -6
  23. hestia_earth/models/cycle/concentrateFeed.py +0 -6
  24. hestia_earth/models/cycle/cropResidueManagement.py +0 -5
  25. hestia_earth/models/cycle/cycleDuration.py +0 -8
  26. hestia_earth/models/cycle/endDate.py +0 -7
  27. hestia_earth/models/cycle/excretaKgMass.py +0 -5
  28. hestia_earth/models/cycle/excretaKgN.py +0 -5
  29. hestia_earth/models/cycle/excretaKgVs.py +0 -5
  30. hestia_earth/models/cycle/inorganicFertiliser.py +0 -6
  31. hestia_earth/models/cycle/input/hestiaAggregatedData.py +0 -13
  32. hestia_earth/models/cycle/input/properties.py +0 -9
  33. hestia_earth/models/cycle/input/value.py +0 -6
  34. hestia_earth/models/cycle/liveAnimal.py +0 -5
  35. hestia_earth/models/cycle/materialAndSubstrate.py +1 -6
  36. hestia_earth/models/cycle/milkYield.py +0 -10
  37. hestia_earth/models/cycle/otherSitesArea.py +0 -6
  38. hestia_earth/models/cycle/otherSitesUnusedDuration.py +0 -6
  39. hestia_earth/models/cycle/pastureSystem.py +0 -6
  40. hestia_earth/models/cycle/post_checks/cache.py +0 -5
  41. hestia_earth/models/cycle/post_checks/otherSites.py +0 -7
  42. hestia_earth/models/cycle/post_checks/site.py +0 -7
  43. hestia_earth/models/cycle/practice/value.py +0 -7
  44. hestia_earth/models/cycle/pre_checks/cache_sources.py +0 -5
  45. hestia_earth/models/cycle/pre_checks/otherSites.py +0 -7
  46. hestia_earth/models/cycle/pre_checks/site.py +0 -6
  47. hestia_earth/models/cycle/product/currency.py +0 -5
  48. hestia_earth/models/cycle/product/economicValueShare.py +0 -14
  49. hestia_earth/models/cycle/product/price.py +0 -5
  50. hestia_earth/models/cycle/product/primary.py +0 -5
  51. hestia_earth/models/cycle/product/properties.py +0 -7
  52. hestia_earth/models/cycle/product/revenue.py +0 -9
  53. hestia_earth/models/cycle/product/value.py +0 -6
  54. hestia_earth/models/cycle/siteArea.py +0 -6
  55. hestia_earth/models/cycle/siteDuration.py +0 -10
  56. hestia_earth/models/cycle/siteUnusedDuration.py +0 -6
  57. hestia_earth/models/cycle/startDate.py +0 -8
  58. hestia_earth/models/cycle/startDateDefinition.py +0 -6
  59. hestia_earth/models/cycle/transformation.py +0 -5
  60. hestia_earth/models/dammgen2009/noxToAirExcreta.py +2 -2
  61. hestia_earth/models/ecoinventV3/__init__.py +0 -15
  62. hestia_earth/models/ecoinventV3AndEmberClimate/__init__.py +0 -11
  63. hestia_earth/models/emepEea2019/nh3ToAirExcreta.py +14 -40
  64. hestia_earth/models/emepEea2019/pm10ToAirAnimalHousing.py +0 -4
  65. hestia_earth/models/emepEea2019/pm25ToAirAnimalHousing.py +0 -4
  66. hestia_earth/models/emepEea2019/tspToAirAnimalHousing.py +0 -4
  67. hestia_earth/models/emissionNotRelevant/__init__.py +0 -5
  68. hestia_earth/models/environmentalFootprintV3_1/environmentalFootprintSingleOverallScore.py +0 -9
  69. hestia_earth/models/environmentalFootprintV3_1/soilQualityIndexLandOccupation.py +0 -6
  70. hestia_earth/models/environmentalFootprintV3_1/soilQualityIndexLandTransformation.py +0 -6
  71. hestia_earth/models/environmentalFootprintV3_1/soilQualityIndexTotalLandUseEffects.py +0 -6
  72. hestia_earth/models/epa2014/no3ToGroundwaterExcreta.py +2 -2
  73. hestia_earth/models/faostat2018/product/price.py +0 -5
  74. hestia_earth/models/geospatialDatabase/awareWaterBasinId.py +0 -5
  75. hestia_earth/models/geospatialDatabase/ecoClimateZone.py +1 -20
  76. hestia_earth/models/geospatialDatabase/ecoregion.py +0 -7
  77. hestia_earth/models/geospatialDatabase/potentialEvapotranspirationAnnual.py +0 -4
  78. hestia_earth/models/geospatialDatabase/potentialEvapotranspirationMonthly.py +0 -4
  79. hestia_earth/models/geospatialDatabase/precipitationAnnual.py +0 -4
  80. hestia_earth/models/geospatialDatabase/precipitationMonthly.py +0 -4
  81. hestia_earth/models/geospatialDatabase/region.py +0 -5
  82. hestia_earth/models/geospatialDatabase/temperatureAnnual.py +0 -4
  83. hestia_earth/models/geospatialDatabase/temperatureMonthly.py +0 -4
  84. hestia_earth/models/haversineFormula/transport/distance.py +0 -7
  85. hestia_earth/models/hestia/landCover.py +31 -18
  86. hestia_earth/models/hestia/landTransformation100YearAverageDuringCycle.py +0 -11
  87. hestia_earth/models/hestia/landTransformation20YearAverageDuringCycle.py +0 -11
  88. hestia_earth/models/hestia/nh3ToSurfaceWaterAquacultureSystems.py +64 -0
  89. hestia_earth/models/hestia/residueRemoved.py +0 -4
  90. hestia_earth/models/hestia/resourceUse_utils.py +0 -5
  91. hestia_earth/models/hestia/seed_emissions.py +0 -13
  92. hestia_earth/models/impact_assessment/allocationMethod.py +0 -6
  93. hestia_earth/models/impact_assessment/emissions.py +0 -9
  94. hestia_earth/models/impact_assessment/irrigated.py +0 -5
  95. hestia_earth/models/impact_assessment/organic.py +0 -5
  96. hestia_earth/models/impact_assessment/post_checks/cycle.py +0 -7
  97. hestia_earth/models/impact_assessment/post_checks/site.py +0 -7
  98. hestia_earth/models/impact_assessment/pre_checks/cycle.py +0 -6
  99. hestia_earth/models/impact_assessment/pre_checks/site.py +0 -6
  100. hestia_earth/models/impact_assessment/product/economicValueShare.py +0 -6
  101. hestia_earth/models/impact_assessment/product/value.py +0 -5
  102. hestia_earth/models/ipcc2019/aboveGroundBiomass.py +9 -2
  103. hestia_earth/models/ipcc2019/animal/milkYieldPerAnimal.py +0 -6
  104. hestia_earth/models/ipcc2019/animal/pastureGrass.py +0 -10
  105. hestia_earth/models/ipcc2019/animal/weightAtMaturity.py +0 -4
  106. hestia_earth/models/ipcc2019/belowGroundBiomass.py +9 -2
  107. hestia_earth/models/ipcc2019/co2ToAirSoilOrganicCarbonStockChange.py +1 -1
  108. hestia_earth/models/ipcc2019/croppingDuration.py +0 -5
  109. hestia_earth/models/ipcc2019/n2OToAirExcretaDirect.py +1 -1
  110. hestia_earth/models/ipcc2019/no3ToGroundwaterExcreta.py +51 -15
  111. hestia_earth/models/ipcc2019/nonCo2EmissionsToAirNaturalVegetationBurning.py +0 -12
  112. hestia_earth/models/ipcc2019/organicCarbonPerHa.py +2 -15
  113. hestia_earth/models/ipcc2019/{organicCarbonPerHa_tier_1_utils.py → organicCarbonPerHa_tier_1.py} +3 -15
  114. hestia_earth/models/ipcc2019/{organicCarbonPerHa_tier_2_utils.py → organicCarbonPerHa_tier_2.py} +3 -13
  115. hestia_earth/models/ipcc2019/pastureGrass.py +0 -10
  116. hestia_earth/models/koble2014/aboveGroundCropResidue.py +0 -9
  117. hestia_earth/models/koble2014/cropResidueManagement.py +0 -6
  118. hestia_earth/models/linkedImpactAssessment/emissions.py +0 -5
  119. hestia_earth/models/mocking/search-results.json +1241 -1185
  120. hestia_earth/models/pooreNemecek2018/ch4ToAirAquacultureSystems.py +14 -15
  121. hestia_earth/models/pooreNemecek2018/excretaKgN.py +12 -17
  122. hestia_earth/models/pooreNemecek2018/excretaKgVs.py +22 -23
  123. hestia_earth/models/pooreNemecek2018/n2OToAirAquacultureSystemsDirect.py +6 -9
  124. hestia_earth/models/pooreNemecek2018/n2ToAirAquacultureSystems.py +6 -9
  125. hestia_earth/models/pooreNemecek2018/nh3ToAirAquacultureSystems.py +11 -15
  126. hestia_earth/models/pooreNemecek2018/noxToAirAquacultureSystems.py +6 -9
  127. hestia_earth/models/site/defaultMethodClassification.py +0 -7
  128. hestia_earth/models/site/defaultMethodClassificationDescription.py +0 -7
  129. hestia_earth/models/site/flowingWater.py +0 -5
  130. hestia_earth/models/site/management.py +0 -21
  131. hestia_earth/models/site/measurement/value.py +0 -6
  132. hestia_earth/models/site/post_checks/country.py +0 -5
  133. hestia_earth/models/site/potentialEvapotranspirationAnnual.py +0 -3
  134. hestia_earth/models/site/potentialEvapotranspirationMonthly.py +0 -3
  135. hestia_earth/models/site/pre_checks/cache_geospatialDatabase.py +0 -5
  136. hestia_earth/models/site/pre_checks/cache_sources.py +0 -5
  137. hestia_earth/models/site/pre_checks/cache_years.py +0 -5
  138. hestia_earth/models/site/pre_checks/country.py +0 -5
  139. hestia_earth/models/site/precipitationAnnual.py +0 -3
  140. hestia_earth/models/site/precipitationMonthly.py +0 -3
  141. hestia_earth/models/site/rainfallAnnual.py +0 -3
  142. hestia_earth/models/site/rainfallMonthly.py +0 -3
  143. hestia_earth/models/site/soilMeasurement.py +2 -5
  144. hestia_earth/models/site/temperatureAnnual.py +0 -3
  145. hestia_earth/models/site/temperatureMonthly.py +0 -3
  146. hestia_earth/models/transformation/input/excreta.py +0 -5
  147. hestia_earth/models/transformation/input/max.py +0 -8
  148. hestia_earth/models/transformation/input/min.py +0 -8
  149. hestia_earth/models/transformation/input/properties.py +0 -6
  150. hestia_earth/models/transformation/input/sd.py +0 -8
  151. hestia_earth/models/transformation/input/value.py +0 -8
  152. hestia_earth/models/transformation/product/excreta.py +0 -7
  153. hestia_earth/models/utils/excretaManagement.py +37 -0
  154. hestia_earth/models/utils/lookup.py +2 -0
  155. hestia_earth/models/utils/measurement.py +1 -1
  156. hestia_earth/models/utils/practice.py +1 -27
  157. hestia_earth/models/utils/source.py +29 -9
  158. hestia_earth/models/version.py +1 -1
  159. hestia_earth/orchestrator/strategies/run/add_blank_node_if_missing.py +12 -8
  160. {hestia_earth_models-0.68.0.dist-info → hestia_earth_models-0.69.0.dist-info}/METADATA +2 -2
  161. {hestia_earth_models-0.68.0.dist-info → hestia_earth_models-0.69.0.dist-info}/RECORD +180 -188
  162. tests/models/emepEea2019/test_nh3ToAirExcreta.py +6 -17
  163. tests/models/hestia/test_nh3ToSurfaceWaterAquacultureSystems.py +51 -0
  164. tests/models/ipcc2019/test_aboveGroundBiomass.py +4 -0
  165. tests/models/ipcc2019/test_belowGroundBiomass.py +4 -0
  166. tests/models/ipcc2019/test_co2ToAirSoilOrganicCarbonStockChange.py +1 -1
  167. tests/models/ipcc2019/test_no3ToGroundwaterExcreta.py +24 -9
  168. tests/models/ipcc2019/test_organicCarbonPerHa.py +2 -2
  169. tests/models/ipcc2019/{test_organicCarbonPerHa_tier_1_utils.py → test_organicCarbonPerHa_tier_1.py} +2 -2
  170. tests/models/ipcc2019/{test_organicCarbonPerHa_tier_2_utils.py → test_organicCarbonPerHa_tier_2.py} +2 -2
  171. tests/models/pooreNemecek2018/test_ch4ToAirAquacultureSystems.py +1 -7
  172. tests/models/pooreNemecek2018/test_n2OToAirAquacultureSystemsDirect.py +1 -7
  173. tests/models/pooreNemecek2018/test_n2ToAirAquacultureSystems.py +1 -7
  174. tests/models/pooreNemecek2018/test_nh3ToAirAquacultureSystems.py +1 -7
  175. tests/models/pooreNemecek2018/test_noxToAirAquacultureSystems.py +1 -7
  176. tests/models/utils/test_source.py +6 -1
  177. tests/orchestrator/strategies/run/test_add_blank_node_if_missing.py +1 -1
  178. hestia_earth/models/blonkConsultants2016/__init__.py +0 -13
  179. hestia_earth/models/blonkConsultants2016/ch4ToAirNaturalVegetationBurning.py +0 -78
  180. hestia_earth/models/blonkConsultants2016/co2ToAirAboveGroundBiomassStockChangeLandUseChange.py +0 -78
  181. hestia_earth/models/blonkConsultants2016/n2OToAirNaturalVegetationBurningDirect.py +0 -78
  182. hestia_earth/models/blonkConsultants2016/utils.py +0 -30
  183. tests/models/blonkConsultants2016/__init__.py +0 -0
  184. tests/models/blonkConsultants2016/test_ch4ToAirNaturalVegetationBurning.py +0 -34
  185. tests/models/blonkConsultants2016/test_co2ToAirAboveGroundBiomassStockChangeLandUseChange.py +0 -36
  186. tests/models/blonkConsultants2016/test_n2OToAirNaturalVegetationBurningDirect.py +0 -34
  187. tests/models/blonkConsultants2016/test_utils.py +0 -9
  188. {hestia_earth_models-0.68.0.dist-info → hestia_earth_models-0.69.0.dist-info}/LICENSE +0 -0
  189. {hestia_earth_models-0.68.0.dist-info → hestia_earth_models-0.69.0.dist-info}/WHEEL +0 -0
  190. {hestia_earth_models-0.68.0.dist-info → hestia_earth_models-0.69.0.dist-info}/top_level.txt +0 -0
@@ -1,8 +1,3 @@
1
- """
2
- Fuel and Electricity
3
-
4
- This model calculates fuel and electricity data from the number of hours each machine is used for.
5
- """
6
1
  from hestia_earth.schema import TermTermType
7
2
  from hestia_earth.utils.model import filter_list_term_type
8
3
  from hestia_earth.utils.tools import flatten, list_sum, non_empty_list
@@ -1,14 +1,3 @@
1
- """
2
- Machinery gradually depreciates over multiple production Cycles until it reaches the
3
- [end of its life](https://hestia.earth/schema/Infrastructure#endDate).
4
- As a rough rule, the more the machinery is used, the faster it depreciates.
5
- Machinery use can be proxied for by the amount of fuel used.
6
- From 139 processes in [AGRIBALYSE](https://agribalyse.ademe.fr/), the ratio of machinery depreciated per unit of
7
- fuel consumed (kg machinery kg diesel–1) was established.
8
- Recognizing that farms in less developed countries have poorer access to capital and maintain farm machinery for longer,
9
- the machinery-to-diesel ratio was doubled in countries with a [Human Development Index](http://hdr.undp.org/en/data)
10
- of less than 0.8.
11
- """
12
1
  from hestia_earth.utils.tools import list_sum, flatten
13
2
 
14
3
  from hestia_earth.models.log import logRequirements, logShouldRun, debugValues, log_as_table
@@ -1,7 +1,3 @@
1
- """
2
- This model calculates the scarcity weighted water use based on the geospatial AWARE model
3
- (see UNEP (2016); Boulay et al (2016); Boulay et al (2020); EC-JRC (2017)).
4
- """
5
1
  from hestia_earth.schema import SiteSiteType
6
2
  from hestia_earth.utils.lookup import download_lookup, _get_single_table_value, column_name
7
3
  from hestia_earth.utils.tools import safe_parse_float
@@ -80,7 +80,7 @@ def _run_values(
80
80
  site_cache = merge(
81
81
  site.get(CACHE_KEY, {}),
82
82
  {CACHE_GEOSPATIAL_KEY: cached_data},
83
- ({CACHE_YEARS_KEY: cached_value(site, CACHE_YEARS_KEY, []) + years} if years else {})
83
+ ({CACHE_YEARS_KEY: list(set(cached_value(site, CACHE_YEARS_KEY, []) + years))} if years else {})
84
84
  )
85
85
  return merge(site, {CACHE_KEY: site_cache})
86
86
 
@@ -137,6 +137,17 @@ def _run(sites: list, years: list = [], years_only: bool = False):
137
137
  ] + _run_values(sites_no_run, years=years))
138
138
 
139
139
 
140
+ def _run_by_years(sites: list, years: list, batch_size: int):
141
+ batches = range(0, len(years), batch_size)
142
+
143
+ for batch_index in batches:
144
+ logger.info(f"Processing sites in batch {batch_index + 1} of {len(batches)}...")
145
+ sub_years = years[batch_index:batch_index + batch_size]
146
+ sites = _run(sites, sub_years, years_only=True)
147
+
148
+ return sites
149
+
150
+
140
151
  def run(sites: list, years: list = None):
141
152
  """
142
153
  Run all queries at once for the list of provided Sites.
@@ -153,12 +164,10 @@ def run(sites: list, years: list = None):
153
164
 
154
165
  # avoid memory limit errors by running only a few years at a time
155
166
  unique_years = sorted(list(set(years)))
156
- batch_size = 5
157
- batches = range(0, len(unique_years), batch_size)
158
-
159
- for batch_index in batches:
160
- logger.info(f"Processing sites in batch {batch_index + 1} of {len(batches)}...")
161
- sub_years = unique_years[batch_index:batch_index + batch_size]
162
- sites = _run(sites, sub_years, years_only=True)
163
167
 
164
- return sites
168
+ try:
169
+ return _run_by_years(sites, unique_years, batch_size=5)
170
+ except Exception as e:
171
+ if 'exceeded' in str(e):
172
+ return _run_by_years(sites, unique_years, batch_size=1)
173
+ raise e
@@ -1,21 +1,3 @@
1
- """
2
- This model calculates the abiotic resource depletion, fossil fuels. Based on the models CML 2002 (Guinée et al., 2002)
3
- and van Oers et al. 2002 (method, v.4.8)
4
-
5
- > The earth contains a finite amount of non-renewable resources, such as fossil fuels like coal, oil and gas.
6
- The basic idea behind this impact category is that extracting resources today will force future generations to extract
7
- less or different resources. For example, the depletion of V2.0 – 25th August 2023 28 fossil fuels may lead to the
8
- non-availability of fossil fuels for future generations. The amount of materials contributing to resource use, fossils,
9
- are converted into MJ.
10
-
11
- Source : [Life Cycle Assessment & the EF methods - Comprehensive coverage of impacts](https://green-business.ec.europa.eu/environmental-footprint-methods/life-cycle-assessment-ef-methods_en)
12
-
13
- The model accepts any non-renewable energy term in MegaJoules, or that has been converted to MegaJoules.
14
-
15
- Source: [JRC Technical reports Suggestions for updating the Product Environmental Footprint (PEF) method](https://eplca.jrc.ec.europa.eu/permalink/PEF_method.pdf#%5B%7B%22num%22%3A80%2C%22gen%22%3A0%7D%2C%7B%22name%22%3A%22XYZ%22%7D%2C68%2C363%2C0%5D)
16
-
17
- Source: [Differences between EF model versions](https://eplca.jrc.ec.europa.eu/EFVersioning.html)
18
- """ # noqa: E501
19
1
  from itertools import chain
20
2
  from hestia_earth.utils.lookup import download_lookup, column_name, find_term_ids_by
21
3
  from hestia_earth.utils.tools import list_sum, flatten
@@ -1,15 +1,3 @@
1
- """
2
- Calculates the EU PEF Abiotic resource depletion, for minerals and metals Indicator
3
-
4
- Uses lookup factors from [eplca.jrc.ec.europa.eu](https://eplca.jrc.ec.europa.eu/permalink/EF3_1/EF-LCIAMethod_CF(EF-v3.1).xlsx), Accessed 2024-09-05.
5
-
6
- > The results of this impact category shall be interpreted with caution, because the results of ADP after
7
- > normalization may be overestimated. The European Commission intends to develop a new method moving
8
- > from depletion to dissipation model to better quantify the potential for conservation of resources
9
-
10
- Source: [JRC Technical reports Suggestions for updating the Product Environmental Footprint (PEF) method](https://eplca.jrc.ec.europa.eu/permalink/PEF_method.pdf#%5B%7B%22num%22%3A80%2C%22gen%22%3A0%7D%2C%7B%22name%22%3A%22XYZ%22%7D%2C68%2C363%2C0%5D)
11
- """ # noqa: E501
12
-
13
1
  from hestia_earth.schema import TermTermType
14
2
  from hestia_earth.utils.lookup import get_table_value, download_lookup, column_name
15
3
  from hestia_earth.utils.model import filter_list_term_type
@@ -1,8 +1,3 @@
1
- """
2
- This model converts all "energy" terms found in a `Cycle > Inputs` to `MJ` using optional
3
- `energyContentLowerHeatingValue` and `density` properties or the term's "defaultProperties",
4
- aggregates them, and places them inside a 'resourceUseEnergyDepletionDuringCycle' indicator per aggregated input id.
5
- """
6
1
  from collections import defaultdict
7
2
  from itertools import groupby
8
3
  from typing import Tuple, Optional
@@ -1,7 +1,3 @@
1
- """
2
- This model converts most abiotic resources terms found in a `Cycle > Inputs`, aggregates them,
3
- and converts them to one indicator per input.
4
- """
5
1
  from collections import defaultdict
6
2
  from itertools import groupby
7
3
  from typing import Tuple
@@ -549,6 +549,14 @@
549
549
  "mergeStrategy": "list",
550
550
  "stage": 2
551
551
  },
552
+ {
553
+ "key": "animals",
554
+ "model": "cycle",
555
+ "value": "animal.properties",
556
+ "runStrategy": "always",
557
+ "mergeStrategy": "list",
558
+ "stage": 2
559
+ },
552
560
  [
553
561
  {
554
562
  "key": "products",
@@ -1808,36 +1816,6 @@
1808
1816
  },
1809
1817
  "stage": 2
1810
1818
  },
1811
- {
1812
- "key": "emissions",
1813
- "model": "blonkConsultants2016",
1814
- "value": "ch4ToAirNaturalVegetationBurning",
1815
- "runStrategy": "add_blank_node_if_missing",
1816
- "runArgs": {
1817
- "runNonMeasured": true,
1818
- "runNonAddedTerm": true
1819
- },
1820
- "mergeStrategy": "list",
1821
- "mergeArgs": {
1822
- "replaceThreshold": ["value", 0.01]
1823
- },
1824
- "stage": 2
1825
- },
1826
- {
1827
- "key": "emissions",
1828
- "model": "blonkConsultants2016",
1829
- "value": "n2OToAirNaturalVegetationBurningDirect",
1830
- "runStrategy": "add_blank_node_if_missing",
1831
- "runArgs": {
1832
- "runNonMeasured": true,
1833
- "runNonAddedTerm": true
1834
- },
1835
- "mergeStrategy": "list",
1836
- "mergeArgs": {
1837
- "replaceThreshold": ["value", 0.01]
1838
- },
1839
- "stage": 2
1840
- },
1841
1819
  {
1842
1820
  "key": "emissions",
1843
1821
  "model": "ipcc2019",
@@ -2163,6 +2141,21 @@
2163
2141
  "replaceThreshold": ["value", 0.01]
2164
2142
  },
2165
2143
  "stage": 2
2144
+ },
2145
+ {
2146
+ "key": "emissions",
2147
+ "model": "hestia",
2148
+ "value": "nh3ToSurfaceWaterAquacultureSystems",
2149
+ "runStrategy": "add_blank_node_if_missing",
2150
+ "runArgs": {
2151
+ "runNonMeasured": true,
2152
+ "runNonAddedTerm": true
2153
+ },
2154
+ "mergeStrategy": "list",
2155
+ "mergeArgs": {
2156
+ "replaceThreshold": ["value", 0.01]
2157
+ },
2158
+ "stage": 2
2166
2159
  }
2167
2160
  ],
2168
2161
  {
@@ -1,9 +1,3 @@
1
- """
2
- This model gap-fills the amount of above ground crop residue total if any matching management practice
3
- and crop residue products are provided. Examples:
4
- - if `residueLeftOnField` = `50%` and `aboveGroundCropResidueLeftOnField` = `1000kg`, the total is `2000kg`;
5
- - if `residueLeftOnField` = `100%` and `aboveGroundCropResidueLeftOnField` = `1000kg`, the total is `1000kg`.
6
- """
7
1
  from hestia_earth.schema import TermTermType
8
2
  from hestia_earth.utils.model import filter_list_term_type, find_term_match
9
3
  from hestia_earth.utils.tools import list_sum, non_empty_list
@@ -1,11 +1,3 @@
1
- """
2
- Animal Input HESTIA Aggregated Data
3
-
4
- This model adds `impactAssessment` to Animal inputs based on data which has been aggregated into country level averages.
5
- Note: to get more accurate impacts, we recommend setting the
6
- [input.impactAssessment](https://hestia.earth/schema/Input#impactAssessment)
7
- instead of the region-level averages using this model.
8
- """
9
1
  from hestia_earth.models.log import logRequirements, logShouldRun
10
2
  from hestia_earth.models.utils.aggregated import should_link_input_to_impact, link_inputs_to_impact
11
3
 
@@ -1,12 +1,3 @@
1
- """
2
- Input Properties
3
-
4
- This model handles multiple cases:
5
- - when the [impactAssessment](https://hestia.earth/schema/Input#impactAssessment) field is set, the model
6
- adds properties to the `Input` when they are connected to another `Cycle` that has an indentical `Product`;
7
- - when the `dryMatter` property is set, the model recalculates the other properties based on the data from feedipedia;
8
- - when the `min` and `max` are set, the model averages the `value`.
9
- """
10
1
  from hestia_earth.schema import SchemaType
11
2
  from hestia_earth.utils.model import find_term_match
12
3
 
@@ -1,9 +1,3 @@
1
- """
2
- Milk Yield
3
-
4
- This model gap-fills the practice "Milk yield per animal X (raw/FPCM)" (e.g. `Milk yield per cow (raw)`) when
5
- the practice is added to the Cycle itself, and we can match it with the `term` of an Animal blank node.
6
- """
7
1
  from hestia_earth.schema import TermTermType
8
2
  from hestia_earth.utils.model import filter_list_term_type
9
3
  from hestia_earth.utils.tools import non_empty_list
@@ -1,9 +1,3 @@
1
- """
2
- Animal Properties
3
-
4
- This model handles multiple cases:
5
- - when the `min` and `max` are set, the model averages the `value`.
6
- """
7
1
  from ..utils import average_blank_node_properties_value
8
2
 
9
3
  REQUIREMENTS = {
@@ -1,9 +1,3 @@
1
- """
2
- Completeness Animal feed
3
-
4
- This model checks if we have the requirements below and updates the
5
- [Data Completeness](https://hestia.earth/schema/Completeness#animalFeed) value.
6
- """
7
1
  from hestia_earth.schema import SiteSiteType
8
2
 
9
3
  from hestia_earth.models.log import logRequirements
@@ -1,9 +1,3 @@
1
- """
2
- Completeness Crop Residue
3
-
4
- This model checks if we have the requirements below and updates the
5
- [Data Completeness](https://hestia.earth/schema/Completeness#cropResidue) value.
6
- """
7
1
  from hestia_earth.utils.model import find_term_match
8
2
  from hestia_earth.utils.tools import list_sum
9
3
 
@@ -1,9 +1,3 @@
1
- """
2
- Completeness Electricity Fuel
3
-
4
- This model checks if we have the requirements below and updates the
5
- [Data Completeness](https://hestia.earth/schema/Completeness#electricityFuel) value.
6
- """
7
1
  from hestia_earth.schema import TermTermType
8
2
  from hestia_earth.utils.model import filter_list_term_type
9
3
 
@@ -1,9 +1,3 @@
1
- """
2
- Completeness Excreta
3
-
4
- This model checks if we have the requirements below and updates the
5
- [Data Completeness](https://hestia.earth/schema/Completeness#excreta) value.
6
- """
7
1
  from hestia_earth.schema import SiteSiteType
8
2
 
9
3
  from hestia_earth.models.log import logRequirements
@@ -1,9 +1,3 @@
1
- """
2
- Completeness Fresh Forage
3
-
4
- This model checks if we have the requirements below and updates the
5
- [Data Completeness](https://hestia.earth/schema/Completeness#cropResidue) value.
6
- """
7
1
  from hestia_earth.schema import SiteSiteType, TermTermType
8
2
  from hestia_earth.utils.model import filter_list_term_type
9
3
  from hestia_earth.utils.tools import list_sum
@@ -1,9 +1,3 @@
1
- """
2
- Completeness Material
3
-
4
- This model checks if we have the requirements below and updates the
5
- [Data Completeness](https://hestia.earth/schema/Completeness#material) value.
6
- """
7
1
  from hestia_earth.schema import SiteSiteType
8
2
  from hestia_earth.utils.model import find_term_match
9
3
 
@@ -1,9 +1,3 @@
1
- """
2
- Completeness Seed
3
-
4
- This model checks if we have the requirements below and updates the
5
- [Data Completeness](https://hestia.earth/schema/Completeness#seed) value.
6
- """
7
1
  from hestia_earth.schema import SiteSiteType
8
2
  from hestia_earth.utils.model import find_term_match, find_primary_product
9
3
 
@@ -1,9 +1,3 @@
1
- """
2
- Completeness Soil Amendments
3
-
4
- This model checks if we have the requirements below and updates the
5
- [Data Completeness](https://hestia.earth/schema/Completeness#soilAmendment) value.
6
- """
7
1
  from hestia_earth.models.log import logRequirements
8
2
  from hestia_earth.models.utils import is_from_model
9
3
  from hestia_earth.models.utils.measurement import measurement_value
@@ -1,9 +1,3 @@
1
- """
2
- Concentrate feed Properties
3
-
4
- This model calculates all of the nutrient content values and dry matter values for a feed blend
5
- if we know the crops that went into the blend by taking a weighted average.
6
- """
7
1
  from hestia_earth.schema import TermTermType
8
2
  from hestia_earth.utils.model import find_primary_product
9
3
  from hestia_earth.utils.tools import list_sum, non_empty_list, flatten
@@ -1,8 +1,3 @@
1
- """
2
- Crop Residue Management
3
-
4
- This model gap-fills `cropResidueManagement` practices to `0` when there are existing ones that sum up to `100%`.
5
- """
6
1
  from hestia_earth.schema import TermTermType
7
2
  from hestia_earth.utils.model import filter_list_term_type
8
3
  from hestia_earth.utils.tools import list_sum, flatten
@@ -1,11 +1,3 @@
1
- """
2
- Cycle duration
3
-
4
- This model calculates the cycle duration using:
5
- * the `endDate` and the `startDate` if both are provided with a day precision;
6
- * for temporary crops, using the `croppingIntensity` if provided;
7
- * for permanent crops, the duration is set to `365`.
8
- """
9
1
  from hestia_earth.schema import TermTermType
10
2
  from hestia_earth.utils.model import find_term_match, find_primary_product
11
3
  from hestia_earth.utils.date import diff_in_days
@@ -1,10 +1,3 @@
1
- """
2
- End Date
3
-
4
- This model sets the [Cycle endDate](https://hestia.earth/schema/Cycle#endDate) based on:
5
- * if no `cycleDuration` is provided, and the `endDate` is set to month precision (e.g., `2000-01`),
6
- assumed it ended on the 14th of the month.
7
- """
8
1
  from hestia_earth.utils.date import is_in_months
9
2
 
10
3
  from hestia_earth.models.log import logRequirements, logShouldRun
@@ -1,8 +1,3 @@
1
- """
2
- Excreta (kg)
3
-
4
- This model calculates the amount of excreta in `kg` based on the amount of excreta in `kg N` or `kg Vs`.
5
- """
6
1
  from hestia_earth.schema import NodeType, TermTermType
7
2
  from hestia_earth.utils.model import filter_list_term_type, find_term_match
8
3
  from hestia_earth.utils.tools import non_empty_list, list_sum
@@ -1,8 +1,3 @@
1
- """
2
- Excreta (kg N)
3
-
4
- This model calculates the amount of excreta in `kg N` based on the amount of excreta in `kg`.
5
- """
6
1
  from hestia_earth.schema import NodeType, TermTermType
7
2
  from hestia_earth.utils.model import filter_list_term_type, find_term_match
8
3
  from hestia_earth.utils.tools import non_empty_list
@@ -1,8 +1,3 @@
1
- """
2
- Excreta (kg VS)
3
-
4
- This model calculates the amount of excreta in `kg VS` based on the amount of excreta in `kg`.
5
- """
6
1
  from hestia_earth.schema import NodeType, TermTermType
7
2
  from hestia_earth.utils.model import filter_list_term_type, find_term_match
8
3
  from hestia_earth.utils.tools import non_empty_list
@@ -1,9 +1,3 @@
1
- """
2
- Inorganic Fertiliser
3
-
4
- This model calculates the amount of other nutrient(s) supplied by multi-nutrients inorganic fertilisers when only
5
- the amount of one of the nutrients is recorded by the user.
6
- """
7
1
  from hestia_earth.schema import InputStatsDefinition, TermTermType
8
2
  from hestia_earth.utils.model import filter_list_term_type, find_term_match
9
3
  from hestia_earth.utils.tools import flatten, non_empty_list, safe_parse_float, list_sum
@@ -1,16 +1,3 @@
1
- """
2
- Input HESTIA Aggregated Data
3
-
4
- This model adds `impactAssessment` to inputs based on data which has been aggregated into country level averages.
5
- Note: to get more accurate impacts, we recommend setting the
6
- [input.impactAssessment](https://hestia.earth/schema/Input#impactAssessment)
7
- instead of the region-level averages using this model.
8
-
9
- For `seed` inputs, we will match ImpactAssessment in the following order of priority:
10
- - match using the value from the lookup `linkedImpactAssessmentTermId`;
11
- - match using the primary crop product;
12
- - match using the "generic" crop product term.
13
- """
14
1
  from hestia_earth.schema import TermTermType
15
2
  from hestia_earth.utils.api import download_hestia
16
3
  from hestia_earth.utils.model import find_primary_product, linked_node, filter_list_term_type
@@ -1,12 +1,3 @@
1
- """
2
- Input Properties
3
-
4
- This model handles multiple cases:
5
- - when the [impactAssessment](https://hestia.earth/schema/Input#impactAssessment) field is set, the model
6
- adds properties to the `Input` when they are connected to another `Cycle` that has an indentical `Product`;
7
- - when the `dryMatter` property is set, the model recalculates the other properties based on the data from feedipedia;
8
- - when the `min` and `max` are set, the model averages the `value`.
9
- """
10
1
  from hestia_earth.schema import SchemaType
11
2
  from hestia_earth.utils.model import find_term_match
12
3
 
@@ -1,9 +1,3 @@
1
- """
2
- Input Value
3
-
4
- This model calculates the `value` of the [Input](https://hestia.earth/schema/Input)
5
- by taking an average from the `min` and `max` values.
6
- """
7
1
  from hestia_earth.utils.tools import non_empty_list, list_average
8
2
 
9
3
  from hestia_earth.models.log import logShouldRun, logRequirements
@@ -1,8 +1,3 @@
1
- """
2
- Live Animal
3
-
4
- This model calculates the amount of live animal produced during a Cycle, based on the amount of animal product.
5
- """
6
1
  from hestia_earth.schema import TermTermType, SiteSiteType
7
2
  from hestia_earth.utils.model import find_primary_product, find_term_match
8
3
  from hestia_earth.utils.tools import list_sum, safe_parse_float
@@ -1,8 +1,3 @@
1
- """
2
- Material and Substrate
3
-
4
- This model gap-fills depreciated amount per Cycle from Site Infrastructure node.
5
- """
6
1
  from typing import Union
7
2
  from hestia_earth.schema import TermTermType
8
3
  from hestia_earth.utils.lookup import download_lookup, lookup_term_ids
@@ -108,7 +103,7 @@ def _should_run_input(cycle: dict, input_node: dict) -> bool:
108
103
  term = input_node.get('term', {})
109
104
  term_id = term.get('@id')
110
105
  has_lifespan = input_node.get('lifespan') or 0 > 0
111
- has_valid_value = _get_value(input_node, 'value') > 0
106
+ has_valid_value = _get_value(input_node, 'value') or 0 > 0
112
107
  has_depreciated_term = _has_depreciated_term(term)
113
108
 
114
109
  should_run = all([
@@ -1,13 +1,3 @@
1
- """
2
- Milk Yield
3
-
4
- This model gap-fills the practice "Milk yield per animal X (raw/FPCM)" (e.g. `Milk yield per cow (raw)`) when:
5
-
6
- 1. The corresponding milk term in the animalProduct glossary (e.g. Milk, cow, raw) is added as a Product of the Cycle;
7
- 2. The number of lactating animals is known.
8
-
9
- It also adds the properties of the Product to the gap-filled Practice.
10
- """
11
1
  from hestia_earth.schema import TermTermType, SiteSiteType, PracticeStatsDefinition
12
2
  from hestia_earth.utils.model import filter_list_term_type, find_term_match
13
3
  from hestia_earth.utils.tools import list_sum
@@ -1,9 +1,3 @@
1
- """
2
- Other Sites Area
3
-
4
- For animal production cycles, use the `stockingDensityAnimalHousingAverage` to calculate the average area required
5
- for all animals.
6
- """
7
1
  from hestia_earth.schema import SiteSiteType
8
2
 
9
3
  from .siteArea import _is_site_valid, _should_run as _should_run_site, _run
@@ -1,9 +1,3 @@
1
- """
2
- Other Sites Unused Duration
3
-
4
- This model sets the [Cycle otherSitesUnusedDuration](https://hestia.earth/schema/Cycle#otherSitesUnusedDuration)
5
- based on the `otherSites`, `otherSitesDuration`, and the `longFallowRatio` practice associated with each.
6
- """
7
1
  from hestia_earth.schema import SiteSiteType
8
2
  from hestia_earth.utils.tools import list_sum
9
3
 
@@ -1,9 +1,3 @@
1
- """
2
- Pasture System
3
-
4
- This model returns a default Pasture system when none if provided, for any cycle hapenning on `permanent pasture`.
5
- When the slope is above 2.5%, we assume it is a hilly system.
6
- """
7
1
  from hestia_earth.schema import TermTermType, SiteSiteType
8
2
  from hestia_earth.utils.model import find_primary_product, find_term_match
9
3
 
@@ -1,8 +1,3 @@
1
- """
2
- Post Checks Cache
3
-
4
- This model removes any cached data on the Cycle.
5
- """
6
1
  from hestia_earth.models.utils import CACHE_KEY
7
2
 
8
3
  REQUIREMENTS = {
@@ -1,10 +1,3 @@
1
- """
2
- Post Checks Other Sites
3
-
4
- This model is run only if the [pre model](../pre_checks/cycle.md) has been run before.
5
- This model will restore the `cycle.otherSites` as a list of "linked node"
6
- (i.e. it will be set with only `@type`, `@id` and `name` keys).
7
- """
8
1
  from hestia_earth.utils.model import linked_node
9
2
 
10
3
  REQUIREMENTS = {
@@ -1,10 +1,3 @@
1
- """
2
- Post Checks Site
3
-
4
- This model is run only if the [pre model](../pre_checks/cycle.md) has been run before.
5
- This model will restore the `cycle.site` as a "linked node"
6
- (i.e. it will be set with only `@type`, `@id` and `name` keys).
7
- """
8
1
  from hestia_earth.utils.model import linked_node
9
2
 
10
3
  REQUIREMENTS = {
@@ -1,10 +1,3 @@
1
- """
2
- Practice Value
3
-
4
- This model uses the lookup called "defaultValue" on each Practice to gap-fill a default value.
5
- Otherwise, it calculates the `value` of the [Practice](https://hestia.earth/schema/Practice)
6
- by taking an average from the `min` and `max` values.
7
- """
8
1
  from hestia_earth.utils.tools import non_empty_list, list_average
9
2
 
10
3
  from hestia_earth.models.log import logRequirements, logShouldRun
@@ -1,8 +1,3 @@
1
- """
2
- Pre Checks Cache Sources
3
-
4
- This model caches the sources of all Cycle models.
5
- """
6
1
  from hestia_earth.models.utils.cache_sources import cache_sources
7
2
 
8
3
  REQUIREMENTS = {
@@ -1,10 +1,3 @@
1
- """
2
- Pre Checks Other Sites
3
-
4
- Some Cycle models need a full version of the linked [Site](https://hestia.earth/schema/Site) to run.
5
- This model will fetch the complete version of the [Cycle Sites](https://hestia.earth/schema/Cycle#otherSites)
6
- and include them.
7
- """
8
1
  from hestia_earth.schema import SchemaType
9
2
 
10
3
  from hestia_earth.models.utils import _load_calculated_node
@@ -1,9 +1,3 @@
1
- """
2
- Pre Checks Site
3
-
4
- Some Cycle models need a full version of the linked [Site](https://hestia.earth/schema/Site) to run.
5
- This model will fetch the complete version of the [Cycle Site](https://hestia.earth/schema/Cycle#site) and include it.
6
- """
7
1
  from hestia_earth.schema import SchemaType
8
2
 
9
3
  from hestia_earth.models.utils import _load_calculated_node