hestia-earth-models 0.74.1__py3-none-any.whl → 0.74.3__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 (40) hide show
  1. hestia_earth/models/config/Cycle.json +23 -0
  2. hestia_earth/models/config/ImpactAssessment.json +1 -1
  3. hestia_earth/models/cycle/aboveGroundCropResidueTotal.py +50 -0
  4. hestia_earth/models/cycle/completeness/freshForage.py +2 -2
  5. hestia_earth/models/emepEea2019/co2ToAirFuelCombustion.py +2 -27
  6. hestia_earth/models/emepEea2019/fuelCombustion_utils.py +107 -0
  7. hestia_earth/models/emepEea2019/n2OToAirFuelCombustionDirect.py +2 -27
  8. hestia_earth/models/emepEea2019/nh3ToAirFuelCombustion.py +33 -0
  9. hestia_earth/models/emepEea2019/noxToAirFuelCombustion.py +2 -27
  10. hestia_earth/models/emepEea2019/so2ToAirFuelCombustion.py +2 -27
  11. hestia_earth/models/emepEea2019/utils.py +1 -73
  12. hestia_earth/models/hestia/landCover.py +6 -5
  13. hestia_earth/models/hestia/landOccupationDuringCycle.py +264 -0
  14. hestia_earth/models/hestia/management.py +109 -68
  15. hestia_earth/models/hestia/utils.py +0 -1
  16. hestia_earth/models/ipcc2006/aboveGroundCropResidueTotal.py +20 -11
  17. hestia_earth/models/ipcc2019/aboveGroundCropResidueTotal.py +37 -28
  18. hestia_earth/models/ipcc2019/animal/pastureGrass.py +15 -8
  19. hestia_earth/models/ipcc2019/animal/utils.py +2 -2
  20. hestia_earth/models/ipcc2019/pastureGrass.py +7 -2
  21. hestia_earth/models/mocking/search-results.json +1566 -1562
  22. hestia_earth/models/utils/cropResidue.py +5 -0
  23. hestia_earth/models/version.py +1 -1
  24. {hestia_earth_models-0.74.1.dist-info → hestia_earth_models-0.74.3.dist-info}/METADATA +1 -1
  25. {hestia_earth_models-0.74.1.dist-info → hestia_earth_models-0.74.3.dist-info}/RECORD +40 -33
  26. tests/models/cycle/test_aboveGroundCropResidueTotal.py +20 -0
  27. tests/models/emepEea2019/test_co2ToAirFuelCombustion.py +2 -1
  28. tests/models/emepEea2019/test_n2OToAirFuelCombustionDirect.py +2 -1
  29. tests/models/emepEea2019/test_nh3ToAirFuelCombustion.py +34 -0
  30. tests/models/emepEea2019/test_noxToAirFuelCombustion.py +2 -1
  31. tests/models/emepEea2019/test_so2ToAirFuelCombustion.py +2 -1
  32. tests/models/environmentalFootprintV3_1/test_scarcityWeightedWaterUse.py +0 -1
  33. tests/models/hestia/test_landCover.py +1 -1
  34. tests/models/hestia/test_landOccupationDuringCycle.py +68 -0
  35. tests/models/hestia/test_management.py +29 -1
  36. tests/models/ipcc2006/test_aboveGroundCropResidueTotal.py +9 -6
  37. tests/models/ipcc2019/test_aboveGroundCropResidueTotal.py +16 -42
  38. {hestia_earth_models-0.74.1.dist-info → hestia_earth_models-0.74.3.dist-info}/LICENSE +0 -0
  39. {hestia_earth_models-0.74.1.dist-info → hestia_earth_models-0.74.3.dist-info}/WHEEL +0 -0
  40. {hestia_earth_models-0.74.1.dist-info → hestia_earth_models-0.74.3.dist-info}/top_level.txt +0 -0
@@ -27,3 +27,8 @@ def get_crop_residue_burnt_value(cycle: dict):
27
27
  ])
28
28
  data_complete = _is_term_type_complete(cycle, TermTermType.CROPRESIDUE)
29
29
  return 0 if len(value) == 0 and data_complete else list_sum(value, default=None)
30
+
31
+
32
+ def sum_above_ground_crop_residue(cycle: dict):
33
+ products = [p for p in cycle.get('products', []) if p.get('term', {}).get('@id') in crop_residue_product_ids()]
34
+ return list_sum(value=flatten([v.get('value') or [] for v in products]), default=0)
@@ -1 +1 @@
1
- VERSION = '0.74.1'
1
+ VERSION = '0.74.3'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hestia-earth-models
3
- Version: 0.74.1
3
+ Version: 0.74.3
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
@@ -5,7 +5,7 @@ hestia_earth/models/cache_sites.py,sha256=XpXnkYt823PQzrswgP__L4CT8xZG_n7a41CIHK
5
5
  hestia_earth/models/log.py,sha256=LQ6nRMc5q8-xs8DsAx9h8drWhWLkqDG9dFlG9OzFbeA,3780
6
6
  hestia_earth/models/preload_requests.py,sha256=vK_G1UzhNMhYy7ymnCtHUz_vv3cfApCSKqv29VREEBQ,1943
7
7
  hestia_earth/models/requirements.py,sha256=eU4yT443fx7BnaokhrLB_PCizJI7Y6m4auyo8vQauNg,17363
8
- hestia_earth/models/version.py,sha256=01w2HI_2GS6fG7AW09ahC1rJV6xKpN5vFe2tKX3O8Vw,19
8
+ hestia_earth/models/version.py,sha256=8dyqMaDk9nHtPesdPrR7_TyegVyeuFku5C-Q8cGV0cU,19
9
9
  hestia_earth/models/agribalyse2016/__init__.py,sha256=WvK0qCQbnYtg9oZxrACd1wGormZyXibPtpCnIQeDqbw,415
10
10
  hestia_earth/models/agribalyse2016/fuelElectricity.py,sha256=1ngl8pdxeNhlVV8keAeWRwGorr_1uFXM9EoPUWx-uSc,4382
11
11
  hestia_earth/models/agribalyse2016/machineryInfrastructureDepreciatedAmountPerCycle.py,sha256=queToXuzq0tQ9_XuUJ2pJgSywXmbt9uX3ZoIKgqkROM,2660
@@ -37,13 +37,14 @@ hestia_earth/models/cml2001Baseline/terrestrialAcidificationPotentialIncludingFa
37
37
  hestia_earth/models/cml2001NonBaseline/__init__.py,sha256=vI8wp8Og_e8DiJqYYvp33YoI3t4ffAC31LWlnV20JTg,419
38
38
  hestia_earth/models/cml2001NonBaseline/eutrophicationPotentialIncludingFateAverageEurope.py,sha256=lcgyRHY08KCBFPERJNqV4DYGEJCvyHBDnJXD0kEkVqM,1097
39
39
  hestia_earth/models/cml2001NonBaseline/terrestrialAcidificationPotentialExcludingFate.py,sha256=xcrxfs9UoV_EWvV-XzMt35oPWCUsTzqg2SGA3j2MFIw,1091
40
- hestia_earth/models/config/Cycle.json,sha256=jnCp-cI4Bcg0REa6hW9f9lHrVzmiFp6s2SuRrjM7HLw,60340
41
- hestia_earth/models/config/ImpactAssessment.json,sha256=8RtgFdfFd0t8gb6sM4iyfHFE2dKgMld5Qg-cykapabY,60300
40
+ hestia_earth/models/config/Cycle.json,sha256=CifX2AMdnGKf4iq51exXVVio9xwNeONkRyvUbCRcEaM,60950
41
+ hestia_earth/models/config/ImpactAssessment.json,sha256=FroQbv8z8C5-bZMIZtAV3gBZG14OPr9sn7XuJr4PiKc,60290
42
42
  hestia_earth/models/config/Site.json,sha256=4DPSziHnDIngyub3Of8OvDEKa446q3Yx48R2Eobqk24,14374
43
43
  hestia_earth/models/config/__init__.py,sha256=7ZqOGd4dO2Stonte6fbktVZqbY7vp8Ls_LifgofCu8I,3009
