hestia-earth-models 0.64.8__py3-none-any.whl → 0.64.9__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 (37) hide show
  1. hestia_earth/models/cycle/siteArea.py +2 -1
  2. hestia_earth/models/environmentalFootprintV3/soilQualityIndexLandOccupation.py +73 -82
  3. hestia_earth/models/environmentalFootprintV3/soilQualityIndexLandTransformation.py +102 -116
  4. hestia_earth/models/environmentalFootprintV3/soilQualityIndexTotalLandUseEffects.py +27 -16
  5. hestia_earth/models/faostat2018/landTransformationFromCropland100YearAverage.py +3 -2
  6. hestia_earth/models/faostat2018/landTransformationFromCropland20YearAverage.py +3 -2
  7. hestia_earth/models/frischknechtEtAl2000/ionisingRadiationKbqU235Eq.py +69 -37
  8. hestia_earth/models/ipcc2019/animal/fatContent.py +38 -0
  9. hestia_earth/models/ipcc2019/animal/liveweightGain.py +3 -54
  10. hestia_earth/models/ipcc2019/animal/liveweightPerHead.py +3 -54
  11. hestia_earth/models/ipcc2019/animal/pregnancyRateTotal.py +38 -0
  12. hestia_earth/models/ipcc2019/animal/trueProteinContent.py +38 -0
  13. hestia_earth/models/ipcc2019/animal/utils.py +87 -3
  14. hestia_earth/models/ipcc2019/animal/weightAtMaturity.py +4 -10
  15. hestia_earth/models/mocking/search-results.json +265 -259
  16. hestia_earth/models/poschEtAl2008/terrestrialAcidificationPotentialAccumulatedExceedance.py +4 -1
  17. hestia_earth/models/poschEtAl2008/terrestrialEutrophicationPotentialAccumulatedExceedance.py +4 -1
  18. hestia_earth/models/utils/__init__.py +5 -4
  19. hestia_earth/models/utils/impact_assessment.py +13 -4
  20. hestia_earth/models/version.py +1 -1
  21. {hestia_earth_models-0.64.8.dist-info → hestia_earth_models-0.64.9.dist-info}/METADATA +1 -1
  22. {hestia_earth_models-0.64.8.dist-info → hestia_earth_models-0.64.9.dist-info}/RECORD +37 -31
  23. tests/models/environmentalFootprintV3/test_soilQualityIndexLandOccupation.py +97 -66
  24. tests/models/environmentalFootprintV3/test_soilQualityIndexLandTransformation.py +137 -74
  25. tests/models/environmentalFootprintV3/test_soilQualityIndexTotalLandUseEffects.py +15 -10
  26. tests/models/frischknechtEtAl2000/test_ionisingRadiationKbqU235Eq.py +67 -44
  27. tests/models/ipcc2019/animal/test_fatContent.py +22 -0
  28. tests/models/ipcc2019/animal/test_liveweightGain.py +4 -2
  29. tests/models/ipcc2019/animal/test_liveweightPerHead.py +4 -2
  30. tests/models/ipcc2019/animal/test_pregnancyRateTotal.py +22 -0
  31. tests/models/ipcc2019/animal/test_trueProteinContent.py +22 -0
  32. tests/models/ipcc2019/animal/test_weightAtMaturity.py +2 -1
  33. tests/models/poschEtAl2008/test_terrestrialAcidificationPotentialAccumulatedExceedance.py +30 -17
  34. tests/models/poschEtAl2008/test_terrestrialEutrophicationPotentialAccumulatedExceedance.py +28 -14
  35. {hestia_earth_models-0.64.8.dist-info → hestia_earth_models-0.64.9.dist-info}/LICENSE +0 -0
  36. {hestia_earth_models-0.64.8.dist-info → hestia_earth_models-0.64.9.dist-info}/WHEEL +0 -0
  37. {hestia_earth_models-0.64.8.dist-info → hestia_earth_models-0.64.9.dist-info}/top_level.txt +0 -0
@@ -9,36 +9,50 @@ class_path = f"hestia_earth.models.{MODEL}.{TERM_ID}"
9
9
  fixtures_folder = f"{fixtures_path}/{MODEL}/{TERM_ID}"
10
10
 
11
11
 
12
+ def fake_rounded_indicator(value: float):
13
+ indicator = fake_new_indicator(TERM_ID, MODEL)
14
+ indicator['value'] = round(value, 7)
15
+ return indicator
16
+
17
+
12
18
  @patch(f"{class_path}._new_indicator", side_effect=fake_new_indicator)
13
19
  def test_run(*args):
14
20
  with open(f"{fixtures_folder}/impact-assessment.jsonld", encoding='utf-8') as f:
15
- cycle = json.load(f)
21
+ impactassessment = json.load(f)
16
22
 
17
- with open(f"{fixtures_folder}/result.jsonld", encoding='utf-8') as f:
23
+ with open(f"{fixtures_folder}/Belarus/result.jsonld", encoding='utf-8') as f:
18
24
  expected = json.load(f)
19
25
 
20
- value = run(cycle)
26
+ value = run(impactassessment)
21
27
  assert value == expected
22
28
 
23
29
 
24
- @patch(f"{class_path}._new_indicator", side_effect=fake_new_indicator)
30
+ @patch(f"{class_path}._indicator", side_effect=fake_rounded_indicator)
25
31
  def test_lookup_to_bad_country(*args):
32
+ """
33
+ Should default to region-world value
34
+ """
26
35
  with open(f"{fixtures_folder}/impact-assessment.jsonld", encoding='utf-8') as f:
27
- cycle = json.load(f)
28
- cycle['country']['@id'] = "example-land-not-real"
36
+ impactassessment = json.load(f)
29
37
 
30
- value = run(cycle)
31
- assert value['value'] is None
38
+ impactassessment['country']['@id'] = "example-land-not-real"
39
+
40
+ with open(f"{fixtures_folder}/region-world/result.jsonld", encoding='utf-8') as f:
41
+ expected = json.load(f)
42
+
43
+ value = run(impactassessment)
44
+ assert value == expected
32
45
 
33
46
 
34
47
  @patch(f"{class_path}._new_indicator", side_effect=fake_new_indicator)
35
- def test_lookup_no_term_type(*args):
48
+ def test_run_no_emissions(*args):
36
49
  """
37
- We currently do not filter out bad termTypes so this is expected behavior.
50
+ Impact assessment with no emissions should return a indicator of 0
38
51
  """
39
52
  with open(f"{fixtures_folder}/impact-assessment.jsonld", encoding='utf-8') as f:
40
- cycle = json.load(f)
41
- del cycle['emissionsResourceUse'][0]['term']['termType']
53
+ impactassessment = json.load(f)
54
+
55
+ del impactassessment['emissionsResourceUse']
42
56
 
43
- value = run(cycle)
44
- assert value['value'] == 7.47
57
+ value = run(impactassessment)
58
+ assert value['value'] == 0