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
@@ -25,6 +25,8 @@ LOOKUPS = {
25
25
  }
26
26
  TERM_ID = 'terrestrialAcidificationPotentialAccumulatedExceedance'
27
27
 
28
+ LOOKUP = f"{list(LOOKUPS.keys())[0]}.csv"
29
+
28
30
 
29
31
  def _indicator(value: float):
30
32
  indicator = _new_indicator(TERM_ID, MODEL)
@@ -33,7 +35,8 @@ def _indicator(value: float):
33
35
 
34
36
 
35
37
  def run(impact_assessment: dict):
36
- value = impact_country_value(MODEL, TERM_ID, impact_assessment, f"{list(LOOKUPS.keys())[0]}.csv")
38
+ value = impact_country_value(MODEL, TERM_ID, impact_assessment, f"{list(LOOKUPS.keys())[0]}.csv",
39
+ country_fallback=True, default_no_emissions=0)
37
40
  logRequirements(impact_assessment, model=MODEL, term=TERM_ID,
38
41
  value=value)
39
42
  logShouldRun(impact_assessment, MODEL, TERM_ID, True)
@@ -25,6 +25,8 @@ LOOKUPS = {
25
25
  }
26
26
  TERM_ID = 'terrestrialEutrophicationPotentialAccumulatedExceedance'
27
27
 
28
+ LOOKUP = f"{list(LOOKUPS.keys())[0]}.csv"
29
+
28
30
 
29
31
  def _indicator(value: float):
30
32
  indicator = _new_indicator(TERM_ID, MODEL)
@@ -33,7 +35,8 @@ def _indicator(value: float):
33
35
 
34
36
 
35
37
  def run(impact_assessment: dict):
36
- value = impact_country_value(MODEL, TERM_ID, impact_assessment, f"{list(LOOKUPS.keys())[0]}.csv")
38
+ value = impact_country_value(MODEL, TERM_ID, impact_assessment, f"{list(LOOKUPS.keys())[0]}.csv",
39
+ country_fallback=True, default_no_emissions=0)
37
40
  logRequirements(impact_assessment, model=MODEL, term=TERM_ID,
38
41
  value=value)
39
42
  logShouldRun(impact_assessment, MODEL, TERM_ID, True)
@@ -188,9 +188,10 @@ def full_date_str(date_str: str, is_end: bool = False):
188
188
  )
189
189
 
190
190
 
191
- def days_to_years(days):
192
- return days / 365
191
+ def days_to_years(days): return days / 365
193
192
 
194
193
 
195
- def hectar_to_square_meter(value):
196
- return value * 10000
194
+ def hectar_to_square_meter(value): return value * 10000
195
+
196
+
197
+ def square_meter_to_hectare(value): return value / 10000
@@ -1,9 +1,10 @@
1
1
  from typing import Optional
2
2
 
3
+ from hestia_earth.utils.lookup import download_lookup
3
4
  from hestia_earth.utils.model import find_term_match
4
5
  from hestia_earth.utils.tools import list_sum, safe_parse_date
5
6
 
6
- from .lookup import factor_value, _term_factor_value, _aware_factor_value
7
+ from .lookup import factor_value, _term_factor_value, _aware_factor_value, fallback_country
7
8
  from .product import find_by_product
8
9
  from .site import region_level_1_id
9
10
  from ..log import logRequirements