44
44
  hestia_earth/models/config/run-calculations.json,sha256=e3nJ4M6CP1iFzfv8ou_ZUFbFxYkDxJgwuNDXTm4PBDc,615
45
45
  hestia_earth/models/config/trigger-calculations.json,sha256=3dmn2bRuj6QEtSTOLdIy31ho7thgUXyDsnqZzPV9rAQ,623
46
46
  hestia_earth/models/cycle/__init__.py,sha256=VowO3kOHb0LpURsljNaJsYO7s6vgjhul6bF_85UjUEI,406
47
+ hestia_earth/models/cycle/aboveGroundCropResidueTotal.py,sha256=VU4Xm5ZQ4u1uZNq445DUXwW15JXWwQl4hhRZ6mXjin4,1506
47
48
  hestia_earth/models/cycle/cycleDuration.py,sha256=UON8NjmfPpU2z0sRYmhytjv-zlGewbAzdl5OCVGWDc0,2925
48
49
  hestia_earth/models/cycle/endDate.py,sha256=lRJza_G41eC-48uRtn5qcx9V1u90T6dVIYuypNaEvDY,1499
49
50
  hestia_earth/models/cycle/otherSitesArea.py,sha256=ZBuoYG9YyEnwrUsORw5RDPB56JZMSSY_GHApeJdYBAs,1492
@@ -66,7 +67,7 @@ hestia_earth/models/cycle/completeness/animalFeed.py,sha256=_qUJcQ2ggdy0fBCBkHme
66
67
  hestia_earth/models/cycle/completeness/cropResidue.py,sha256=7SNfYvP4erJ2keem3DHdOzuzzuAsrj15iffacWNgJHE,2653
67
68
  hestia_earth/models/cycle/completeness/electricityFuel.py,sha256=ZXljdjAxYgu75GdHioYjNYTgF97LClEP_1g3hFcvJYU,1927
68
69
  hestia_earth/models/cycle/completeness/excreta.py,sha256=wgrinfKnsXMG4I01g0iyFIpz2Ir-T69YB00pgrM_zvY,821
69
- hestia_earth/models/cycle/completeness/freshForage.py,sha256=UBBPlixmiffDGck-XvJ7wGiJeRA1L8Wm0qrzXUbe5KA,2222
70
+ hestia_earth/models/cycle/completeness/freshForage.py,sha256=4gKLpZN_WxYU9W6VNpRshSu5oJktBVzbU_7XPhUKByY,2224
70
71
  hestia_earth/models/cycle/completeness/material.py,sha256=cF33MJkVBUnoicmecdsR78Snrv1Zng097aUeEfYDfdc,1185
71
72
  hestia_earth/models/cycle/completeness/seed.py,sha256=O4OygpPOeXHbn_32rdUk8m1BcZiQ6QpmvV463UOCmKY,1763
72
73
  hestia_earth/models/cycle/completeness/soilAmendment.py,sha256=RQPq1Y5VWJbz50tKFtcW54DdQ1YT48mQOteidW8sFcQ,1226
@@ -113,16 +114,18 @@ hestia_earth/models/ecoinventV3AndEmberClimate/utils.py,sha256=6niH2MArBK4KFzW-P
113
114
  hestia_earth/models/edip2003/__init__.py,sha256=nyB0CI2gNmRAXj-203aJHQMmETYhcY-dHbMABOhJ7YI,409
114
115
  hestia_earth/models/edip2003/ozoneDepletionPotential.py,sha256=YkBct4eDUidGukaVdd2iaEouq_FckuG8l_7pgBQgCBw,1033
115
116
  hestia_earth/models/emepEea2019/__init__.py,sha256=l90-pWrqIzt1ap1WNk0gF4iZeF5_TSG62hE83bIi4rQ,412
116
- hestia_earth/models/emepEea2019/co2ToAirFuelCombustion.py,sha256=TPzbKxV-AZ9yx_tJNGhuNsfRJQNfH4a0JEtPGLKc-tA,1833
117
- hestia_earth/models/emepEea2019/n2OToAirFuelCombustionDirect.py,sha256=HwagFnpCAeAqf-xm-J2AlVfbkFcC4j9VffOQJcYWlGk,1839
117
+ hestia_earth/models/emepEea2019/co2ToAirFuelCombustion.py,sha256=f59-XXhUlPw8L80Q9TATkNZf5Pw9LJlofZWfVJNIL9E,814
118
+ hestia_earth/models/emepEea2019/fuelCombustion_utils.py,sha256=IA7qsye4esAOpcpwvkRMHdQHgsjhkSxd325lQp67N_M,4103
119
+ hestia_earth/models/emepEea2019/n2OToAirFuelCombustionDirect.py,sha256=6IJSNDMXSeuf9_XGmEll8LxusYnEzVR3WadoVj999j8,860
118
120
  hestia_earth/models/emepEea2019/nh3ToAirExcreta.py,sha256=DssSjl_Kug9jE5laqJs9X4xOdOrJBnsXSnk-uA_anyE,2153
121
+ hestia_earth/models/emepEea2019/nh3ToAirFuelCombustion.py,sha256=wbruN-aO3Cj8FCaHbXxlom2AYm_7Jef113EbkXHhj4w,814
119
122
  hestia_earth/models/emepEea2019/nh3ToAirInorganicFertiliser.py,sha256=7G0_S0G6X9slTykxs6CDb68DvtXB7yfq1iSKg0ReXS8,6036
120
- hestia_earth/models/emepEea2019/noxToAirFuelCombustion.py,sha256=OlrCPBuOBGlvPh_ufO8fFzSvxvkJduX7tlqzEab6qzs,1833
123
+ hestia_earth/models/emepEea2019/noxToAirFuelCombustion.py,sha256=hJv7vGM2JlKv6E4w2OnwIcjLIt67FFVBPplhGi0X-qw,814
121
124
  hestia_earth/models/emepEea2019/pm10ToAirAnimalHousing.py,sha256=7LhOEQokWMWEPspYSQO3PtsmWkygbVAonj_Nq6JAL6c,1384
122
125
  hestia_earth/models/emepEea2019/pm25ToAirAnimalHousing.py,sha256=IzGQrRv9Pk0o1Vq18HRWZ10jhmjFG59ijfn_VYAUJIA,1384
123
- hestia_earth/models/emepEea2019/so2ToAirFuelCombustion.py,sha256=OC53aE0uCmUxgZcqQjyhjjFPZ5U5Rdfv8l8wYihcYY4,1833
126
+ hestia_earth/models/emepEea2019/so2ToAirFuelCombustion.py,sha256=uJWbJJ2LK-DKLLwJJpJigkMy79xR-Q4nZpY7gthP-Mg,814
124
127
  hestia_earth/models/emepEea2019/tspToAirAnimalHousing.py,sha256=TaT5GyYK6MyJQHKApBe-u4fMjqXXdmuBEtUcRYnkhac,1381
125
- hestia_earth/models/emepEea2019/utils.py,sha256=MWIH4jTwzXMMvfX5FBpnb5sdGvSUSrCkPnMkXGfEpcQ,5603
128
+ hestia_earth/models/emepEea2019/utils.py,sha256=zbnpTZbq8OrcqnVKRUIEdqet69sEfnYNuQUNXw7mflY,2955
126
129
  hestia_earth/models/emissionNotRelevant/__init__.py,sha256=yAunIZI_4nGV0khRiGhbZAmXmMiuICzEH-pvzWX1lpM,3000
127
130
  hestia_earth/models/environmentalFootprintV3_1/__init__.py,sha256=tF2WrWiV1Wzi2vnRiNXdfPWfmVxgVu9w9-7eA6PA7-s,473
128
131
  hestia_earth/models/environmentalFootprintV3_1/environmentalFootprintSingleOverallScore.py,sha256=i7Er5qYAj14MuiUvWSTi6OjQ4P7pwrslQxSFUYGM0zg,5718
@@ -208,12 +211,13 @@ hestia_earth/models/hestia/freshWater.py,sha256=Q-dmFJLZfyYEyFyYkJUOjgmQR3G5YXCX
208
211
  hestia_earth/models/hestia/histosol.py,sha256=IexiWTSlSJYGjrdpYmRooW6v8LjhYATPQ8smMz1UZBA,1612
