hestia-earth-models 0.67.1__py3-none-any.whl → 0.68.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.
Files changed (148) hide show
  1. hestia_earth/models/aware/scarcityWeightedWaterUse.py +5 -6
  2. hestia_earth/models/blonkConsultants2016/ch4ToAirNaturalVegetationBurning.py +1 -1
  3. hestia_earth/models/blonkConsultants2016/co2ToAirAboveGroundBiomassStockChangeLandUseChange.py +1 -1
  4. hestia_earth/models/blonkConsultants2016/n2OToAirNaturalVegetationBurningDirect.py +1 -1
  5. hestia_earth/models/blonkConsultants2016/utils.py +9 -9
  6. hestia_earth/models/cache_sites.py +44 -23
  7. hestia_earth/models/chaudharyBrooks2018/damageToTerrestrialEcosystemsLandOccupation.py +2 -2
  8. hestia_earth/models/chaudharyBrooks2018/damageToTerrestrialEcosystemsLandTransformation.py +2 -2
  9. hestia_earth/models/chaudharyBrooks2018/utils.py +13 -8
  10. hestia_earth/models/cml2001Baseline/abioticResourceDepletionFossilFuels.py +2 -3
  11. hestia_earth/models/cml2001Baseline/abioticResourceDepletionMineralsAndMetals.py +1 -1
  12. hestia_earth/models/config/Cycle.json +15 -0
  13. hestia_earth/models/config/ImpactAssessment.json +14 -1
  14. hestia_earth/models/config/Site.json +8 -0
  15. hestia_earth/models/cycle/excretaKgMass.py +2 -2
  16. hestia_earth/models/cycle/materialAndSubstrate.py +3 -2
  17. hestia_earth/models/cycle/pastureGrass.py +3 -3
  18. hestia_earth/models/dammgen2009/noxToAirExcreta.py +1 -1
  19. hestia_earth/models/ecoinventV3AndEmberClimate/__init__.py +1 -1
  20. hestia_earth/models/ecoinventV3AndEmberClimate/utils.py +2 -6
  21. hestia_earth/models/emissionNotRelevant/__init__.py +4 -4
  22. hestia_earth/models/environmentalFootprintV3_1/environmentalFootprintSingleOverallScore.py +30 -21
  23. hestia_earth/models/environmentalFootprintV3_1/photochemicalOzoneCreationPotentialHumanHealthNmvocEq.py +36 -0
  24. hestia_earth/models/environmentalFootprintV3_1/scarcityWeightedWaterUse.py +2 -2
  25. hestia_earth/models/environmentalFootprintV3_1/soilQualityIndexLandOccupation.py +9 -8
  26. hestia_earth/models/environmentalFootprintV3_1/soilQualityIndexLandTransformation.py +25 -22
  27. hestia_earth/models/environmentalFootprintV3_1/soilQualityIndexTotalLandUseEffects.py +7 -6
  28. hestia_earth/models/faostat2018/coldCarcassWeightPerHead.py +2 -2
  29. hestia_earth/models/faostat2018/coldDressedCarcassWeightPerHead.py +2 -2
  30. hestia_earth/models/faostat2018/liveweightPerHead.py +7 -8
  31. hestia_earth/models/faostat2018/product/price.py +34 -28
  32. hestia_earth/models/faostat2018/readyToCookWeightPerHead.py +2 -2
  33. hestia_earth/models/faostat2018/utils.py +15 -27
  34. hestia_earth/models/frischknechtEtAl2000/ionisingRadiationKbqU235Eq.py +16 -9
  35. hestia_earth/models/geospatialDatabase/altitude.py +60 -0
  36. hestia_earth/models/geospatialDatabase/croppingIntensity.py +1 -1
  37. hestia_earth/models/geospatialDatabase/ecoClimateZone.py +2 -2
  38. hestia_earth/models/geospatialDatabase/longFallowRatio.py +1 -1
  39. hestia_earth/models/geospatialDatabase/utils.py +4 -1
  40. hestia_earth/models/globalCropWaterModel2008/rootingDepth.py +2 -3
  41. hestia_earth/models/haversineFormula/transport/distance.py +3 -3
  42. hestia_earth/models/hestia/landCover.py +72 -45
  43. hestia_earth/models/hestia/seed_emissions.py +11 -7
  44. hestia_earth/models/impact_assessment/__init__.py +3 -3
  45. hestia_earth/models/ipcc2019/animal/fatContent.py +1 -1
  46. hestia_earth/models/ipcc2019/animal/hoursWorkedPerDay.py +1 -1
  47. hestia_earth/models/ipcc2019/animal/liveweightGain.py +1 -1
  48. hestia_earth/models/ipcc2019/animal/liveweightPerHead.py +1 -1
  49. hestia_earth/models/ipcc2019/animal/milkYieldPerAnimal.py +1 -1
  50. hestia_earth/models/ipcc2019/animal/pastureGrass.py +1 -1
  51. hestia_earth/models/ipcc2019/animal/pregnancyRateTotal.py +1 -1
  52. hestia_earth/models/ipcc2019/animal/trueProteinContent.py +1 -1
  53. hestia_earth/models/ipcc2019/animal/utils.py +5 -7
  54. hestia_earth/models/ipcc2019/animal/weightAtMaturity.py +1 -1
  55. hestia_earth/models/ipcc2019/ch4ToAirEntericFermentation.py +2 -2
  56. hestia_earth/models/ipcc2019/ch4ToAirExcreta.py +6 -7
  57. hestia_earth/models/ipcc2019/ch4ToAirFloodedRice.py +5 -3
  58. hestia_earth/models/ipcc2019/co2ToAirCarbonStockChange_utils.py +1 -1
  59. hestia_earth/models/ipcc2019/croppingDuration.py +3 -6
  60. hestia_earth/models/ipcc2019/nonCo2EmissionsToAirNaturalVegetationBurning.py +947 -0
  61. hestia_earth/models/ipcc2019/pastureGrass.py +1 -1
  62. hestia_earth/models/koble2014/residueBurnt.py +5 -7
  63. hestia_earth/models/koble2014/residueRemoved.py +5 -7
  64. hestia_earth/models/lcImpactAllEffects100Years/damageToHumanHealthWaterStress.py +2 -2
  65. hestia_earth/models/lcImpactAllEffectsInfinite/damageToHumanHealthWaterStress.py +2 -2
  66. hestia_earth/models/lcImpactCertainEffects100Years/damageToHumanHealthWaterStress.py +2 -2
  67. hestia_earth/models/lcImpactCertainEffectsInfinite/damageToHumanHealthWaterStress.py +2 -2
  68. hestia_earth/models/log.py +1 -1
  69. hestia_earth/models/mocking/search-results.json +3397 -1097
  70. hestia_earth/models/site/management.py +1 -1
  71. hestia_earth/models/site/post_checks/__init__.py +3 -2
  72. hestia_earth/models/site/post_checks/country.py +9 -0
  73. hestia_earth/models/site/pre_checks/__init__.py +3 -2
  74. hestia_earth/models/site/pre_checks/country.py +9 -0
  75. hestia_earth/models/site/soilMeasurement.py +2 -0
  76. hestia_earth/models/utils/__init__.py +1 -16
  77. hestia_earth/models/utils/blank_node.py +25 -25
  78. hestia_earth/models/utils/completeness.py +3 -2
  79. hestia_earth/models/utils/cycle.py +5 -4
  80. hestia_earth/models/utils/emission.py +5 -5
  81. hestia_earth/models/utils/feedipedia.py +6 -6
  82. hestia_earth/models/utils/impact_assessment.py +1 -2
  83. hestia_earth/models/utils/indicator.py +9 -7
  84. hestia_earth/models/utils/inorganicFertiliser.py +4 -6
  85. hestia_earth/models/utils/input.py +6 -5
  86. hestia_earth/models/utils/lookup.py +32 -100
  87. hestia_earth/models/utils/management.py +4 -4
  88. hestia_earth/models/utils/measurement.py +7 -8
  89. hestia_earth/models/utils/method.py +20 -0
  90. hestia_earth/models/utils/practice.py +4 -5
  91. hestia_earth/models/utils/product.py +4 -5
  92. hestia_earth/models/utils/property.py +12 -22
  93. hestia_earth/models/utils/site.py +14 -8
  94. hestia_earth/models/utils/term.py +27 -1
  95. hestia_earth/models/version.py +1 -1
  96. hestia_earth/orchestrator/log.py +0 -11
  97. hestia_earth/orchestrator/models/__init__.py +17 -4
  98. hestia_earth/orchestrator/strategies/run/add_blank_node_if_missing.py +2 -20
  99. {hestia_earth_models-0.67.1.dist-info → hestia_earth_models-0.68.1.dist-info}/METADATA +2 -2
  100. {hestia_earth_models-0.67.1.dist-info → hestia_earth_models-0.68.1.dist-info}/RECORD +146 -138
  101. tests/models/cml2001Baseline/test_abioticResourceDepletionFossilFuels.py +3 -3
  102. tests/models/cml2001Baseline/test_resourceUseEnergyDepletionDuringCycle.py +1 -1
  103. tests/models/cycle/test_coldCarcassWeightPerHead.py +1 -1
  104. tests/models/cycle/test_coldDressedCarcassWeightPerHead.py +1 -1
  105. tests/models/cycle/test_concentrateFeed.py +1 -1
  106. tests/models/cycle/test_energyContentLowerHeatingValue.py +1 -1
  107. tests/models/cycle/test_excretaKgMass.py +1 -1
  108. tests/models/cycle/test_feedConversionRatio.py +3 -3
  109. tests/models/cycle/test_pastureGrass.py +1 -1
  110. tests/models/cycle/test_readyToCookWeightPerHead.py +1 -1
  111. tests/models/environmentalFootprintV3_1/test_photochemicalOzoneCreationPotentialHumanHealthNmvocEq.py +30 -0
  112. tests/models/environmentalFootprintV3_1/test_soilQualityIndexTotalLandUseEffects.py +30 -7
  113. tests/models/faostat2018/product/test_price.py +27 -14
  114. tests/models/faostat2018/test_faostat_utils.py +4 -24
  115. tests/models/faostat2018/test_liveweightPerHead.py +9 -9
  116. tests/models/globalCropWaterModel2008/test_rootingDepth.py +7 -3
  117. tests/models/haversineFormula/transport/test_distance.py +1 -1
  118. tests/models/hestia/test_landCover.py +53 -5
  119. tests/models/ipcc2019/animal/test_pastureGrass.py +5 -3
  120. tests/models/ipcc2019/test_aboveGroundCropResidueTotal.py +4 -4
  121. tests/models/ipcc2019/test_belowGroundCropResidue.py +4 -4
  122. tests/models/ipcc2019/test_ch4ToAirEntericFermentation.py +10 -10
  123. tests/models/ipcc2019/test_croppingDuration.py +1 -1
  124. tests/models/ipcc2019/test_nonCo2EmissionsToAirNaturalVegetationBurning.py +83 -0
  125. tests/models/ipcc2019/test_organicCarbonPerHa.py +12 -12
  126. tests/models/ipcc2019/test_pastureGrass.py +5 -3
  127. tests/models/pooreNemecek2018/test_excretaKgN.py +5 -5
  128. tests/models/pooreNemecek2018/test_excretaKgVs.py +2 -2
  129. tests/models/site/post_checks/test_country.py +6 -0
  130. tests/models/site/pre_checks/test_cache_geospatialDatabase.py +1 -1
  131. tests/models/site/pre_checks/test_country.py +12 -0
  132. tests/models/test_ecoinventV3.py +7 -3
  133. tests/models/utils/test_blank_node.py +4 -12
  134. tests/models/utils/test_dataCompleteness.py +5 -5
  135. tests/models/utils/test_emission.py +2 -2
  136. tests/models/utils/test_indicator.py +2 -2
  137. tests/models/utils/test_input.py +2 -2
  138. tests/models/utils/test_measurement.py +2 -4
  139. tests/models/utils/test_practice.py +4 -2
  140. tests/models/utils/test_product.py +2 -2
  141. tests/models/utils/test_property.py +4 -2
  142. tests/models/utils/test_site.py +7 -0
  143. tests/orchestrator/strategies/run/test_add_blank_node_if_missing.py +4 -9
  144. hestia_earth/models/environmentalFootprintV3_1/utils.py +0 -17
  145. tests/models/utils/test_lookup.py +0 -10
  146. {hestia_earth_models-0.67.1.dist-info → hestia_earth_models-0.68.1.dist-info}/LICENSE +0 -0
  147. {hestia_earth_models-0.67.1.dist-info → hestia_earth_models-0.68.1.dist-info}/WHEEL +0 -0
  148. {hestia_earth_models-0.67.1.dist-info → hestia_earth_models-0.68.1.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  from enum import Enum
2
2
  from hestia_earth.schema import EmissionMethodTier, TermTermType
3
- from hestia_earth.utils.lookup import column_name, download_lookup, get_table_value, extract_grouped_data
3
+ from hestia_earth.utils.lookup import download_lookup, get_table_value, extract_grouped_data
4
4
  from hestia_earth.utils.model import filter_list_term_type
5
5
  from hestia_earth.utils.tools import safe_parse_float, list_sum
6
6
 
@@ -12,6 +12,7 @@ from hestia_earth.models.utils.productivity import PRODUCTIVITY, get_productivit
12
12
  from hestia_earth.models.utils.emission import _new_emission
13
13
  from hestia_earth.models.utils.measurement import most_relevant_measurement_value
14
14
  from hestia_earth.models.utils.input import total_excreta
15
+ from hestia_earth.models.utils.lookup import get_region_lookup_value
15
16
  from . import MODEL
16
17
 
17
18
  REQUIREMENTS = {
@@ -29,8 +30,8 @@ REQUIREMENTS = {
29
30
  }
30
31
  LOOKUPS = {
31
32
  "region": "HDI",
32
- "region-excreta-excretaManagement-ch4B0": "use input `@id`",
33
- "excretaManagement-ecoClimateZone-CH4conv": "use `ecoClimateZone` from site measurements"
33
+ "region-excreta-excretaManagement-ch4B0": "",
34
+ "excretaManagement-ecoClimateZone-CH4conv": ""
34
35
  }
35
36
  RETURNS = {
36
37
  "Emission": [{
@@ -83,11 +84,9 @@ def _get_excreta_b0(country: dict, input: dict):
83
84
  # a high or low value is stored in the lookup as "high"
84
85
  # therefore this model defaults to "high" productivity in these cases to ascertain this value
85
86
  productivity_key = get_productivity(country)
86
- lookup_name = 'region-excreta-excretaManagement-ch4B0.csv'
87
- lookup = download_lookup(lookup_name)
88
87
  term_id = input.get('term', {}).get('@id')
89
- data_values = get_table_value(lookup, 'termid', country.get('@id'), column_name(term_id))
90
- debugMissingLookup(lookup_name, 'termid', country.get('@id'), term_id, data_values, model=MODEL, term=TERM_ID)
88
+ lookup_name = 'region-excreta-excretaManagement-ch4B0.csv'
89
+ data_values = get_region_lookup_value(lookup_name, country.get('@id'), term_id, model=MODEL, term=TERM_ID)
91
90
  return safe_parse_float(
92
91
  extract_grouped_data(data_values, productivity_key.value) or
93
92
  extract_grouped_data(data_values, PRODUCTIVITY.HIGH.value) # defaults to high if low is not found
@@ -1,6 +1,5 @@
1
1
  from hestia_earth.schema import EmissionMethodTier, EmissionStatsDefinition, TermTermType
2
2
  from hestia_earth.utils.model import filter_list_term_type, find_term_match
3
- from hestia_earth.utils.lookup import download_lookup, get_table_value, column_name
4
3
  from hestia_earth.utils.tools import list_sum, safe_parse_float
5
4
 
6
5
  from hestia_earth.models.log import debugValues, logRequirements, logShouldRun
@@ -8,6 +7,7 @@ from hestia_earth.models.utils.term import get_lookup_value
8
7
  from hestia_earth.models.utils.emission import _new_emission
9
8
  from hestia_earth.models.utils.product import has_flooded_rice
10
9
  from hestia_earth.models.utils.organicFertiliser import get_cycle_inputs as get_organicFertiliser_inputs
10
+ from hestia_earth.models.utils.lookup import get_region_lookup_value
11
11
  from . import MODEL
12
12
 
13
13
  REQUIREMENTS = {
@@ -82,8 +82,10 @@ def _emission(value: float, min: float, max: float, sd: float):
82
82
 
83
83
 
84
84
  def _get_CH4_ef(country: str, suffix: str = ''):
85
- lookup = download_lookup('region-ch4ef-IPCC2019.csv')
86
- return safe_parse_float(get_table_value(lookup, 'termid', country, column_name('CH4_ef' + suffix)))
85
+ lookup_name = 'region-ch4ef-IPCC2019.csv'
86
+ return safe_parse_float(
87
+ get_region_lookup_value(lookup_name, country, 'CH4_ef' + suffix, model=MODEL, term=TERM_ID)
88
+ )
87
89
 
88
90
 
89
91
  def _get_practice_lookup(term: dict, col: str):
@@ -410,7 +410,7 @@ def create_should_run_function(
410
410
  cycle_end_date = cycle.get("endDate")
411
411
 
412
412
  site = _get_site(cycle)
413
- cycles = related_cycles(site)
413
+ cycles = related_cycles(site, cycles_mapping={cycle_id: cycle})
414
414
 
415
415
  carbon_stock_measurements = [
416
416
  node for node in site.get("measurements", [])
@@ -4,12 +4,12 @@
4
4
  The model will only run for rice crops as this is the only crop which requires the value for emission recalculations.
5
5
  """
6
6
  from hestia_earth.schema import PracticeStatsDefinition
7
- from hestia_earth.utils.lookup import download_lookup, get_table_value, column_name
8
7
  from hestia_earth.utils.tools import safe_parse_float
9
8
 
10
- from hestia_earth.models.log import logRequirements, debugMissingLookup, logShouldRun
9
+ from hestia_earth.models.log import logRequirements, logShouldRun
11
10
  from hestia_earth.models.utils.practice import _new_practice
12
11
  from hestia_earth.models.utils.product import has_flooded_rice
12
+ from hestia_earth.models.utils.lookup import get_region_lookup_value
13
13
  from . import MODEL
14
14
 
15
15
  REQUIREMENTS = {
@@ -59,10 +59,7 @@ def _practice(value: float, min: float, max: float, sd: float):
59
59
 
60
60
 
61
61
  def _get_value(country: str, col: str):
62
- lookup = download_lookup(LOOKUP_TABLE)
63
- value = safe_parse_float(get_table_value(lookup, 'termid', country, column_name(col)))
64
- debugMissingLookup(LOOKUP_TABLE, 'termid', country, col, value, model=MODEL, term=TERM_ID)
65
- return value
62
+ return safe_parse_float(get_region_lookup_value(LOOKUP_TABLE, country, col, model=MODEL, term=TERM_ID))
66
63
 
67
64
 
68
65
  def _run(country: str):