@@ -116,7 +117,8 @@ def impact_lookup_value(model: str, term_id: str, impact: dict, lookup_col: str,
116
117
  return list_sum(values) if len(values) > 0 else None
117
118
 
118
119
 
119
- def impact_country_value(model: str, term_id: str, impact: dict, lookup: str, group_key: str = None) -> float:
120
+ def impact_country_value(model: str, term_id: str, impact: dict, lookup: str, group_key: str = None,
121
+ country_fallback: bool = False, default_no_emissions=None) -> float:
120
122
  """
121
123
  Calculate the value of the impact based on lookup factors and `site.country.@id`.
122
124
 
@@ -126,12 +128,17 @@ def impact_country_value(model: str, term_id: str, impact: dict, lookup: str, gr
126
128
  The model to display in the logs only.
127
129
  term_id : str
128
130
  The term to display in the logs only.
129
- impact_assessment : dict
131
+ impact : dict
130
132
  The `ImpactAssessment`.
131
133
  lookup : str
132
134
  The name of the lookup to fetch the factors from.
133
135
  group_key : str
134
136
  Optional: key to use if the data is a group of values.
137
+ country_fallback : bool
138
+ Optional: if True fallback to default `region-world` country_id if country_id in `ImpactAssessment` not found in
139
+ lookup file containing factors.
140
+ default_no_emissions :
141
+ Optional: if set, will return this value if no contributing terms found in emissionsResourceUse
135
142
 
136
143
  Returns
137
144
  -------
@@ -140,9 +147,11 @@ def impact_country_value(model: str, term_id: str, impact: dict, lookup: str, gr
140
147
  """
141
148
  nodes = impact.get('emissionsResourceUse', [])
142
149
  country_id = get_country_id(impact)
150
+ country_id = fallback_country(country_id, [download_lookup(lookup)]) if country_fallback else country_id
151
+
143
152
  factors = list(map(_term_factor_value(model, term_id, lookup, country_id, group_key), nodes))
144
153
  values = [value for value in factors if value is not None]
145
- return list_sum(values) if len(values) > 0 else None
154
+ return list_sum(values) if len(values) > 0 else default_no_emissions
146
155
 
147
156
 
148
157
  def impact_aware_value(model: str, term_id: str, impact: dict, lookup: str, group_key: str = None) -> float:
@@ -1 +1 @@
1
- VERSION = '0.64.8'
1
+ VERSION = '0.64.9'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hestia-earth-models
3
- Version: 0.64.8
3
+ Version: 0.64.9
4
4
  Summary: HESTIA's set of modules for filling gaps in the activity data using external datasets (e.g. populating soil properties with a geospatial dataset using provided coordinates) and internal lookups (e.g. populating machinery use from fuel use). Includes rules for when gaps should be filled versus not (e.g. never gap fill yield, gap fill crop residue if yield provided etc.).
5
5
  Home-page: https://gitlab.com/hestia-earth/hestia-engine-models
6
6
  Author: HESTIA Team
@@ -4,7 +4,7 @@ hestia_earth/models/cache_sites.py,sha256=KQp9cUKE-aIcYJoMWEtKFYS8gBFfsx5LKQhqoW
4
4
  hestia_earth/models/log.py,sha256=DbfNcGzaC5hzkuMDxQqW6XYoNBI4Uxw4SIoOYoZA6og,3474
5
5
  hestia_earth/models/preload_requests.py,sha256=Ibx-YOhR_1yuyFBxsLUbvJHVK7PLyMLoPu5l9jDN_Qk,1342
6
6
  hestia_earth/models/requirements.py,sha256=eU4yT443fx7BnaokhrLB_PCizJI7Y6m4auyo8vQauNg,17363
7
- hestia_earth/models/version.py,sha256=L60xIy0nhRJ6qj8RKQ1dAZGRyLHbUcTSsWzwzTRRH2M,19
7
+ hestia_earth/models/version.py,sha256=Jgb2_29ee7rkzvbt06so5Fn_7zQiC2iVFHY9sT85u3c,19
8
8
  hestia_earth/models/agribalyse2016/__init__.py,sha256=WvK0qCQbnYtg9oZxrACd1wGormZyXibPtpCnIQeDqbw,415
9
9
  hestia_earth/models/agribalyse2016/fuelElectricity.py,sha256=tnGxBmJdPfPFfehLUQcefEqy1lHvzsSpx_s7O8nf3Zs,4412
10
10
  hestia_earth/models/agribalyse2016/machineryInfrastructureDepreciatedAmountPerCycle.py,sha256=BPjnWmg73i_OxM2ouCdMTWZtPIqyoUAXrvutntyteE0,3390
@@ -60,7 +60,7 @@ hestia_earth/models/cycle/residueBurnt.py,sha256=HwU1D9ibiIul-FlXDUcEMDEc_KxpB8u
60
60
  hestia_earth/models/cycle/residueIncorporated.py,sha256=9_s2RMOy5D20eq9ziDBEA_Y7RiFFMeK0bDJ65CW4qlE,2763
61
61
  hestia_earth/models/cycle/residueLeftOnField.py,sha256=qYxKGAdUORN7Vjqj7AZC2VGV_rM3MN0-padDGhgjiNU,2175
62
62
  hestia_earth/models/cycle/residueRemoved.py,sha256=jxDu_Jfcyd-rm-qo8ZuRIf-GGxtFBMpmGy1zHOavwy0,2135
63
- hestia_earth/models/cycle/siteArea.py,sha256=ueWaQqH4POYynLG1aVXYcOm8pRehmo4IxkbsYcy4Gvc,2661
63
+ hestia_earth/models/cycle/siteArea.py,sha256=K_Vj8lc_HP1WOVm22jlIMfE9fIOc6WkMXe-iDHiTdB4,2748
64
64
  hestia_earth/models/cycle/siteDuration.py,sha256=8VCYn608Lw1A6gLOG2bA1Z2tAQbmDg_yXeq6sgkrXac,2342
65
65
  hestia_earth/models/cycle/siteUnusedDuration.py,sha256=orYGlbzGMpjuDAtZe7KkCOLWrwUYR1H4A0ccAbutW3s,2189
66
66
  hestia_earth/models/cycle/startDate.py,sha256=pbBi55b6uJezPE8EOovOCSwQVrbwpmxwmravOCIh2zg,2683
@@ -138,9 +138,9 @@ hestia_earth/models/emepEea2019/utils.py,sha256=oTHjbRRwJZv_tpO9MOlfpyQRmN0a1kvE
138
138
  hestia_earth/models/emissionNotRelevant/__init__.py,sha256=nIuPIkQR1ghv_T_Ab4Ckq5wmGdWVmgbaOjhtKfIJ-WE,2183
139
139
  hestia_earth/models/environmentalFootprintV3/__init__.py,sha256=lzg9qccwd9tbspw0lQ58YPprnvvSLTn3QV5T2-tPcC4,425
140
140
  hestia_earth/models/environmentalFootprintV3/freshwaterEcotoxicityPotentialCtue.py,sha256=X62-4v0NJdM_Z5kLK3NuU4GNEeSrXlKlMZQB_o4JZ6c,1018
141
- hestia_earth/models/environmentalFootprintV3/soilQualityIndexLandOccupation.py,sha256=fFYSOjO_G1XPRW0Au7erYj4XSAZkoMN0Lx4DvEziSBo,4514
142
- hestia_earth/models/environmentalFootprintV3/soilQualityIndexLandTransformation.py,sha256=K0ot5wLo8beAHkBmXEQGPDRykoBoQ0u2ihxLAZWpy6I,7259
143
- hestia_earth/models/environmentalFootprintV3/soilQualityIndexTotalLandUseEffects.py,sha256=-Lsc2VLtOwFnNqCL7nHKsyLfcSWIgYGs4iMso3AoDk8,2679
141
+ hestia_earth/models/environmentalFootprintV3/soilQualityIndexLandOccupation.py,sha256=r3GV2pspKWAlKU46TMh_6D_rrXtY_onhk3RnukzJjD8,5095
142
+ hestia_earth/models/environmentalFootprintV3/soilQualityIndexLandTransformation.py,sha256=1vDkm9SifdcNNJX8JGDeuyTNP65D684X7I2kk3H760U,7348
143
+ hestia_earth/models/environmentalFootprintV3/soilQualityIndexTotalLandUseEffects.py,sha256=SIjFYPv4n3mziohW2nlycaMssHQ3ws79hqHa4i3sCVI,2997
144
144
  hestia_earth/models/environmentalFootprintV3/utils.py,sha256=fZ99_G0Kh4OUW5wH-LglzCrKp8l2plKuCs4yvUH_3hs,699
145
145
  hestia_earth/models/epa2014/__init__.py,sha256=ckGf_6X7CCzI_18OqchEkuJAXKXM1x7V53u480ckknM,408
146
146
  hestia_earth/models/epa2014/no3ToGroundwaterExcreta.py,sha256=fN4fOOcjBg3tl0lzNeJ8mzg6mrvQRxilx-R5Gc4l4Nw,1724
@@ -149,8 +149,8 @@ hestia_earth/models/fantkeEtAl2016/damageToHumanHealthParticulateMatterFormation
149
149
  hestia_earth/models/faostat2018/__init__.py,sha256=ecN-pKF1pkFnzmooBrg1VAxJkG76q9v4piiaKGP_vbo,412
150
150
  hestia_earth/models/faostat2018/coldCarcassWeightPerHead.py,sha256=y1ouj5FBrnGWxd4dIC7luG6iQwiMrm1CGgYbXCcKS8E,3139
151
151
  hestia_earth/models/faostat2018/coldDressedCarcassWeightPerHead.py,sha256=Aphq7r06Q5-RDer4i1CneOLifVQCKTiVPTIWE3AxLfE,3230
152
- hestia_earth/models/faostat2018/landTransformationFromCropland100YearAverage.py,sha256=yFQdfHnMifPtwnBUbedXq1FY7qlzv1EieU-UA83MFcE,2647
153
- hestia_earth/models/faostat2018/landTransformationFromCropland20YearAverage.py,sha256=MmMer9DJkDFO_VsWBwHywwUdqvBaKNkfuix--PeL1kU,2640
152
+ hestia_earth/models/faostat2018/landTransformationFromCropland100YearAverage.py,sha256=M0NblGiHme8yL8CBvZvfgbW52DODq4FO_Y3iThlq3n0,2684
153
+ hestia_earth/models/faostat2018/landTransformationFromCropland20YearAverage.py,sha256=HuFHJDAqNaaJWpaWxD1jGaQsTdsJEVufsPGKwI6iAb0,2677
154
154
  hestia_earth/models/faostat2018/liveweightPerHead.py,sha256=flI3_TyG-7xoWp6cU6pZAFiXyHyFkfRz7Lmb7cQAffI,5140
155
155
  hestia_earth/models/faostat2018/readyToCookWeightPerHead.py,sha256=b1_GZQ3oFl88w6TY5DqLSqXNaYX6TcRBK4R9M2cWSjM,3165
156
156
  hestia_earth/models/faostat2018/seed.py,sha256=ts9PKs9UnZnJ9nPFlL7etL1Qb9uIWIES8Mz8W7FWbOw,2917
@@ -158,7 +158,7 @@ hestia_earth/models/faostat2018/utils.py,sha256=Ud2vu_8ze5VFfeBFBzUKdJTWRfxVJO4V
158
158
  hestia_earth/models/faostat2018/product/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
159
159
  hestia_earth/models/faostat2018/product/price.py,sha256=X7Zxa-rXthzYdgw2lzybbHc-oKGE5nyXpBn-BfZC_7w,7753
160
160
  hestia_earth/models/frischknechtEtAl2000/__init__.py,sha256=Fixyy9UwoCGP5-MHyJu_ctS40SQ2imfvZo8a547029U,421
161
- hestia_earth/models/frischknechtEtAl2000/ionisingRadiationKbqU235Eq.py,sha256=8Y5-dIlswtrQYjDth3ahJ5z2CKwh3OnhV3rRSinMGrE,2885
161
+ hestia_earth/models/frischknechtEtAl2000/ionisingRadiationKbqU235Eq.py,sha256=czZx8DgnDuLOdK0CfiriPbj1BwoiWn4d1nkQOiwkcPA,4472
162
162
  hestia_earth/models/geospatialDatabase/__init__.py,sha256=TH-FW3aoL7r1GquRChr7rde7uQonKQRDR00udG8tDrQ,957
163
163
  hestia_earth/models/geospatialDatabase/aware.py,sha256=cbxFnShXW8QUCIjU4uuO1DdK9KhYiLf41ZVjS9hSppI,1358
164
164
  hestia_earth/models/geospatialDatabase/clayContent.py,sha256=u8SQKx-zu3vhMQ-XOJgqyUn-tlCCIy-VG7zpl5AyjtY,3386
@@ -282,11 +282,14 @@ hestia_earth/models/ipcc2019/pastureGrass.py,sha256=Hhm9szzsL3otuo-V6fQ_cNyDbG0d
282
282
  hestia_earth/models/ipcc2019/pastureGrass_utils.py,sha256=Bzz4yPDdA7YVUhhJhQCCVu0uKONeO3b6a48_ZITZgzU,13889
283
283
  hestia_earth/models/ipcc2019/utils.py,sha256=MSDMu15D9DnilFUgi4_6jYXC0FaKso3OODauGTMB6hs,6229
284
284
  hestia_earth/models/ipcc2019/animal/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
285
- hestia_earth/models/ipcc2019/animal/liveweightGain.py,sha256=Gwd6J6k-W84EAsC_cNMLaNy3p4-2pqCSc3grBfPvanw,2618
286
- hestia_earth/models/ipcc2019/animal/liveweightPerHead.py,sha256=Lhnk58SvVtM2FayljOBPHFFx5OBFFqsiaVG8ZjwCaXA,2634
285
+ hestia_earth/models/ipcc2019/animal/fatContent.py,sha256=iVDMPjuy_-oGhmWaylsoCMw0qdkI5jDdqn4uzbq4D4Q,999
286
+ hestia_earth/models/ipcc2019/animal/liveweightGain.py,sha256=UElmAdB4yQEFAOT5RrURn0Yt7U3gB2qiCWvNXyLk8Hw,971
287
+ hestia_earth/models/ipcc2019/animal/liveweightPerHead.py,sha256=cq88VTxPYVPyEr2NLPb0Zmmppn_eMp9Xtw6Nxnta4-M,984
287
288
  hestia_earth/models/ipcc2019/animal/pastureGrass.py,sha256=4vs-KIlCKQhU1EpX0BFlVAQrh1szm154AnrPDs13oE4,12212
288
- hestia_earth/models/ipcc2019/animal/utils.py,sha256=ziyphGLEO_eitOLtBG0BLpJfmN3csqUetFZuDo8FX2U,990
289
- hestia_earth/models/ipcc2019/animal/weightAtMaturity.py,sha256=IHrG6cqLVhOiIbrvK0w5xDu4bHmy5om-1qBKMmkFC2o,3376
289
+ hestia_earth/models/ipcc2019/animal/pregnancyRateTotal.py,sha256=MWPnuT4WeKJCGjJ_DAJnYelsX2Ld0C5e8eN__0Ws0E0,982
290
+ hestia_earth/models/ipcc2019/animal/trueProteinContent.py,sha256=0VYI2Yg_GF5qvuxazZ3KUa03vAYcbpNLnzCOjUaG5ZI,1019
291
+ hestia_earth/models/ipcc2019/animal/utils.py,sha256=9EyLCOpBGkpa97VVcFbl1tRlDdJHHiy8lI7tLc_y5BE,4439
292
+ hestia_earth/models/ipcc2019/animal/weightAtMaturity.py,sha256=4Pp14_40NYcPqqBUnkqYVkpJLcDzZ70tlM-stte7JsQ,3055
290
293
  hestia_earth/models/ipcc2021/__init__.py,sha256=VTgGFKhwMmk_nuI1RRq0in27fHYVPBonlXlPK00K8no,409
291
294
  hestia_earth/models/ipcc2021/gwp100.py,sha256=v-DYU-11XnWI1Ns1GEiKrJqL3JafxvhTsLmuBuFcxJU,1021
292
295
  hestia_earth/models/jarvisAndPain1994/__init__.py,sha256=ercUwy29sV7oPIESj8UjsGB5lqiBCss9OZcbjxeeG8E,418
@@ -399,7 +402,7 @@ hestia_earth/models/linkedImpactAssessment/landTransformationFromPermanentPastur
399
402
  hestia_earth/models/linkedImpactAssessment/utils.py,sha256=dGwGc2d-8_WQElTpfyPmz5vQtL-LHQRmiZnCTuPXMDs,1876
400
403
  hestia_earth/models/mocking/__init__.py,sha256=n3Fkkrvh8zHNWiJZmnfQ7WZ91JRzAO9P6pSG1JpwtXo,687
401
404
  hestia_earth/models/mocking/mock_search.py,sha256=qgABw-sZK37XtsALKt8AHF2VJPUrZSnHv5Qj1Dn93oA,2405
402
- hestia_earth/models/mocking/search-results.json,sha256=IgD-CYkxGRF8pfPqCwY9jf_mRxK3kgRhXm5W_WSxPsI,55196
405
+ hestia_earth/models/mocking/search-results.json,sha256=wPdmhIkbqUSSKJ5xoOgnePFVQ49FlumwDJs5-kKSME0,55323
403
406
  hestia_earth/models/pooreNemecek2018/__init__.py,sha256=nPboL7ULJzL5nJD5q7q9VOZt_fxbKVm8fmn1Az5YkVY,417
404
407
  hestia_earth/models/pooreNemecek2018/aboveGroundCropResidueTotal.py,sha256=Qt-mel4dkhK6N5uUOutNOinCTFjbjtGzITaaI0LvYc4,2396
405
408
  hestia_earth/models/pooreNemecek2018/belowGroundCropResidue.py,sha256=JT0RybbvWVlo01FO8K0Yj41HrEaJT3Kj1xfayr2X-xw,2315
@@ -427,8 +430,8 @@ hestia_earth/models/pooreNemecek2018/rotationDuration.py,sha256=j5hW_NEKYQbeMcds
427
430
  hestia_earth/models/pooreNemecek2018/saplings.py,sha256=6iJKXIZvw-PIEi4FZfNPdt7dW4tI5sMNPR7LllSTRkM,2495
428
431
  hestia_earth/models/pooreNemecek2018/utils.py,sha256=to2vtONKCbuG1gVSDvsUcG7EnlahELfG_57gzIAHlv0,1710
429
432
  hestia_earth/models/poschEtAl2008/__init__.py,sha256=nvyyGglxCTV4PpxcOjY7jJb0v8Bjzj435Zt1j6VcryM,414
430
- hestia_earth/models/poschEtAl2008/terrestrialAcidificationPotentialAccumulatedExceedance.py,sha256=gbD8fgvdHANXsuPPWRx4Flcqhk3fPD5ROrrb2LMgmS8,1279
431
- hestia_earth/models/poschEtAl2008/terrestrialEutrophicationPotentialAccumulatedExceedance.py,sha256=X1CixghiqYiE1N-sWhXuFcy9nxCA2RdBiClFAgUWTgw,1281
433
+ hestia_earth/models/poschEtAl2008/terrestrialAcidificationPotentialAccumulatedExceedance.py,sha256=1Vha55V1MAXTw4mfLnar8ltSRZfLOQ5b8qE9bSx6YkQ,1402
434
+ hestia_earth/models/poschEtAl2008/terrestrialEutrophicationPotentialAccumulatedExceedance.py,sha256=sI69CvgnlTAiEXgbrcz5IUIit53Tg7vpqVYXXGWBjgw,1404
432
435
  hestia_earth/models/recipe2016Egalitarian/__init__.py,sha256=OvZoSgfaMe6DWIdqr-Sx3ouzXlp994oro7Mi0Xid18Q,422
433
436
  hestia_earth/models/recipe2016Egalitarian/damageToFreshwaterEcosystemsSpeciesYear.py,sha256=b1UZAsy3yGlHYxH2YhBhhSnjm5zzQl8Z32DcQBjgWNE,1123
434
437
  hestia_earth/models/recipe2016Egalitarian/damageToHumanHealth.py,sha256=dJ8WinGe52wFQCMKtT_B7c1MFM_GbBo8aqfw0n2pw94,1087
@@ -559,7 +562,7 @@ hestia_earth/models/transformation/product/__init__.py,sha256=47DEQpj8HBSa-_TImW
559
562
  hestia_earth/models/transformation/product/excreta.py,sha256=Yj9wMF5if-zivb6qbN3vy1X51ZNYxvoyG9f4KPp3Y18,5700
560
563
  hestia_earth/models/usetoxV2/__init__.py,sha256=pK37V3H-KvYcvRKw4Mv8CWrB2N0LFLzmv0jKLdhGGqs,409
561
564
  hestia_earth/models/usetoxV2/freshwaterEcotoxicityPotentialCtue.py,sha256=oYNwThnMXjZymif5buyHiczFiOq_61jOdDMOAyy8vwQ,1018
562
- hestia_earth/models/utils/__init__.py,sha256=bfmKUi3wdGj4CZkxd2pPxtmeTV2XN_vq_61_Euv593w,6291
565
+ hestia_earth/models/utils/__init__.py,sha256=lYPDZu-5Uh6hLmQcAx2Yq-Fga1-mcD1uZLI0SNzkTmU,6342
563
566
  hestia_earth/models/utils/aggregated.py,sha256=sz6usleZmo_tC_hIvmGgYsX8-H0dulXmmhHK4EkA5Kg,4946
564
567
  hestia_earth/models/utils/animalProduct.py,sha256=M5IunAKGY6oZv3j1Ascl34ywyeLWApqOIlBzbtlA2FE,721
565
568
  hestia_earth/models/utils/aquacultureManagement.py,sha256=dxrbC1Xf140cohxTbSw6TxLAnAASWTdNZwBBam4yQnw,171
@@ -579,7 +582,7 @@ hestia_earth/models/utils/excretaManagement.py,sha256=NuWPQjFZxMVt9sYgBjcqhGWCFk
579
582
  hestia_earth/models/utils/feedipedia.py,sha256=wzzrMbYlda1XCpWiObLz4bFLXbAZejHcxsXJFr4U_AM,3953
580
583
  hestia_earth/models/utils/fertiliser.py,sha256=DBO4OBNgnQJ0fCQMDkIk_ZGZX-uKGaTFZCEXfAnJciY,690
581
584
  hestia_earth/models/utils/fuel.py,sha256=r1MKMMxg-PYiVlRutP83RuvY2rsdCQ1iN6ekSGGQGpA,1379
582
- hestia_earth/models/utils/impact_assessment.py,sha256=ma2oINLTIL1qplqC5D1_DbQu4EILpMXSgYNEslxIa2Y,7059
585
+ hestia_earth/models/utils/impact_assessment.py,sha256=iQ-M3-oaQi0_gBlzyhQ6BBxfxQjQgDFa1WNO6kR_NvM,7650
583
586
  hestia_earth/models/utils/indicator.py,sha256=IFrVIUYpmdVLOR1SKkrTReDbG1Tzq2b6daVvLMYpCs4,537
584
587
  hestia_earth/models/utils/inorganicFertiliser.py,sha256=_dLBY-otGkLr8PobR5dQ89bF2uwc2PB4JPrHFSksMEQ,1900
585
588
  hestia_earth/models/utils/input.py,sha256=gsVFKTC9WF8dO6YAg_-H_GAOQTnvAr49Ox5-eTH8zf8,5145
@@ -728,9 +731,9 @@ tests/models/emepEea2019/test_tspToAirAnimalHousing.py,sha256=4MNDsxIeUk5_3IvZwE
728
731
  tests/models/emepEea2019/test_utils.py,sha256=G6z8tEfWM0OPnUBaFCQgQyEi5-kRF_DqsqdYaPnzR_I,8761
729
732
  tests/models/environmentalFootprintV3/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
730
733
  tests/models/environmentalFootprintV3/test_freshwaterEcotoxicityPotentialCtue.py,sha256=ZPDKM23qlLMe_ZzeA-QIutSkFlod3BsmjloA9WA8nug,845
731
- tests/models/environmentalFootprintV3/test_soilQualityIndexLandOccupation.py,sha256=5cv3R1Zam0aW00smkWNKExgdWomhT9Ad8bCTH8KZCdw,4324
732
- tests/models/environmentalFootprintV3/test_soilQualityIndexLandTransformation.py,sha256=XgxgTmuc1jZ0l1nmOd3KpIUfW7uY_erCj0GUN7DYmCQ,3564
733
- tests/models/environmentalFootprintV3/test_soilQualityIndexTotalLandUseEffects.py,sha256=6cIdQ-EpMc3gdvt2PLKxX8nUhN05nUTlNpOm6njQYHY,1949
734
+ tests/models/environmentalFootprintV3/test_soilQualityIndexLandOccupation.py,sha256=pgauGmFl52lQJVPaDHryrUU3LSmjWC-Al_XBqQj33u4,6116
735
+ tests/models/environmentalFootprintV3/test_soilQualityIndexLandTransformation.py,sha256=9be8usvkBqLhDFEaUP5PXEzbZcfFlZcquMoDbtUhpm4,6970
736
+ tests/models/environmentalFootprintV3/test_soilQualityIndexTotalLandUseEffects.py,sha256=j6V2AE1I98hi-Cv_-L5Rc2zzL0au9SWW4XnMkSuV7yo,2314
734
737
  tests/models/epa2014/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
735
738
  tests/models/epa2014/test_no3ToGroundwaterExcreta.py,sha256=ESVz4UURvQfhjGBTxjuAV_bymMBcvGNfLAkYMvNup9U,1217
736
739
  tests/models/fantkeEtAl2016/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -746,7 +749,7 @@ tests/models/faostat2018/test_seed.py,sha256=tUXoNVveX0m0ed9UXB4zXxIZsPxktXyUXlb
746
749
  tests/models/faostat2018/product/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
747
750
  tests/models/faostat2018/product/test_price.py,sha256=vUTT-FZVbXnDrwQVOgq8PWTDuFK_gAT6aqJ9ZK6Qcsc,3493
748
751
  tests/models/frischknechtEtAl2000/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
749
- tests/models/frischknechtEtAl2000/test_ionisingRadiationKbqU235Eq.py,sha256=Fa44zHKi0XZPq_68g7BtOuFlpciefH9yIEgsVDWhlBg,2096
752
+ tests/models/frischknechtEtAl2000/test_ionisingRadiationKbqU235Eq.py,sha256=rT75VNmpUKG6aIQLNgmMzKDyJegTm2_qGLaRHUYlzF8,4416
750
753
  tests/models/geospatialDatabase/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
751
754
  tests/models/geospatialDatabase/test_aware.py,sha256=tbBBvXrOqdO0cMPJTa02UfhlwfosH8iNoJLzZNFs1NU,857
752
755
  tests/models/geospatialDatabase/test_clayContent.py,sha256=GqFAPIOkXfDpJFkI-vK6l3hK0Ap36lLCWGhXCly-DME,1797
@@ -868,10 +871,13 @@ tests/models/ipcc2019/test_organicCarbonPerHa_tier_2_utils.py,sha256=6YXLqH5wz_c
868
871
  tests/models/ipcc2019/test_organicCarbonPerHa_utils.py,sha256=Zd2QlN_Q3k9djuByOH62A00tryVzlvNtsd46N79TTeU,1778
869
872
  tests/models/ipcc2019/test_pastureGrass.py,sha256=mKx8NnTtMT9TrXxRNLv73wD1TWBaiRZzA1xh2ukb-HI,2667
870
873
  tests/models/ipcc2019/animal/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
871
- tests/models/ipcc2019/animal/test_liveweightGain.py,sha256=XN1Ly_Jeg4zoRVQAVX2D0ORxmKjrcW163bI0wpLjUWs,663
872
- tests/models/ipcc2019/animal/test_liveweightPerHead.py,sha256=oMzpf7crgkTXO3sF88i4XhJXVOqkCFgKbZruE9kCQTY,666
874
+ tests/models/ipcc2019/animal/test_fatContent.py,sha256=Emp8jGudRGA_dJaLMR5Jxsv3Gc57rMAnP0CDqswrmlM,775
875
+ tests/models/ipcc2019/animal/test_liveweightGain.py,sha256=KmRZyrjrXZcgff1QFtfu1WphNuJW_nHx1GguD8xB2ls,779
876
+ tests/models/ipcc2019/animal/test_liveweightPerHead.py,sha256=nfNAcUEIPQeKyjKYttI5W6hiHBMXLZ9Vbz0nfj81ZvA,782
873
877
  tests/models/ipcc2019/animal/test_pastureGrass.py,sha256=vuwd7WPUKIWaYREv_UmEa8m9llZSr0OclDsmnSDtHOQ,1987
874
- tests/models/ipcc2019/animal/test_weightAtMaturity.py,sha256=Tss9bTVz66yXVEBZT31KMm6gd45B9E1DJLqwYArPuYY,665
878
+ tests/models/ipcc2019/animal/test_pregnancyRateTotal.py,sha256=3M4cpH0rM0fLR86bwtBQbkUhuflj0ebaQpPgHtAFZxo,783
879
+ tests/models/ipcc2019/animal/test_trueProteinContent.py,sha256=3O2w_PsVEki_piIHO-Wa6m28f5SAHWHsSk27nYDQDuM,783
880
+ tests/models/ipcc2019/animal/test_weightAtMaturity.py,sha256=-lP4Sx1s11Wyo4Vm1it3SdIpNP43TZWmwOWttrAd_N8,705
875
881
  tests/models/ipcc2021/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
876
882
  tests/models/ipcc2021/test_gwp100.py,sha256=JRklKMSg-OXopb9ZufGgl94deuMuJSsfNXRZDBtOZrE,1119
877
883
  tests/models/jarvisAndPain1994/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -1007,8 +1013,8 @@ tests/models/pooreNemecek2018/test_plantationProductiveLifespan.py,sha256=ifvjTX
1007
1013
  tests/models/pooreNemecek2018/test_rotationDuration.py,sha256=tD2E91beAXdyT-xf5QSqc7kp5UPDDEaCE-FgsoSGorg,923
1008
1014
  tests/models/pooreNemecek2018/test_saplings.py,sha256=S70y9JUplSH9MIrrBUkrGsVsN9ZEBplTugyR-b-n6ZY,1643
1009
1015
  tests/models/poschEtAl2008/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1010
- tests/models/poschEtAl2008/test_terrestrialAcidificationPotentialAccumulatedExceedance.py,sha256=NJ_W-ypWwjBuGiaXUeJvaQ9ZufoqlSWk1NYE9tt94ZA,1612
1011
- tests/models/poschEtAl2008/test_terrestrialEutrophicationPotentialAccumulatedExceedance.py,sha256=m-AUbdVDBEFEcmNOv13cYvNZQgDMYhHX33kfWywXQWM,1485
1016
+ tests/models/poschEtAl2008/test_terrestrialAcidificationPotentialAccumulatedExceedance.py,sha256=AlDvYqNq8TFPDNtgdSr1dNP-_Rqzbvoxq8ribh8AeEc,1876
1017
+ tests/models/poschEtAl2008/test_terrestrialEutrophicationPotentialAccumulatedExceedance.py,sha256=0-hn3Ssu5cfJor_Mq5DYzLlgXiw9ulARlBa_ovJGMbg,1875
1012
1018
  tests/models/recipe2016Egalitarian/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1013
1019
  tests/models/recipe2016Egalitarian/test_damageToFreshwaterEcosystemsSpeciesYear.py,sha256=OC8WjzPuyz5fd_E-LxFbOg3sasVc6LMJ9UK-jAKO7LU,697
1014
1020
  tests/models/recipe2016Egalitarian/test_damageToHumanHealth.py,sha256=fWjzC9r6itihyW6AdmDkotbhML_0KavXernOpnK1SmY,677
@@ -1162,8 +1168,8 @@ tests/models/utils/test_term.py,sha256=M5Sa26v2gzQYbZ4H_fo7DspnaCx__-WtL-MULGapC
1162
1168
  tests/models/utils/test_time_series.py,sha256=LMhRPf8rp3nAriKAC-2K3FDkrMWntRTUUCERw7Lt68g,2686
1163
1169
  tests/models/webbEtAl2012AndSintermannEtAl2012/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1164
1170
  tests/models/webbEtAl2012AndSintermannEtAl2012/test_nh3ToAirOrganicFertiliser.py,sha256=qi2FNXS5Af2WDtm7nq_FsprH3BfCF0XxnE0XHmC4aIY,2244
1165
- hestia_earth_models-0.64.8.dist-info/LICENSE,sha256=AC7h7GAgCZGJK_Tzh6LUCrML9gQEfowWwecEw2w54QM,1154
1166
- hestia_earth_models-0.64.8.dist-info/METADATA,sha256=4UYoZURD_6LGH95ysuWrhXju7wQe7L1gXJSFQjRB7Ns,3343
1167
- hestia_earth_models-0.64.8.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
1168
- hestia_earth_models-0.64.8.dist-info/top_level.txt,sha256=1dqA9TqpOLTEgpqa-YBsmbCmmNU1y56AtfFGEceZ2A0,19
1169
- hestia_earth_models-0.64.8.dist-info/RECORD,,
1171
+ hestia_earth_models-0.64.9.dist-info/LICENSE,sha256=AC7h7GAgCZGJK_Tzh6LUCrML9gQEfowWwecEw2w54QM,1154
1172
+ hestia_earth_models-0.64.9.dist-info/METADATA,sha256=oM-ufMyDov0e8MyRBXejcGC4lcvzzkR0Hhi0ykZ3TgI,3343
1173
+ hestia_earth_models-0.64.9.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
1174
+ hestia_earth_models-0.64.9.dist-info/top_level.txt,sha256=1dqA9TqpOLTEgpqa-YBsmbCmmNU1y56AtfFGEceZ2A0,19
1175
+ hestia_earth_models-0.64.9.dist-info/RECORD,,
@@ -1,71 +1,107 @@
1
1
  import json
2
2
  from unittest.mock import patch
3
3
 
4
- from hestia_earth.models.environmentalFootprintV3.soilQualityIndexLandOccupation import MODEL, TERM_ID, run, _should_run
4
+ import pytest
5
+
6
+ from hestia_earth.models.environmentalFootprintV3.soilQualityIndexLandOccupation import MODEL, TERM_ID, run, \
7
+ _should_run
5
8
  from tests.utils import fixtures_path, fake_new_indicator
6
9
 
7
10
  class_path = f"hestia_earth.models.{MODEL}.{TERM_ID}"
8
11
  fixtures_folder = f"{fixtures_path}/{MODEL}/{TERM_ID}"
9
12
 
10
-
11
- with open(f"{fixtures_path}/impact_assessment/emissions/impact-assessment.jsonld", encoding='utf-8') as f:
12
- impact = json.load(f)
13
-
14
-
15
- def test_should_run():
16
- with open(f"{fixtures_folder}/cycle.jsonld", encoding='utf-8') as f:
17
- cycle = json.load(f)
18
-
19
- # a LandCover type with no CF => no run
20
- cycle['site']['management'] = [{"endDate": "2024-03-31", "@type": "Management",
21
- "term": {"termType": "landCover", "@type": "Term", "@id": "ocean"}}]
22
-
23
- should_run, *args = _should_run({'cycle': cycle})
24
- assert not should_run
25
-
26
- # no management => no run
27
- cycle['site']['management'] = []
28
- should_run, *args = _should_run({'cycle': cycle})
29
- assert not should_run
13
+ crop_land = {"@id": "cropland", "termType": "landCover"}
14
+ sea_land_cover = {"@id": "seaOrOcean", "termType": "landCover"}
15
+ forest = {"@id": "forest", "termType": "landCover"}
16
+
17
+ wrong_indicator = {"term": {"@id": "NOT_landOccupationInputsProduction", "termType": "resourceUse", "units": "m2*year"},
18
+ "value": 0.5, "landCover": crop_land}
19
+
20
+ indicator_no_land_cover = {
21
+ "term": {"@id": "landOccupationInputsProduction", "termType": "resourceUse", "units": "m2*year"},
22
+ "value": 0.5}
23
+
24
+ indicator_no_unit = {"term": {"@id": "landOccupationInputsProduction", "termType": "resourceUse"},
25
+ "value": 0.5, "landCover": crop_land}
26
+
27
+ indicator_wrong_unit = {
28
+ "term": {"@id": "landOccupationInputsProduction", "termType": "resourceUse", "units": "ha*day"}, "value": 0.5,
29
+ "landCover": crop_land}
30
+
31
+ indicator_bad_area_time_value = {
32
+ "term": {"@id": "landOccupationInputsProduction", "termType": "resourceUse", "units": "m2*year"}, "value": 0,
33
+ "landCover": crop_land}
34
+
35
+ inputs_production_indicator_no_cf = {
36
+ "term": {"@id": "landOccupationInputsProduction", "termType": "resourceUse", "units": "m2*year"}, "value": 0.5,
37
+ "landCover": sea_land_cover}
38
+
39
+ good_inputs_production_indicator_cropland = {
40
+ "term": {"@id": "landOccupationInputsProduction", "termType": "resourceUse", "units": "m2*year"}, "value": 0.5,
41
+ "landCover": crop_land}
42
+
43
+ good_inputs_production_indicator_forest = {
44
+ "term": {"@id": "landOccupationInputsProduction", "termType": "resourceUse", "units": "m2*year"}, "value": 0.5,
45
+ "landCover": forest}
46
+
47
+ good_during_cycle_indicator_cropland = {
48
+ "term": {"@id": "landOccupationDuringCycle", "termType": "resourceUse", "units": "m2*year"}, "value": 0.5,
49
+ "landCover": crop_land}
50
+
51
+ good_during_cycle_indicator_forest = {
52
+ "term": {"@id": "landOccupationDuringCycle", "termType": "resourceUse", "units": "m2*year"}, "value": 0.5,
53
+ "landCover": forest}
54
+
55
+
56
+ @pytest.mark.parametrize(
57
+ "resources, expected, num_inputs",
58
+ [
59
+ ([], False, 0),
60
+ ([wrong_indicator], False, 0),
61
+ ([indicator_no_land_cover], False, 0),
62
+ ([indicator_no_unit], False, 0),
63
+ ([indicator_wrong_unit], False, 0),
64
+ ([indicator_bad_area_time_value], False, 0),
65
+ ([inputs_production_indicator_no_cf], True, 0),
66
+ ([good_during_cycle_indicator_cropland], True, 1),
67
+ ([good_during_cycle_indicator_cropland, good_inputs_production_indicator_forest], True, 2),
68
+ ([good_during_cycle_indicator_cropland, inputs_production_indicator_no_cf], True, 1),
69
+ ([good_during_cycle_indicator_cropland, good_during_cycle_indicator_forest,
70
+ good_inputs_production_indicator_forest, good_inputs_production_indicator_cropland], True, 4),
71
+
72
+ ],
73
+ ids=["No emissionsResourceUse => no run",
74
+ "Wrong indicator termid => no run",
75
+ "Indicator no landcover terms => no run",
76
+ "Missing unit => no run",
77
+ "Wrong unit => no run",
78
+ "Bad area*time value => no run",
79
+ "Input with no cf => run, empty input",
80
+ "One good input => run, 1 dict",
81
+ "Two good input => run, 2 dict",
82
+ "One good input and One with no CF => run, 2 dict",
83
+ "Multiple good indicators with same id => run, 4 dict",
84
+ ]
85
+ )
86
+ def test_should_run(resources, expected, num_inputs):
87
+ with open(f"{fixtures_folder}/impact-assessment.jsonld", encoding='utf-8') as f:
88
+ impactassessment = json.load(f)
89
+
90
+ impactassessment['emissionsResourceUse'] = resources
91
+
92
+ should_run, resources_with_cf = _should_run(impactassessment)
93
+ assert should_run is expected
94
+ assert len(resources_with_cf) == num_inputs
30
95
 
31
96
 
32
97
  @patch(f"{class_path}._new_indicator", side_effect=fake_new_indicator)
33
98
  def test_run(*args):
34
- with open(f"{fixtures_folder}/cycle.jsonld", encoding='utf-8') as f:
35
- cycle = json.load(f)
99
+ with open(f"{fixtures_folder}/impact-assessment.jsonld", encoding='utf-8') as f:
100
+ impact = json.load(f)
36
101
 
37
102
  with open(f"{fixtures_folder}/result.jsonld", encoding='utf-8') as f:
38
103
  expected = json.load(f)
39
104
 
40
- impact['cycle'] = cycle
41
- value = run(impact)
42
- assert value == expected
43
-
44
-
45
- @patch(f"{class_path}._new_indicator", side_effect=fake_new_indicator)
46
- def test_run_other_sites(*args):
47
- """
48
- This test case contains 2 sites:
49
- One is a crop in france, with value:
50
- CF_METHOD_factor_france_permanent_crops * ( siteArea_france_crop * time_in_years )
51
- = 87.631 * ( 1.0082662E-7 * 1 )
52
- = 8.835537537220001e-06
53
-
54
- And one a forest in italy, with value:
55
- CF_METHOD_factor_italy_forest * ( siteArea_italy_forest * time_in_years )
56
- = 43.198 * ( 1.3573373E-9 * 1 )
57
- = 5.86342566854E-08
58
-
59
- We expect the model to return 8.835537537220001e-06 + 5.86342566854E-08 = 8.894171793905402e-06
60
-
61
- """
62
- with open(f"{fixtures_folder}/otherSites/cycle.jsonld", encoding='utf-8') as f:
63
- cycle = json.load(f)
64
-
65
- with open(f"{fixtures_folder}/otherSites/result.jsonld", encoding='utf-8') as f:
66
- expected = json.load(f)
67
-
68
- impact['cycle'] = cycle
69
105
  value = run(impact)
70
106
  assert value == expected
71
107
 
@@ -75,21 +111,18 @@ def test_run_with_subclass_landcover(*args):
75
111
  """
76
112
  Example data:
77
113
  Country: Italy
78
- Quantity in m^2: 1.3573373E-9
79
- CF METHOD factor: 4.3198E+01
80
- "Charact Result [soil quality index]" result also in result.jsonld : 5.86342566854E-08
81
- siteArea in test file in ha: 1.3573373E-9 / 10 000 = 1.3573373e-13
114
+ Quantity in m2*year: 1
115
+ CF METHOD factor: 50.438
82
116
 
83
117
  landCover field "plantationForest" should map to
84
118
  Name Flow: "forest, intensive Land occupation"
85
119
  """
86
- with open(f"{fixtures_folder}/plantationForest/cycle.jsonld", encoding='utf-8') as f:
87
- cycle = json.load(f)
88
120
 
121
+ with open(f"{fixtures_folder}/plantationForest/impact-assessment.jsonld", encoding='utf-8') as f:
122
+ impact = json.load(f)
89
123
  with open(f"{fixtures_folder}/plantationForest/result.jsonld", encoding='utf-8') as f:
90
124
  expected = json.load(f)
91
125
 
92
- impact['cycle'] = cycle
93
126
  value = run(impact)
94
127
  assert value == expected
95
128
 
@@ -99,13 +132,12 @@ def test_run_with_region_missing_data(*args):
99
132
  """
100
133
  When given valid sub-region or country not in the lookup file should default to 'region-world'
101
134
  """
102
- with open(f"{fixtures_folder}/default-region-world/cycle.jsonld", encoding='utf-8') as f:
103
- cycle = json.load(f)
135
+ with open(f"{fixtures_folder}/default-region-world/impact-assessment.jsonld", encoding='utf-8') as f:
136
+ impact = json.load(f)
104
137
 
105
138
  with open(f"{fixtures_folder}/default-region-world/result.jsonld", encoding='utf-8') as f:
106
139
  expected = json.load(f)
107
140
 
108
- impact['cycle'] = cycle
109
141
  value = run(impact)
110
142
  assert value == expected
111
143
 
@@ -115,14 +147,13 @@ def test_run_with_no_region(*args):
115
147
  """
116
148
  When no location is specified, defaults to region world.
117
149
  """
118
- with open(f"{fixtures_folder}/cycle.jsonld", encoding='utf-8') as f:
119
- cycle = json.load(f)
150
+ with open(f"{fixtures_folder}/default-region-world/impact-assessment.jsonld", encoding='utf-8') as f:
151
+ impact = json.load(f)
120
152
 
121
- del cycle['site']['country']
153
+ del impact['country']
122
154
 
123
155
  with open(f"{fixtures_folder}/default-region-world/result.jsonld", encoding='utf-8') as f:
124
156
  expected = json.load(f)
125
157
 
126
- impact['cycle'] = cycle
127
158
  value = run(impact)
128
159
  assert value == expected