209
212
  hestia_earth/models/hestia/inorganicFertiliser.py,sha256=We4PBaTXyGwEQTfhX0-J8Xt03p-FB9i9j3tEK5JQ8uE,9026
210
213
  hestia_earth/models/hestia/irrigatedTypeUnspecified.py,sha256=VdYzfYxcRzWv21qxRkDn9HBid7-Bt_CgIv4iyXJH03g,1929
211
- hestia_earth/models/hestia/landCover.py,sha256=9TLHpxjF0ceZYWiOSs96TCoOmIO4Bq0ELepNS9ApquE,39474
214
+ hestia_earth/models/hestia/landCover.py,sha256=1pm_F79ANQHi8oeKkV24koiaSGCNRtzYBk3f38k-Bpk,39463
215
+ hestia_earth/models/hestia/landOccupationDuringCycle.py,sha256=F3JwyptK9RgiCWgbB3J_Znj9UXfXejUE-3vgb0ZgYW8,8324
212
216
  hestia_earth/models/hestia/landTransformation100YearAverageDuringCycle.py,sha256=hF7_DDvrs7swH6ott_ihgYx13UzEKHH6pccYCtzrN8o,1069
213
217
  hestia_earth/models/hestia/landTransformation20YearAverageDuringCycle.py,sha256=05SCH6ZjEV3mIleRusBg677zu0xgu5YK0f9FCddgNPg,1067
214
218
  hestia_earth/models/hestia/liveAnimal.py,sha256=d7HuUi40c-7TN1kecdRuqbht8PAe7x4ps0NhSuWG34Q,3868
215
219
  hestia_earth/models/hestia/longFallowRatio.py,sha256=LkJaER1VNDI5351-oC8tru-LgiPK3sNMg0NhB5ic9RE,1690
216
- hestia_earth/models/hestia/management.py,sha256=zLCdYekoyxzAsEcBIr04paDjatD3_WhK2QxqfIAQQh8,11292
220
+ hestia_earth/models/hestia/management.py,sha256=nvbqjxR4spBVh9IzzduRp5BStDd7wyKTpkkJenUYObo,13447
217
221
  hestia_earth/models/hestia/materialAndSubstrate.py,sha256=abmM_7FOY5yaNb2yZEm-ncI4wFFcbzaebtnG9XWEA6M,5130
218
222
  hestia_earth/models/hestia/milkYield.py,sha256=__3AdxRTUTWwS_GsqxFpPGklmTnnpADiN0khlRCMAss,5541
219
223
  hestia_earth/models/hestia/netPrimaryProduction.py,sha256=TXBw7qkTYlvViMrM027FejVpwyqnzJ8VazsbWakwd70,1870
@@ -245,7 +249,7 @@ hestia_earth/models/hestia/temperatureAnnual.py,sha256=IhMoO-SkSp1JBxgu9bSr1OCtr
245
249
  hestia_earth/models/hestia/temperatureMonthly.py,sha256=sY4MrjCTm7X3BoDTUC0ZkxD7CWxvl51JW2UxDykCKzg,1842
246
250
  hestia_earth/models/hestia/totalNitrogenPerKgSoil.py,sha256=hpyYqMwO9TvZjrpQuSBA3uRFrOk_PPZEo9ev4QeECI4,1956
247
251
  hestia_earth/models/hestia/unknownPreSeasonWaterRegime.py,sha256=Ix7Eg4NVW1iKvPKIOqOdSkahn7BlJNtPM8nlrogrfcM,1460
248
- hestia_earth/models/hestia/utils.py,sha256=CMBo5wR47fyPkIH6k3ihWhFB-XyQfkv7O4CJOm_rJOc,4888
252
+ hestia_earth/models/hestia/utils.py,sha256=oTdk7VKuaxDTKj9Cz4t3qp3RZ5wSt3bZXpPiImgIIto,4768
249
253
  hestia_earth/models/hestia/waterDepth.py,sha256=gnvd1kwbTCt9HjgxlKzuCGkPi8Sq7nQiHFbk8xBAZV0,1251
250
254
  hestia_earth/models/hestia/waterSalinity.py,sha256=YkiLEljMd4xHT0bKv-nXbgOXcaEQmLDlSwpFrfg49ow,2962
251
255
  hestia_earth/models/hestia/feedConversionRatio/__init__.py,sha256=G4T1jfN1OqERsywiWyrBiFneUZs5QXpChz7dgGfg9Ko,2512
@@ -270,7 +274,7 @@ hestia_earth/models/impact_assessment/product/economicValueShare.py,sha256=ssyuA
270
274
  hestia_earth/models/impact_assessment/product/value.py,sha256=NaqKctYbXtbxLqJ8DougTDEDygDVvMZpwc9cLPD6TXE,1182
271
275
  hestia_earth/models/ipcc2006/__init__.py,sha256=ReUFPLqIyp16QEOGaiHmz41QbuwYBQYDKVtw6KuRDIA,409
272
276
  hestia_earth/models/ipcc2006/aboveGroundCropResidueRemoved.py,sha256=WnFcVr6X5RUVk0wKnBb4CaJSCr-DaweVjnXKFAa6kdg,2761
273
- hestia_earth/models/ipcc2006/aboveGroundCropResidueTotal.py,sha256=Xwf4a4P88r0vlQFFQBhir_g58xeF6WbqNW42CIu7Rpc,3558
277
+ hestia_earth/models/ipcc2006/aboveGroundCropResidueTotal.py,sha256=t7dgnt-paH32EvCLMK4qUN2Dwa4YkqhI_lpPiGdv82w,3959
274
278
  hestia_earth/models/ipcc2006/belowGroundCropResidue.py,sha256=aT5wUhda6OOsEX_FszRLJAohJxpRCd5RxEUWK49HEhI,4287
275
279
  hestia_earth/models/ipcc2006/n2OToAirCropResidueDecompositionDirect.py,sha256=_2oTngpspikbFwgFTtOWs-SgEVF8LzznvITGITTtol4,2913
276
280
  hestia_earth/models/ipcc2006/n2OToAirCropResidueDecompositionIndirect.py,sha256=kf4WjdMzs6d8h433LFuUH9LJKJ_aMHTqEHDToGY5-Xk,2315
@@ -287,7 +291,7 @@ hestia_earth/models/ipcc2013IncludingFeedbacks/__init__.py,sha256=VJ16KIGQQHybzZ
287
291
  hestia_earth/models/ipcc2013IncludingFeedbacks/gwp100.py,sha256=HR2vnOc64mg_fxe9m5NmqxBZ8-aFuKb44gmItyuRL1s,1041
288
292
  hestia_earth/models/ipcc2019/__init__.py,sha256=LdRpu8KbEc-MroIwXfKDjfj-xbgmfUYgctjKVvtpRfQ,409
289
293
  hestia_earth/models/ipcc2019/aboveGroundBiomass.py,sha256=T50NcJoyGrHYUSzJBXJKAOVUWHvFwUeUCZxuDZKqoO0,20416
290
- hestia_earth/models/ipcc2019/aboveGroundCropResidueTotal.py,sha256=lT2QVV5c2LvQqZRfPEvFT_bMTayMXgIsFLnx8I6iYzw,3089
294
+ hestia_earth/models/ipcc2019/aboveGroundCropResidueTotal.py,sha256=GSI-FmYZuOE12iUyrtIFeo3ctDrw_P0jjZwWvwG4Ffc,3468
291
295
  hestia_earth/models/ipcc2019/belowGroundBiomass.py,sha256=WN3R5kUIc5Ij4HxMFcTGKeNRoPChRY6ws0x3nQNeEMw,19421
292
296
  hestia_earth/models/ipcc2019/belowGroundCropResidue.py,sha256=qbfsLBPaMIt4oQzYAzbsZdkJozTbwuztNr48TLYC5-Y,3507
293
297
  hestia_earth/models/ipcc2019/biocharOrganicCarbonPerHa.py,sha256=6zZOhhDIJVfvvsJfoyBtZsM4akWizQUciVnKHlufMnA,13414
@@ -339,7 +343,7 @@ hestia_earth/models/ipcc2019/organicCarbonPerHa_tier_1.py,sha256=kuLVIW5rJ7UuPep
339
343
  hestia_earth/models/ipcc2019/organicCarbonPerHa_tier_2.py,sha256=vvrwSI9oZIVlLLGMyPoSKW3lOgc2VmF8G-HJJHbgYRc,69220
340
344
  hestia_earth/models/ipcc2019/organicCarbonPerHa_utils.py,sha256=DumXAbH8P97tDyP1nAbtgVrDEceFy0b_xRNZG2h0kbQ,9843
341
345
  hestia_earth/models/ipcc2019/organicSoilCultivation_utils.py,sha256=mJCKYZxqk5vFknckjIjGw478BjZbvKC_xQ-zYpvJ8xM,5628
342
- hestia_earth/models/ipcc2019/pastureGrass.py,sha256=_EwlAooSfrkcSy4rl_rk4PpeX1pcIiQcb7HE2lQkyn8,9847
346
+ hestia_earth/models/ipcc2019/pastureGrass.py,sha256=JijV-UnA_ofB53yPqGPkhf7lMKi_GumfMXVPYGLjBXI,10206
343
347
  hestia_earth/models/ipcc2019/pastureGrass_utils.py,sha256=so5AFrr_0eKXkUoyBpYhHgSXhTQ5z2XADahm2At4RR0,14285
344
348
  hestia_earth/models/ipcc2019/utils.py,sha256=s3khA5nJ0rpFsrwWoIGW0y3OYrYA5Iw2GTxN86gO_K8,5890
345
349
  hestia_earth/models/ipcc2019/animal/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -348,10 +352,10 @@ hestia_earth/models/ipcc2019/animal/hoursWorkedPerDay.py,sha256=BBByUzgM7OymWnuU
348
352
  hestia_earth/models/ipcc2019/animal/liveweightGain.py,sha256=TXEKI0PZFDj7zlg_pmgfwhRT0LS1x1hEswulQYD7Dkg,956
349
353
  hestia_earth/models/ipcc2019/animal/liveweightPerHead.py,sha256=86HRowJnTbwHKDKU0rGaco2-8B1wIQ4nIe_KNqzdXsk,965
350
354
  hestia_earth/models/ipcc2019/animal/milkYieldPerAnimal.py,sha256=p7o3qvQbgq3QWqp4rW8NoyINkSFMQ9QOn9auf7e6gww,2602
351
- hestia_earth/models/ipcc2019/animal/pastureGrass.py,sha256=lT74m-NljewFYdQJIe4he2uYJ9rWWSZSm1MCUrxj0gQ,11742
355
+ hestia_earth/models/ipcc2019/animal/pastureGrass.py,sha256=d-Pp44VSRkYknpc3EDRhnY-5kVGzRwJ00h1WtLMsGCM,12263
352
356
  hestia_earth/models/ipcc2019/animal/pregnancyRateTotal.py,sha256=zib2AW3WJTL4NRYN4a0rRiqSJ5PZLRtwDYia7gigQFY,968
353
357
  hestia_earth/models/ipcc2019/animal/trueProteinContent.py,sha256=fgV0u4sEtLmCk-vUHF6mM03uy1w9nVPDzmxSkLXgPBo,1010
354
- hestia_earth/models/ipcc2019/animal/utils.py,sha256=kRYmqAlUomspQ9wBXikgukjseLljaIo6EdQeOr4OR0s,4369
358
+ hestia_earth/models/ipcc2019/animal/utils.py,sha256=49wX3K5fLDLc33MQJLsGefJ9vlGRwfkNXabc8CGgPQ4,4435
355
359
  hestia_earth/models/ipcc2019/animal/weightAtMaturity.py,sha256=bdNunYwW3D6i81AkWQ-vtv6PObv6V_oZdVvqzk4Caug,2869
356
360
  hestia_earth/models/ipcc2021/__init__.py,sha256=VTgGFKhwMmk_nuI1RRq0in27fHYVPBonlXlPK00K8no,409
357
361
  hestia_earth/models/ipcc2021/gwp100.py,sha256=EQ-OBQrahSgMBFtGregiNlbm3DHVwr67o4e29Z5Gns8,1039
@@ -459,7 +463,7 @@ hestia_earth/models/linkedImpactAssessment/utils.py,sha256=DM6ZUnw23KH0oMKS3jA5q
459
463
  hestia_earth/models/mocking/__init__.py,sha256=9VX50c-grz-snfd-7MBS0KfF7AadtbKuj7kK6PqtsgE,687
460
464
  hestia_earth/models/mocking/build_mock_search.py,sha256=p15ccEUmkmLp1RiGNznxMz3OFHbI8P1-29ExuohiQN8,1355
461
465
  hestia_earth/models/mocking/mock_search.py,sha256=ccFe_WrI73JElFmxp4hPNLCX7eeU--lBC1JFR901KJY,1069
462
- hestia_earth/models/mocking/search-results.json,sha256=lBdCBTFaEcSOTTLpMgkFo_GKYwDs6BmsoACFaB2jFhc,162767
466
+ hestia_earth/models/mocking/search-results.json,sha256=am_PXe2agmnlOcnIVtQ_2V4DvZZjiGYyywAxiWX-Ams,162833
463
467
  hestia_earth/models/pooreNemecek2018/__init__.py,sha256=nPboL7ULJzL5nJD5q7q9VOZt_fxbKVm8fmn1Az5YkVY,417
464
468
  hestia_earth/models/pooreNemecek2018/aboveGroundCropResidueTotal.py,sha256=oXillpppAas1q9GKmODxe1YXyno3EzV-j12xhzkqtTc,2404
465
469
  hestia_earth/models/pooreNemecek2018/belowGroundCropResidue.py,sha256=_pQMPSvI--Xm00H6vXDA4ct_pQXKRGrLE2f-2tQE6y4,2323
@@ -611,7 +615,7 @@ hestia_earth/models/utils/cache_sources.py,sha256=MBkrPpjwNiC4ApDjeYVHZjWBbpvAer
611
615
  hestia_earth/models/utils/completeness.py,sha256=iRG4uviOAQQ4T2Nr4LlelPVTS_F1felGZNJYxek_JG8,1239
612
616
  hestia_earth/models/utils/constant.py,sha256=DmB3VVuoh7Pz2QDBJqiUG6yAML2i0fOy1BPuPHmhT1w,3442
613
617
  hestia_earth/models/utils/crop.py,sha256=GbYwrz3Zd4JU-cwUBijc8GeAK0XgurV3ubwcFIgxhcU,2721
614
- hestia_earth/models/utils/cropResidue.py,sha256=1orh-dhBo2p7HZVjMTTFo8XeFv-razhv5SdtuHPQ1bY,1252
618
+ hestia_earth/models/utils/cropResidue.py,sha256=uEXMnP7qxuH5xFNABlwWeQ-q5jsWfyik-9x1OKgNFHA,1506
615
619
  hestia_earth/models/utils/cropResidueManagement.py,sha256=nIDFjf39rDD10UHSVudfDyu-EiL261g8jyrgS-2aDKw,347
616
620
  hestia_earth/models/utils/currency.py,sha256=f_ArJANb--pZq4LL49SXQ1AMX_oKroqwBXKRRQqZwsM,578
617
621
  hestia_earth/models/utils/cycle.py,sha256=J8ATBSDkhkEPRMRC0ufO8eC_JeGCpkpdvSz2xSTAg-8,16220
@@ -700,6 +704,7 @@ tests/models/cml2001NonBaseline/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm
700
704
  tests/models/cml2001NonBaseline/test_eutrophicationPotentialIncludingFateAverageEurope.py,sha256=Snt0zwI1fF2_ome79rTRZjl5Oc8dZfbcqX8lXwxabVs,910
701
705
  tests/models/cml2001NonBaseline/test_terrestrialAcidificationPotentialExcludingFate.py,sha256=zytN80ZmXjLBSiXPj_G0aaMyMx1aVukJaGouZQDMLBs,907
702
706
  tests/models/cycle/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
707
+ tests/models/cycle/test_aboveGroundCropResidueTotal.py,sha256=rsPafhuiPU7bGs3ltoLfNKxn0W8Cvwb8e81YeXmBhlQ,654
703
708
  tests/models/cycle/test_completeness.py,sha256=Ku1ZSApGaACkXe3ae14yP01C4GssHMwlPG_UPrSytPo,1625
704
709
  tests/models/cycle/test_cycleDuration.py,sha256=2KExiliuOa7_j88rJuPObJKZqq0xsRnFAb0ZEqc5KEM,846
705
710
  tests/models/cycle/test_endDate.py,sha256=6JijuD_-Rih-o-k5DMP1T6fEXgc7F9GhjYLojYJmVKA,1013
@@ -764,14 +769,15 @@ tests/models/ecoinventV3AndEmberClimate/test_cycle.py,sha256=sHCrAGyJ6GCOjlElFpH
764
769
  tests/models/edip2003/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
765
770
  tests/models/edip2003/test_ozoneDepletionPotential.py,sha256=z0kimdTxzSr8_K5eScbkxq2SB9nbBp41IHqVNR4Nh4Y,688
766
771
  tests/models/emepEea2019/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
767
- tests/models/emepEea2019/test_co2ToAirFuelCombustion.py,sha256=SrCx1-mW0s-flisF9Zf6W_A8VtJ67sWga8pGgS713b8,1135
768
- tests/models/emepEea2019/test_n2OToAirFuelCombustionDirect.py,sha256=dTkrj2i5QibBuHaCgV8n2dB02y0nJAwhR35WcOquHOQ,1141
772
+ tests/models/emepEea2019/test_co2ToAirFuelCombustion.py,sha256=r2WNtK-vT3xPmX3HFKRIFJdO_P02Kh7E_UzhUfsaqGU,1178
773
+ tests/models/emepEea2019/test_n2OToAirFuelCombustionDirect.py,sha256=hf048kpFbnWECPbfX8jBuTM_SuIzeIXzhMo_oWEnwlo,1184
769
774
  tests/models/emepEea2019/test_nh3ToAirExcreta.py,sha256=lTPftCJinvokmgUcUikl8hN_axFa8OyCTXvL0PaSRFg,1111
775
+ tests/models/emepEea2019/test_nh3ToAirFuelCombustion.py,sha256=I6TSbWMhOBYOpl2ytozgmVljtsPqLEQs0cWg6lZRF60,1178
770
776
  tests/models/emepEea2019/test_nh3ToAirInorganicFertiliser.py,sha256=f623Pp6XTt9YPDr2QymAJEQ_yfx0_TZGndmawD8ZX98,2134
771
- tests/models/emepEea2019/test_noxToAirFuelCombustion.py,sha256=iFVQVYImXxB5JE8b38UAUG4q8grfbniZi1cWdLQoViE,1135
777
+ tests/models/emepEea2019/test_noxToAirFuelCombustion.py,sha256=9d7xsCThu0sS8nU7DymCB6Gp1CzMxRPY1FJZEiBjiVk,1178
772
778
  tests/models/emepEea2019/test_pm10ToAirAnimalHousing.py,sha256=xGlQeJkdP638zbHivxAqvliZCRpcogMFZYVCMWw6j3c,715
773
779
  tests/models/emepEea2019/test_pm25ToAirAnimalHousing.py,sha256=cs3UaJ7ucCryOaQy0sbL9AiuC8l_N7uywmPZHcr3pC0,715
774
- tests/models/emepEea2019/test_so2ToAirFuelCombustion.py,sha256=RkC_ux5bxo6bIdcXIG_97uRstWXBnmZO3DOW4IfgRx0,1135
780
+ tests/models/emepEea2019/test_so2ToAirFuelCombustion.py,sha256=qG3AGLK5fNUJI1L_94fslHuiD6Z_YtmAjuDt5Q_4eOs,1178
775
781
  tests/models/emepEea2019/test_tspToAirAnimalHousing.py,sha256=4MNDsxIeUk5_3IvZwEZslxgoPNyQN9OQFDNY3uGNX6E,714
776
782
  tests/models/emepEea2019/test_utils.py,sha256=MUIeHgcCHLhbYWgleKIiKqO2Q4RX321J53YpOt9cogA,7060
777
783
  tests/models/environmentalFootprintV3_1/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -779,7 +785,7 @@ tests/models/environmentalFootprintV3_1/test_environmentalFootprintSingleOverall
779
785
  tests/models/environmentalFootprintV3_1/test_freshwaterEcotoxicityPotentialCtue.py,sha256=WE-DcerljCjXMYE4f3Sv5ZCVHP0oTjbWkOGuvaa4p10,926
780
786
  tests/models/environmentalFootprintV3_1/test_marineEutrophicationPotential.py,sha256=kY_pu_7SjSZl_l41mttMn4BpKl13TTV9jQYSHFMNXhI,968
781
787
  tests/models/environmentalFootprintV3_1/test_photochemicalOzoneCreationPotentialHumanHealthNmvocEq.py,sha256=Z4KGhYmnao0J1rC_jY9P_8Lu9UKe-_RyrdO5k56EIsg,1022
782
- tests/models/environmentalFootprintV3_1/test_scarcityWeightedWaterUse.py,sha256=TJptYKhplwbwiDObmPMBJweDgtwvIUdwBzNwAPCpbTc,1265
788
+ tests/models/environmentalFootprintV3_1/test_scarcityWeightedWaterUse.py,sha256=r_v3s06SLUcI2EUUiZc0H3NWv6OMxiZnNbIHyTBgXAw,1264
783
789
  tests/models/environmentalFootprintV3_1/test_soilQualityIndexLandOccupation.py,sha256=67YdlYnvVWFDZ3avHSz3bpCLkHAwYfU3j4ZNcwN5DK0,6162
784
790
  tests/models/environmentalFootprintV3_1/test_soilQualityIndexLandTransformation.py,sha256=xRTBMfQ1Qxs_NIoEFtshM_uzAAcFb80k1qGuFLJa2Dw,7650
785
791
  tests/models/environmentalFootprintV3_1/test_soilQualityIndexTotalLandUseEffects.py,sha256=ugM3qfvCuNQbzF5IPkEQQYF2V4IHxg3GQsXWqU9wqFE,2614
@@ -858,12 +864,13 @@ tests/models/hestia/test_freshWater.py,sha256=v2UD69csKrniKP3MXkOEHxQeE6O3-lvIVi
858
864
  tests/models/hestia/test_histosol.py,sha256=7g-3wQPZok2O8mExcnKZxO_T2Ye_h3UHv3HG3Kn8orM,888
859
865
  tests/models/hestia/test_inorganicFertiliser.py,sha256=v2Zs1Ig-ChOaq9gXuurcBt12izkH2bRUUuzW6rh3rqQ,643
860
866
  tests/models/hestia/test_irrigatedTypeUnspecified.py,sha256=bluZADFagxfXW4QyI0CIJzG97D2V33w333Z9Vwjqo0M,2015
861
- tests/models/hestia/test_landCover.py,sha256=ekZsv-l8xMXJu384sO2UE8TbU0bUXvW3r5KMcuKwJDs,10216
867
+ tests/models/hestia/test_landCover.py,sha256=YM7iH4FYKdJ_GBKKKr2ZR4v3s-vqFv4tiTHjHdaqNMQ,10216
868
+ tests/models/hestia/test_landOccupationDuringCycle.py,sha256=pJmLUrC1CDFFhVE-00jz_eNF6XL9o71IC_w-lM3-vTA,2254
862
869
  tests/models/hestia/test_landTransformation100YearAverageDuringCycle.py,sha256=3qa4rWUFqP1VM5-vm_182rhiBYJDxPqJwWtBqJ5K028,956
863
870
  tests/models/hestia/test_landTransformation20YearAverageDuringCycle.py,sha256=bUByojQuVeuCfko1_2YtNJi1PT9yktHlcbPi_p-MPvk,1001
864
871
  tests/models/hestia/test_liveAnimal.py,sha256=3K9cL1fwr6LlBl1_D8zIaeCOuiExqkDEU7BXx1JK_dk,2139
865
872
  tests/models/hestia/test_longFallowRatio.py,sha256=OVd6NByAXeCAOx9ux_m8IJwnEF-fqIaBOoKFSGWhyO0,1513
866
- tests/models/hestia/test_management.py,sha256=p7j5ooACr0XBf2-hZWwwYE0-sfsoakIa2qKZhE32ZUQ,1800
873
+ tests/models/hestia/test_management.py,sha256=ROWfDX-2aeeQXaflLPzOpiC6Qi5lsbMldBbFAlWKAUQ,2755
867
874
  tests/models/hestia/test_materialsAndSubstrate.py,sha256=szM6aBBc1_9MDQFM1-OiW4SOKvEIO6mYYEpjHB-wI9g,1430
868
875
  tests/models/hestia/test_milkYield.py,sha256=m7SRiKb_u8SDF7Q5gX39AKr4bsrNqibXgMgzSmJJEPA,1778
869
876
  tests/models/hestia/test_netPrimaryProduction.py,sha256=--q6NB90gmpeJNBR16l3AgBsXGXwww_d1vOcWiMa-k8,1110
@@ -914,7 +921,7 @@ tests/models/impact_assessment/product/test_economicValueShare.py,sha256=JbWlwBZ
914
921
  tests/models/impact_assessment/product/test_value.py,sha256=EFQFHM7OE4K9NrlhOaKj-opkv6HO8rSvS1L5Ux4jLmU,988
915
922
  tests/models/ipcc2006/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
916
923
  tests/models/ipcc2006/test_aboveGroundCropResidueRemoved.py,sha256=5F7eU4qWYfTZAzjUsuUOE5rA2vZ0x6e6Bm10PgmG9Zg,1177
917
- tests/models/ipcc2006/test_aboveGroundCropResidueTotal.py,sha256=FrSR1xBTRtJ99pXAklXLtDRC00FSW1vXSAvQNeBoXTQ,1725
924
+ tests/models/ipcc2006/test_aboveGroundCropResidueTotal.py,sha256=U5WQG7KYcCfJips2mghw7UtL87mmQUaAyKxN9tYD6fk,1887
918
925
  tests/models/ipcc2006/test_belowGroundCropResidue.py,sha256=cFqLDFy5pcgOyzKC9l-RClEP6CWCdVNnq48S90SITVM,1720
919
926
  tests/models/ipcc2006/test_n2OToAirCropResidueDecompositionDirect.py,sha256=pgUznkTiyLwhMVHzFE40wzwvtY40OsPQp1QWTsaPDqU,1815
920
927
  tests/models/ipcc2006/test_n2OToAirCropResidueDecompositionIndirect.py,sha256=cxn5rX_pZqbl7m8rhJARuyjG2P5O-BQbufeEcTmO06k,1357
@@ -930,7 +937,7 @@ tests/models/ipcc2013IncludingFeedbacks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5J
930
937
  tests/models/ipcc2013IncludingFeedbacks/test_gwp100.py,sha256=4HydDKiZDpxtgqgjpAg4cTVQu-jM-_tdDdJFmNNrwSc,875
931
938
  tests/models/ipcc2019/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
932
939
  tests/models/ipcc2019/test_aboveGroundBiomass.py,sha256=zzsE1zr8qYWgc1EWNrCZggjkJyIoVwbkfE9c1MVn7uA,7608
933
- tests/models/ipcc2019/test_aboveGroundCropResidueTotal.py,sha256=HrTsqm1r5c5di5JONu7P4_95JMp1kbDuKfQjWLE0Jhs,2573
940
+ tests/models/ipcc2019/test_aboveGroundCropResidueTotal.py,sha256=GMp6NCg1v4AjiwntN1C575BhxgZv_e_EG5Hv1buGKrA,1798
934
941
  tests/models/ipcc2019/test_belowGroundBiomass.py,sha256=Cu41RM63R-xti0qi_mLD0J5TClo61OkjsR4FI3caNxs,7579
935
942
  tests/models/ipcc2019/test_belowGroundCropResidue.py,sha256=no71pfxgOhn_tEWc_EwuWvlKRtHFqlIqNIvnP7cj0Tc,2568
936
943
  tests/models/ipcc2019/test_biocharOrganicCarbonPerHa.py,sha256=8Y5dwe_ZHSKxijLn3CMA6U5uQxHeBXYWsd93nPT16d4,3825
@@ -1272,8 +1279,8 @@ tests/orchestrator/strategies/run/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeR
1272
1279
  tests/orchestrator/strategies/run/test_add_blank_node_if_missing.py,sha256=K4xg4UAXfNhSaLyknKVPO7MGBF44Z_gD7CuZ_pe28gU,3512
1273
1280
  tests/orchestrator/strategies/run/test_add_key_if_missing.py,sha256=hKwvk1ohcBVnQUCTiDhRW99J0xEa29BpwFi1KC0yWLE,329
1274
1281
  tests/orchestrator/strategies/run/test_always.py,sha256=w5-Dhp6yLzgZGAeMRz3OrqZbbAed9gZ1O266a3z9k7w,134
1275
- hestia_earth_models-0.74.1.dist-info/LICENSE,sha256=TD25LoiRJsA5CPUNrcyt1PXlGcbUGFMAeZoBcfCrCNE,1154
1276
- hestia_earth_models-0.74.1.dist-info/METADATA,sha256=8_8Uoo0ZQ8lTcN22Wbm8dB35v5urr1Su1eIqMH_uhXU,4075
1277
- hestia_earth_models-0.74.1.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
1278
- hestia_earth_models-0.74.1.dist-info/top_level.txt,sha256=1dqA9TqpOLTEgpqa-YBsmbCmmNU1y56AtfFGEceZ2A0,19
1279
- hestia_earth_models-0.74.1.dist-info/RECORD,,
1282
+ hestia_earth_models-0.74.3.dist-info/LICENSE,sha256=TD25LoiRJsA5CPUNrcyt1PXlGcbUGFMAeZoBcfCrCNE,1154
1283
+ hestia_earth_models-0.74.3.dist-info/METADATA,sha256=K5hoyy2KFAk8Mz7pVye-KKAwIHtndX6XRcLRvHE3dxE,4075
1284
+ hestia_earth_models-0.74.3.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
1285
+ hestia_earth_models-0.74.3.dist-info/top_level.txt,sha256=1dqA9TqpOLTEgpqa-YBsmbCmmNU1y56AtfFGEceZ2A0,19
1286
+ hestia_earth_models-0.74.3.dist-info/RECORD,,
@@ -0,0 +1,20 @@
1
+ import json
2
+ from unittest.mock import patch
3
+
4
+ from tests.utils import fixtures_path, fake_new_product
5
+ from hestia_earth.models.cycle.aboveGroundCropResidueTotal import MODEL, TERM_ID, run
6
+
7
+ class_path = f"hestia_earth.models.{MODEL}.{TERM_ID}"
8
+ fixtures_folder = f"{fixtures_path}/{MODEL}/{TERM_ID}"
9
+
10
+
11
+ @patch(f"{class_path}._new_product", side_effect=fake_new_product)
12
+ def test_run_crop(*args):
13
+ with open(f"{fixtures_folder}/cycle.jsonld", encoding='utf-8') as f:
14
+ cycle = json.load(f)
15
+
16
+ with open(f"{fixtures_folder}/result.jsonld", encoding='utf-8') as f:
17
+ expected = json.load(f)
18
+
19
+ value = run(cycle)
20
+ assert value == expected
@@ -2,7 +2,8 @@ from unittest.mock import patch
2
2
  import json
3
3
  from tests.utils import fixtures_path, fake_new_emission
4
4
 
5
- from hestia_earth.models.emepEea2019.co2ToAirFuelCombustion import MODEL, TERM_ID, run
5
+ from hestia_earth.models.emepEea2019 import MODEL
6
+ from hestia_earth.models.emepEea2019.co2ToAirFuelCombustion import TERM_ID, run
6
7
 
7
8
  class_path = f"hestia_earth.models.{MODEL}.{TERM_ID}"
8
9
  model_utils_path = f"hestia_earth.models.{MODEL}.utils"
@@ -2,7 +2,8 @@ from unittest.mock import patch
2
2
  import json
3
3
  from tests.utils import fixtures_path, fake_new_emission
4
4
 
5
- from hestia_earth.models.emepEea2019.n2OToAirFuelCombustionDirect import MODEL, TERM_ID, run
5
+ from hestia_earth.models.emepEea2019 import MODEL
6
+ from hestia_earth.models.emepEea2019.n2OToAirFuelCombustionDirect import TERM_ID, run
6
7
 
7
8
  class_path = f"hestia_earth.models.{MODEL}.{TERM_ID}"
8
9
  model_utils_path = f"hestia_earth.models.{MODEL}.utils"
@@ -0,0 +1,34 @@
1
+ from unittest.mock import patch
2
+ import json
3
+ from tests.utils import fixtures_path, fake_new_emission
4
+
5
+ from hestia_earth.models.emepEea2019 import MODEL
6
+ from hestia_earth.models.emepEea2019.nh3ToAirFuelCombustion import TERM_ID, run
7
+
8
+ class_path = f"hestia_earth.models.{MODEL}.{TERM_ID}"
9
+ model_utils_path = f"hestia_earth.models.{MODEL}.utils"
10
+ fixtures_folder = f"{fixtures_path}/{MODEL}/{TERM_ID}"
11
+
12
+
13
+ @patch(f"{model_utils_path}._new_emission", side_effect=fake_new_emission)
14
+ def test_run(*args):
15
+ with open(f"{fixtures_folder}/cycle.jsonld", encoding='utf-8') as f:
16
+ cycle = json.load(f)
17
+
18
+ with open(f"{fixtures_folder}/result.jsonld", encoding='utf-8') as f:
19
+ expected = json.load(f)
20
+
21
+ value = run(cycle)
22
+ assert value == expected
23
+
24
+
25
+ @patch(f"{model_utils_path}._new_emission", side_effect=fake_new_emission)
26
+ def test_run_data_complete(*args):
27
+ with open(f"{fixtures_folder}/no-input-data-complete/cycle.jsonld", encoding='utf-8') as f:
28
+ cycle = json.load(f)
29
+
30
+ with open(f"{fixtures_folder}/no-input-data-complete/result.jsonld", encoding='utf-8') as f:
31
+ expected = json.load(f)
32
+
33
+ value = run(cycle)
34
+ assert value == expected
@@ -2,7 +2,8 @@ from unittest.mock import patch
2
2
  import json
3
3
  from tests.utils import fixtures_path, fake_new_emission
4
4
 
5
- from hestia_earth.models.emepEea2019.noxToAirFuelCombustion import MODEL, TERM_ID, run
5
+ from hestia_earth.models.emepEea2019 import MODEL
6
+ from hestia_earth.models.emepEea2019.noxToAirFuelCombustion import TERM_ID, run
6
7
 
7
8
  class_path = f"hestia_earth.models.{MODEL}.{TERM_ID}"
8
9
  model_utils_path = f"hestia_earth.models.{MODEL}.utils"
@@ -2,7 +2,8 @@ from unittest.mock import patch
2
2
  import json
3
3
  from tests.utils import fixtures_path, fake_new_emission
4
4
 
5
- from hestia_earth.models.emepEea2019.so2ToAirFuelCombustion import MODEL, TERM_ID, run
5
+ from hestia_earth.models.emepEea2019 import MODEL
6
+ from hestia_earth.models.emepEea2019.so2ToAirFuelCombustion import TERM_ID, run
6
7
 
7
8
  class_path = f"hestia_earth.models.{MODEL}.{TERM_ID}"
8
9
  model_utils_path = f"hestia_earth.models.{MODEL}.utils"
@@ -1,7 +1,6 @@
1
1
  import json
2
2
  import os
3
3
  from unittest.mock import patch
4
-
5
4
  from pytest import mark
6
5
 
7
6
  from hestia_earth.models.environmentalFootprintV3_1 import MODEL_FOLDER
@@ -270,7 +270,7 @@ def test_get_ratio_between_land_use_types():
270
270
  first_land_use_term="Arable land",
271
271
  second_land_use_term="Permanent crops"
272
272
  )
273
- assert result == (3800.0, 58.843)
273
+ assert result == (3800.0, 57.417)
274
274
 
275
275
 
276
276
  @pytest.mark.parametrize("subfolder", _folders)
@@ -0,0 +1,68 @@
1
+ import json
2
+ from os.path import isfile
3
+ from pytest import mark
4
+ from unittest.mock import patch, MagicMock
5
+
6
+ from hestia_earth.models.hestia.landOccupationDuringCycle import MODEL, TERM_ID, run, _should_run
7
+
8
+ from tests.utils import fixtures_path, fake_new_indicator
9
+
10
+ class_path = f"hestia_earth.models.{MODEL}.{TERM_ID}"
11
+ fixtures_folder = f"{fixtures_path}/{MODEL}/{TERM_ID}"
12
+
13
+
14
+ def _load_fixture(file_name: str, default=None):
15
+ path = f"{fixtures_folder}/{file_name}.jsonld"
16
+ if isfile(path):
17
+ with open(path, encoding="utf-8") as f:
18
+ return json.load(f)
19
+ return default
20
+
21
+
22
+ # subfolder, should_run
23
+ PARAMS_SHOULD_RUN = [
24
+ ("arable", True),
25
+ ("permanent", True),
26
+ ("animal", True),
27
+ ("animal-multi-country", True),
28
+ ("arable-missing-evs", False), # no economicValueShare on product
29
+ ("arable-zero-evs", True), # economicValueShare is `0` -> run, with 0% allocated
30
+ ("animal-missing-other-site-data", False), # mis-matched `otherSites` and `otherSitesDuration`
31
+ ("animal-missing-site-data", False), # closes #1341
32
+ ("poore-nemecek-2018-orchard", True), # ensure model returns the same value as deprecated one
33
+ ("poore-nemecek-2018-cereal", True) # ensure model returns the same value as deprecated one
34
+ ]
35
+ IDS_SHOULD_RUN = [p[0] for p in PARAMS_SHOULD_RUN]
36
+
37
+
38
+ @mark.parametrize("subfolder, expected", PARAMS_SHOULD_RUN, ids=IDS_SHOULD_RUN)
39
+ def test_should_run(
40
+ subfolder: str,
41
+ expected: bool
42
+ ):
43
+ impact = _load_fixture(f"{subfolder}/impact-assessment", {})
44
+ cycle = _load_fixture(f"{subfolder}/cycle", {})
45
+
46
+ impact["cycle"] = cycle
47
+
48
+ result, *args = _should_run(impact)
49
+ assert result == expected
50
+
51
+
52
+ PARAMS_RUN = [subfolder for subfolder, should_run in PARAMS_SHOULD_RUN if should_run]
53
+
54
+
55
+ @mark.parametrize("subfolder", PARAMS_RUN)
56
+ @patch(f"{class_path}._new_indicator", side_effect=fake_new_indicator)
57
+ def test_run(
58
+ _mock_new_indicator: MagicMock,
59
+ subfolder: str
60
+ ):
61
+ impact = _load_fixture(f"{subfolder}/impact-assessment", {})
62
+ cycle = _load_fixture(f"{subfolder}/cycle", {})
63
+ expected = _load_fixture(f"{subfolder}/result", {})
64
+
65
+ impact["cycle"] = cycle
66
+
67
+ result = run(impact)
68
+ assert result == expected
@@ -5,7 +5,8 @@ from unittest.mock import Mock, patch
5
5
  from hestia_earth.schema import SiteSiteType
6
6
 
7
7
  from tests.utils import fixtures_path, fake_new_management
8
- from hestia_earth.models.hestia.management import MODEL, MODEL_KEY, run
8
+ from hestia_earth.models.hestia.management import MODEL, MODEL_KEY, run, _is_cover_crop, \
9
+ _cycle_has_existing_non_cover_land_cover_nodes
9
10
 
10
11
  class_path = f"hestia_earth.models.{MODEL}.{MODEL_KEY}"
11
12
  fixtures_folder = os.path.join(fixtures_path, MODEL, MODEL_KEY)
@@ -19,6 +20,33 @@ _LAND_COVER_TERM_BY_SITE_TYPE = {
19
20
  _folders = [d for d in os.listdir(fixtures_folder) if os.path.isdir(os.path.join(fixtures_folder, d))]
20
21
 
21
22
 
23
+ @pytest.mark.parametrize(
24
+ 'term_id,expected_result',
25
+ [
26
+ ("coverCrop", True),
27
+ ("catchCrop", True),
28
+ ("groundCover", True),
29
+ ("salinity", False),
30
+ ("nonexistentthing", False),
31
+ ]
32
+ )
33
+ def test_is_cover_crop(term_id, expected_result):
34
+ assert _is_cover_crop(term_id) == expected_result
35
+
36
+
37
+ def test_cycle_has_existing_non_cover_land_cover_nodes():
38
+ fixture_path = os.path.join(fixtures_folder, "example7")
39
+ with open(f"{fixture_path}/cycles.jsonld", encoding='utf-8') as f:
40
+ cycles = json.load(f)
41
+
42
+ assert _cycle_has_existing_non_cover_land_cover_nodes(cycles[0]) is False
43
+
44
+ fixture_path = os.path.join(fixtures_folder, "siteType_no_cropland")
45
+ with open(f"{fixture_path}/cycles.jsonld", encoding='utf-8') as f:
46
+ cycles = json.load(f)
47
+ assert _cycle_has_existing_non_cover_land_cover_nodes(cycles[0]) is True
48
+
49
+
22
50
  @pytest.mark.parametrize('folder', _folders)
23
51
  @patch(
24
52
  f"{class_path}.get_landCover_term_id_from_site_type",
@@ -1,5 +1,7 @@
1
- from unittest.mock import patch
1
+ import os
2
2
  import json
3
+ from unittest.mock import patch
4
+ from pytest import mark
3
5
  from hestia_earth.schema import TermTermType
4
6
 
5
7
  from tests.utils import fixtures_path, fake_new_product
@@ -7,6 +9,7 @@ from hestia_earth.models.ipcc2006.aboveGroundCropResidueTotal import MODEL, TERM
7
9
 
8
10
  class_path = f"hestia_earth.models.{MODEL}.{TERM_ID}"
9
11
  fixtures_folder = f"{fixtures_path}/{MODEL}/{TERM_ID}"
12
+ _folders = [d for d in os.listdir(fixtures_folder) if os.path.isdir(os.path.join(fixtures_folder, d))]
10
13
 
11
14
 
12
15
  @patch(f"{class_path}._is_term_type_incomplete", return_value=True)
@@ -32,14 +35,14 @@ def test_should_run(*args):
32
35
  assert not should_run
33
36
 
34
37
 
35
- @patch(f"{class_path}._is_term_type_incomplete", return_value=True)
38
+ @mark.parametrize("folder", _folders)
36
39
  @patch(f"{class_path}._new_product", side_effect=fake_new_product)
37
- def test_run(*args):
38
- with open(f"{fixtures_folder}/cycle.jsonld", encoding='utf-8') as f:
40
+ def test_run_crop(mock_new_product, folder: str):
41
+ with open(f"{fixtures_folder}/{folder}/cycle.jsonld", encoding='utf-8') as f:
39
42
  cycle = json.load(f)
40
43
 
41
- with open(f"{fixtures_folder}/result.jsonld", encoding='utf-8') as f:
44
+ with open(f"{fixtures_folder}/{folder}/result.jsonld", encoding='utf-8') as f:
42
45
  expected = json.load(f)
43
46
 
44
47
  value = run(cycle)
45
- assert value == expected
48
+ assert value == expected, folder
@@ -1,15 +1,15 @@
1
- from unittest.mock import patch
1
+ import os
2
2
  import json
3
-
3
+ from unittest.mock import patch
4
+ from pytest import mark
4
5
  from hestia_earth.schema import TermTermType
5
- from tests.utils import fixtures_path, fake_new_product
6
6
 
7
- from hestia_earth.models.ipcc2019.aboveGroundCropResidueTotal import (
8
- MODEL, TERM_ID, run, _should_run, _should_run_product
9
- )
7
+ from tests.utils import fixtures_path, fake_new_product
8
+ from hestia_earth.models.ipcc2019.aboveGroundCropResidueTotal import MODEL, TERM_ID, run, _should_run
10
9
 
11
10
  class_path = f"hestia_earth.models.{MODEL}.{TERM_ID}"
12
11
  fixtures_folder = f"{fixtures_path}/{MODEL}/{TERM_ID}"
12
+ _folders = [d for d in os.listdir(fixtures_folder) if os.path.isdir(os.path.join(fixtures_folder, d))]
13
13
 
14
14
  CROP_RESIDUE_TERM = {
15
15
  'termType': TermTermType.CROPRESIDUE.value
@@ -19,7 +19,11 @@ CROP_RESIDUE_TERM = {
19
19
  @patch('hestia_earth.models.utils.completeness.download_term', return_value=CROP_RESIDUE_TERM)
20
20
  @patch(f"{class_path}._should_run_product", return_value=True)
21
21
  def test_should_run(*args):
22
- crop_product = {'term': {'termType': TermTermType.CROP.value}}
22
+ crop_product = {
23
+ 'term': {'termType': TermTermType.CROP.value, '@id': 'wheatGrain'},
24
+ 'value': [10],
25
+ 'properties': [{'term': {'@id': 'dryMatter'}, 'value': 10}]
26
+ }
23
27
  cycle = {'products': []}
24
28
 
25
29
  # no crops => no run
@@ -33,45 +37,15 @@ def test_should_run(*args):
33
37
  assert should_run is True
34
38
 
35
39
 
36
- @patch('hestia_earth.models.utils.completeness.download_term', return_value=CROP_RESIDUE_TERM)
37
- @patch(f"{class_path}.get_yield_dm", return_value=None)
38
- def test_should_run_product(mock_get_yield_dm, *args):
39
- product = {'term': {'@id': 'maizeGrain'}}
40
-
41
- # with a dryMatter property => no run
42
- product['properties'] = [{'term': {'@id': 'dryMatter'}, 'value': 10}]
43
- assert not _should_run_product(product)
44
-
45
- # with a value => no run
46
- product['value'] = [10]
47
- assert not _should_run_product(product)
48
-
49
- # with a lookup value => run
50
- mock_get_yield_dm.return_value = 10
51
- assert _should_run_product(product) is True
52
-
53
-
54
- @patch('hestia_earth.models.utils.completeness.download_term', return_value=CROP_RESIDUE_TERM)
55
- @patch(f"{class_path}._new_product", side_effect=fake_new_product)
56
- def test_run_crop(*args):
57
- with open(f"{fixtures_folder}/crop/cycle.jsonld", encoding='utf-8') as f:
58
- cycle = json.load(f)
59
-
60
- with open(f"{fixtures_folder}/crop/result.jsonld", encoding='utf-8') as f:
61
- expected = json.load(f)
62
-
63
- value = run(cycle)
64
- assert value == expected
65
-
66
-
40
+ @mark.parametrize("folder", _folders)
67
41
  @patch('hestia_earth.models.utils.completeness.download_term', return_value=CROP_RESIDUE_TERM)
68
42
  @patch(f"{class_path}._new_product", side_effect=fake_new_product)
69
- def test_run_forage(*args):
70
- with open(f"{fixtures_folder}/forage/cycle.jsonld", encoding='utf-8') as f:
43
+ def test_run_crop(mock_new_product, mock_download_term, folder: str):
44
+ with open(f"{fixtures_folder}/{folder}/cycle.jsonld", encoding='utf-8') as f:
71
45
  cycle = json.load(f)
72
46
 
73
- with open(f"{fixtures_folder}/forage/result.jsonld", encoding='utf-8') as f:
47
+ with open(f"{fixtures_folder}/{folder}/result.jsonld", encoding='utf-8') as f:
74
48
  expected = json.load(f)
75
49
 
76
50
  value = run(cycle)
77
- assert value == expected
51
+ assert value == expected, folder