hestia-earth-models 0.73.3__py3-none-any.whl → 0.73.5__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.
- hestia_earth/models/akagiEtAl2011/utils.py +12 -13
- hestia_earth/models/config/Site.json +11 -0
- hestia_earth/models/hestia/landCover.py +51 -5
- hestia_earth/models/ipcc2019/biocharOrganicCarbonPerHa.py +435 -0
- hestia_earth/models/ipcc2019/n2OToAirCropResidueBurningDirect.py +4 -10
- hestia_earth/models/mocking/search-results.json +691 -687
- hestia_earth/models/utils/cropResidue.py +2 -2
- hestia_earth/models/version.py +1 -1
- {hestia_earth_models-0.73.3.dist-info → hestia_earth_models-0.73.5.dist-info}/METADATA +1 -1
- {hestia_earth_models-0.73.3.dist-info → hestia_earth_models-0.73.5.dist-info}/RECORD +18 -16
- tests/models/akagiEtAl2011/test_utils.py +3 -2
- tests/models/hestia/test_landCover.py +33 -1
- tests/models/ipcc2019/test_biocharOrganicCarbonPerHa.py +131 -0
- tests/models/ipcc2019/test_n2OToAirCropResidueBurningDirect.py +3 -2
- tests/models/utils/test_cropResidue.py +4 -4
- {hestia_earth_models-0.73.3.dist-info → hestia_earth_models-0.73.5.dist-info}/LICENSE +0 -0
- {hestia_earth_models-0.73.3.dist-info → hestia_earth_models-0.73.5.dist-info}/WHEEL +0 -0
- {hestia_earth_models-0.73.3.dist-info → hestia_earth_models-0.73.5.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from hestia_earth.schema import TermTermType
|
|
2
2
|
from hestia_earth.utils.model import find_term_match
|
|
3
|
-
from hestia_earth.utils.tools import flatten
|
|
3
|
+
from hestia_earth.utils.tools import flatten, list_sum
|
|
4
4
|
|
|
5
5
|
from .completeness import _is_term_type_complete
|
|
6
6
|
|
|
@@ -26,4 +26,4 @@ def get_crop_residue_burnt_value(cycle: dict):
|
|
|
26
26
|
find_term_match(products, 'discardedCropBurnt').get('value', [])
|
|
27
27
|
])
|
|
28
28
|
data_complete = _is_term_type_complete(cycle, TermTermType.CROPRESIDUE)
|
|
29
|
-
return
|
|
29
|
+
return 0 if len(value) == 0 and data_complete else list_sum(value, default=None)
|
hestia_earth/models/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
VERSION = '0.73.
|
|
1
|
+
VERSION = '0.73.5'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: hestia-earth-models
|
|
3
|
-
Version: 0.73.
|
|
3
|
+
Version: 0.73.5
|
|
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=eRuH86v7Thuw-QXdKqaqVmA_MkwnOCo0UBEwtuDq4Oc,3554
|
|
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=
|
|
8
|
+
hestia_earth/models/version.py,sha256=gaJ7asOZglEOu1WEQGhDLAicifIKNkt5PDb2Cw4T0-8,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
|
|
@@ -15,7 +15,7 @@ hestia_earth/models/akagiEtAl2011/nh3ToAirCropResidueBurning.py,sha256=MUVyLifn5
|
|
|
15
15
|
hestia_earth/models/akagiEtAl2011/noxToAirCropResidueBurning.py,sha256=aFot00A68gFM6Sp1cGkzruB4nIyc-BNGX7T75sb_CCw,791
|
|
16
16
|
hestia_earth/models/akagiEtAl2011/pm25ToAirCropResidueBurning.py,sha256=88LaJnezcbfOO_GCKz41zt39yhCFOFFmC9TTo1TAOMU,792
|
|
17
17
|
hestia_earth/models/akagiEtAl2011/so2ToAirCropResidueBurning.py,sha256=hoymFUx3TxzwhlOV65RzOx43IK-CGM8jYfWLH6ibHNo,791
|
|
18
|
-
hestia_earth/models/akagiEtAl2011/utils.py,sha256=
|
|
18
|
+
hestia_earth/models/akagiEtAl2011/utils.py,sha256=Fh9BydxPV42xSMg17R-Hf9ehkZR1o9PbCi5UedcCoBQ,1932
|
|
19
19
|
hestia_earth/models/aware/__init__.py,sha256=F8XRo9nRiX-fHAqyeMARYtFmJWRPs-hnIaCiHcZhyMw,406
|
|
20
20
|
hestia_earth/models/aware/scarcityWeightedWaterUse.py,sha256=HO3ic8xFXs_ez13N7kG1JuYit2S8YTi5WgeP9cOyOqc,3936
|
|
21
21
|
hestia_earth/models/chaudharyBrooks2018/__init__.py,sha256=LKxQu7-6gyWPpdXaYHDTawzsBNm7CpDrk98I5_TTLhA,420
|
|
@@ -37,7 +37,7 @@ hestia_earth/models/cml2001NonBaseline/eutrophicationPotentialIncludingFateAvera
|
|
|
37
37
|
hestia_earth/models/cml2001NonBaseline/terrestrialAcidificationPotentialExcludingFate.py,sha256=xcrxfs9UoV_EWvV-XzMt35oPWCUsTzqg2SGA3j2MFIw,1091
|
|
38
38
|
hestia_earth/models/config/Cycle.json,sha256=3fsz2dNEKA4noEjqrp25Or3_scDxqFS7c_7v911Gpno,59078
|
|
39
39
|
hestia_earth/models/config/ImpactAssessment.json,sha256=ubAHJRHOFdX-fIYkOEBuD0CYvNZtFYSr8GSgKliVL8g,60968
|
|
40
|
-
hestia_earth/models/config/Site.json,sha256=
|
|
40
|
+
hestia_earth/models/config/Site.json,sha256=4DPSziHnDIngyub3Of8OvDEKa446q3Yx48R2Eobqk24,14374
|
|
41
41
|
hestia_earth/models/config/__init__.py,sha256=l1WqL7ezlank86ABP4zUia_hIvM9ba-sOE3z6wNrea8,2333
|
|
42
42
|
hestia_earth/models/config/run-calculations.json,sha256=e3nJ4M6CP1iFzfv8ou_ZUFbFxYkDxJgwuNDXTm4PBDc,615
|
|
43
43
|
hestia_earth/models/config/trigger-calculations.json,sha256=3dmn2bRuj6QEtSTOLdIy31ho7thgUXyDsnqZzPV9rAQ,623
|
|
@@ -205,7 +205,7 @@ hestia_earth/models/hestia/freshWater.py,sha256=Q-dmFJLZfyYEyFyYkJUOjgmQR3G5YXCX
|
|
|
205
205
|
hestia_earth/models/hestia/histosol.py,sha256=IexiWTSlSJYGjrdpYmRooW6v8LjhYATPQ8smMz1UZBA,1612
|
|
206
206
|
hestia_earth/models/hestia/inorganicFertiliser.py,sha256=We4PBaTXyGwEQTfhX0-J8Xt03p-FB9i9j3tEK5JQ8uE,9026
|
|
207
207
|
hestia_earth/models/hestia/irrigatedTypeUnspecified.py,sha256=VdYzfYxcRzWv21qxRkDn9HBid7-Bt_CgIv4iyXJH03g,1929
|
|
208
|
-
hestia_earth/models/hestia/landCover.py,sha256=
|
|
208
|
+
hestia_earth/models/hestia/landCover.py,sha256=l0uhIxHZ9cD8ZB37RzeWUzjfh7d0iTB7GiMG7DYWddU,34937
|
|
209
209
|
hestia_earth/models/hestia/landTransformation100YearAverageDuringCycle.py,sha256=hF7_DDvrs7swH6ott_ihgYx13UzEKHH6pccYCtzrN8o,1069
|
|
210
210
|
hestia_earth/models/hestia/landTransformation20YearAverageDuringCycle.py,sha256=05SCH6ZjEV3mIleRusBg677zu0xgu5YK0f9FCddgNPg,1067
|
|
211
211
|
hestia_earth/models/hestia/liveAnimal.py,sha256=d7HuUi40c-7TN1kecdRuqbht8PAe7x4ps0NhSuWG34Q,3868
|
|
@@ -287,6 +287,7 @@ hestia_earth/models/ipcc2019/aboveGroundBiomass.py,sha256=T50NcJoyGrHYUSzJBXJKAO
|
|
|
287
287
|
hestia_earth/models/ipcc2019/aboveGroundCropResidueTotal.py,sha256=lT2QVV5c2LvQqZRfPEvFT_bMTayMXgIsFLnx8I6iYzw,3089
|
|
288
288
|
hestia_earth/models/ipcc2019/belowGroundBiomass.py,sha256=WN3R5kUIc5Ij4HxMFcTGKeNRoPChRY6ws0x3nQNeEMw,19421
|
|
289
289
|
hestia_earth/models/ipcc2019/belowGroundCropResidue.py,sha256=qbfsLBPaMIt4oQzYAzbsZdkJozTbwuztNr48TLYC5-Y,3507
|
|
290
|
+
hestia_earth/models/ipcc2019/biocharOrganicCarbonPerHa.py,sha256=--qSO-v0X6qlti5NmUD5bcjGpf4tX352vPVDU0ECAI0,13276
|
|
290
291
|
hestia_earth/models/ipcc2019/biomass_utils.py,sha256=NkTPGMl-0tqvhUZKZ1rxW0XTBnZOvgFJki_IPzEEyu0,15796
|
|
291
292
|
hestia_earth/models/ipcc2019/carbonContent.py,sha256=XhXDu6DRQxANBsRsCEgw4f0UJDOgWsvhVyEwK1-4YT0,7263
|
|
292
293
|
hestia_earth/models/ipcc2019/ch4ToAirAquacultureSystems.py,sha256=JeyF4tUPn3KIDbXwgM_MFp18hnTZjLBBqMFMH_ciZ1Q,3529
|
|
@@ -303,7 +304,7 @@ hestia_earth/models/ipcc2019/co2ToAirSoilOrganicCarbonStockChange.py,sha256=4aRB
|
|
|
303
304
|
hestia_earth/models/ipcc2019/co2ToAirUreaHydrolysis.py,sha256=P6OxdUbvONaTVGchvogEnGeNxox-X1FaZ08yOdqqm6k,3879
|
|
304
305
|
hestia_earth/models/ipcc2019/croppingDuration.py,sha256=X2fuBCr-mspLwJUGOlVis9lnyzdZ92vYqgDA6dgL5eo,3088
|
|
305
306
|
hestia_earth/models/ipcc2019/ligninContent.py,sha256=nAhwrl0b3pbGQnAycEESAzakdpXajONTnbhNwgPR7nw,7293
|
|
306
|
-
hestia_earth/models/ipcc2019/n2OToAirCropResidueBurningDirect.py,sha256=
|
|
307
|
+
hestia_earth/models/ipcc2019/n2OToAirCropResidueBurningDirect.py,sha256=6oMiix-1_dV5L99NEIKnxHcPrp8k-D1MzO5QDmvtC_o,1754
|
|
307
308
|
hestia_earth/models/ipcc2019/n2OToAirCropResidueDecompositionDirect.py,sha256=Fand7NbT27unwgFTxi_9NxT024s63vQ7U6-tk9yp3d8,3990
|
|
308
309
|
hestia_earth/models/ipcc2019/n2OToAirCropResidueDecompositionIndirect.py,sha256=_Oj6Jw8F4rce7FmhWkzeqyB7W3ZQWpOiA10p6xrfSwc,3777
|
|
309
310
|
hestia_earth/models/ipcc2019/n2OToAirExcretaDirect.py,sha256=RW_aFY409kplCYWo3oHHVk9FD3DkoEnGkprU9SaTdcw,2196
|
|
@@ -448,7 +449,7 @@ hestia_earth/models/linkedImpactAssessment/utils.py,sha256=7M-E7u35fIF0uMoA1hwcr
|
|
|
448
449
|
hestia_earth/models/mocking/__init__.py,sha256=9VX50c-grz-snfd-7MBS0KfF7AadtbKuj7kK6PqtsgE,687
|
|
449
450
|
hestia_earth/models/mocking/build_mock_search.py,sha256=p15ccEUmkmLp1RiGNznxMz3OFHbI8P1-29ExuohiQN8,1355
|
|
450
451
|
hestia_earth/models/mocking/mock_search.py,sha256=ccFe_WrI73JElFmxp4hPNLCX7eeU--lBC1JFR901KJY,1069
|
|
451
|
-
hestia_earth/models/mocking/search-results.json,sha256=
|
|
452
|
+
hestia_earth/models/mocking/search-results.json,sha256=eMTxqv2Lz6tZuSuUkOWRnBLsqPIp7JIoupRI3YyIrig,162691
|
|
452
453
|
hestia_earth/models/pooreNemecek2018/__init__.py,sha256=nPboL7ULJzL5nJD5q7q9VOZt_fxbKVm8fmn1Az5YkVY,417
|
|
453
454
|
hestia_earth/models/pooreNemecek2018/aboveGroundCropResidueTotal.py,sha256=oXillpppAas1q9GKmODxe1YXyno3EzV-j12xhzkqtTc,2404
|
|
454
455
|
hestia_earth/models/pooreNemecek2018/belowGroundCropResidue.py,sha256=_pQMPSvI--Xm00H6vXDA4ct_pQXKRGrLE2f-2tQE6y4,2323
|
|
@@ -600,7 +601,7 @@ hestia_earth/models/utils/cache_sources.py,sha256=MBkrPpjwNiC4ApDjeYVHZjWBbpvAer
|
|
|
600
601
|
hestia_earth/models/utils/completeness.py,sha256=iRG4uviOAQQ4T2Nr4LlelPVTS_F1felGZNJYxek_JG8,1239
|
|
601
602
|
hestia_earth/models/utils/constant.py,sha256=DmB3VVuoh7Pz2QDBJqiUG6yAML2i0fOy1BPuPHmhT1w,3442
|
|
602
603
|
hestia_earth/models/utils/crop.py,sha256=GbYwrz3Zd4JU-cwUBijc8GeAK0XgurV3ubwcFIgxhcU,2721
|
|
603
|
-
hestia_earth/models/utils/cropResidue.py,sha256=
|
|
604
|
+
hestia_earth/models/utils/cropResidue.py,sha256=1orh-dhBo2p7HZVjMTTFo8XeFv-razhv5SdtuHPQ1bY,1252
|
|
604
605
|
hestia_earth/models/utils/cropResidueManagement.py,sha256=nIDFjf39rDD10UHSVudfDyu-EiL261g8jyrgS-2aDKw,347
|
|
605
606
|
hestia_earth/models/utils/currency.py,sha256=f_ArJANb--pZq4LL49SXQ1AMX_oKroqwBXKRRQqZwsM,578
|
|
606
607
|
hestia_earth/models/utils/cycle.py,sha256=J8ATBSDkhkEPRMRC0ufO8eC_JeGCpkpdvSz2xSTAg-8,16220
|
|
@@ -668,7 +669,7 @@ tests/models/akagiEtAl2011/test_nh3ToAirCropResidueBurning.py,sha256=NAFGO7aSJ6p
|
|
|
668
669
|
tests/models/akagiEtAl2011/test_noxToAirCropResidueBurning.py,sha256=3GIergySTs_aiqT8wMMSTu7zDWJ244EwRNOPkU_TLiI,1142
|
|
669
670
|
tests/models/akagiEtAl2011/test_pm25ToAirCropResidueBurning.py,sha256=hGnX5WymuO41ddDecjbMiKjdFi20rQNdOr-ErVo1f34,1143
|
|
670
671
|
tests/models/akagiEtAl2011/test_so2ToAirCropResidueBurning.py,sha256=kWoTSIMoGIpBR8OgH1LzIqkgvwsTU7mOov5O9ZmlIbE,1142
|
|
671
|
-
tests/models/akagiEtAl2011/test_utils.py,sha256=
|
|
672
|
+
tests/models/akagiEtAl2011/test_utils.py,sha256=bB-YcpJNcsGX1W6vaPao4_PeLS3Hx78ZCrHCJdqbajk,600
|
|
672
673
|
tests/models/aware/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
673
674
|
tests/models/aware/test_scarcityWeightedWaterUse.py,sha256=Tl888UE-v5xQCInOXxn291Tkx3Qyz_bKkd5inVwlDNc,2003
|
|
674
675
|
tests/models/chaudharyBrooks2018/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -844,7 +845,7 @@ tests/models/hestia/test_freshWater.py,sha256=v2UD69csKrniKP3MXkOEHxQeE6O3-lvIVi
|
|
|
844
845
|
tests/models/hestia/test_histosol.py,sha256=7g-3wQPZok2O8mExcnKZxO_T2Ye_h3UHv3HG3Kn8orM,888
|
|
845
846
|
tests/models/hestia/test_inorganicFertiliser.py,sha256=v2Zs1Ig-ChOaq9gXuurcBt12izkH2bRUUuzW6rh3rqQ,643
|
|
846
847
|
tests/models/hestia/test_irrigatedTypeUnspecified.py,sha256=bluZADFagxfXW4QyI0CIJzG97D2V33w333Z9Vwjqo0M,2015
|
|
847
|
-
tests/models/hestia/test_landCover.py,sha256=
|
|
848
|
+
tests/models/hestia/test_landCover.py,sha256=rGJq9WtaAOKYmUA_sLRHyHZgxo2heoODpB9Jo7jC9Pc,9076
|
|
848
849
|
tests/models/hestia/test_landTransformation100YearAverageDuringCycle.py,sha256=3qa4rWUFqP1VM5-vm_182rhiBYJDxPqJwWtBqJ5K028,956
|
|
849
850
|
tests/models/hestia/test_landTransformation20YearAverageDuringCycle.py,sha256=bUByojQuVeuCfko1_2YtNJi1PT9yktHlcbPi_p-MPvk,1001
|
|
850
851
|
tests/models/hestia/test_liveAnimal.py,sha256=3K9cL1fwr6LlBl1_D8zIaeCOuiExqkDEU7BXx1JK_dk,2139
|
|
@@ -919,6 +920,7 @@ tests/models/ipcc2019/test_aboveGroundBiomass.py,sha256=zzsE1zr8qYWgc1EWNrCZggjk
|
|
|
919
920
|
tests/models/ipcc2019/test_aboveGroundCropResidueTotal.py,sha256=HrTsqm1r5c5di5JONu7P4_95JMp1kbDuKfQjWLE0Jhs,2573
|
|
920
921
|
tests/models/ipcc2019/test_belowGroundBiomass.py,sha256=Cu41RM63R-xti0qi_mLD0J5TClo61OkjsR4FI3caNxs,7579
|
|
921
922
|
tests/models/ipcc2019/test_belowGroundCropResidue.py,sha256=no71pfxgOhn_tEWc_EwuWvlKRtHFqlIqNIvnP7cj0Tc,2568
|
|
923
|
+
tests/models/ipcc2019/test_biocharOrganicCarbonPerHa.py,sha256=19SX8sCKjyqThydHBh7jE9S46Y6SBd-pJx_RUmuZ0nU,3785
|
|
922
924
|
tests/models/ipcc2019/test_biomass_utils.py,sha256=I2q4pDGAD0aY_kpZCMPJoC-KbRYxdzY1rhr4xtJFWIA,3592
|
|
923
925
|
tests/models/ipcc2019/test_carbonContent.py,sha256=_GWF5nGy-PxiqBZ5V7W_sHMz75YRzmxr79R-sZZg7yk,4146
|
|
924
926
|
tests/models/ipcc2019/test_ch4ToAirAquacultureSystems.py,sha256=hG1zunH2gCeix8fxxkoGfl_I0GRyAcLbwEtwWVE9i5M,1925
|
|
@@ -935,7 +937,7 @@ tests/models/ipcc2019/test_co2ToAirSoilOrganicCarbonStockChange.py,sha256=gPT_yy
|
|
|
935
937
|
tests/models/ipcc2019/test_co2ToAirUreaHydrolysis.py,sha256=2u4_jtekmVzLTwKpNr1fVcAzgegm17Fh9h59JRXFpOM,1030
|
|
936
938
|
tests/models/ipcc2019/test_croppingDuration.py,sha256=1oRW1QaEwQvBadyVhaDi-jlkjuNqodyAinl88TdPmiY,1879
|
|
937
939
|
tests/models/ipcc2019/test_ligninContent.py,sha256=eIKEN__ab-0R52EhlhPSBiHnmTl6xOf1XbI33O-W9A4,4146
|
|
938
|
-
tests/models/ipcc2019/test_n2OToAirCropResidueBurningDirect.py,sha256=
|
|
940
|
+
tests/models/ipcc2019/test_n2OToAirCropResidueBurningDirect.py,sha256=Zg21yPx5lsf1lwbEzBNvyG2-06Qq5MUVDhteLcukp94,1528
|
|
939
941
|
tests/models/ipcc2019/test_n2OToAirCropResidueDecompositionDirect.py,sha256=vKbWQNZAGPtsqonM-Cc3n3hNitft0hcjn2TNrTFC1iY,2729
|
|
940
942
|
tests/models/ipcc2019/test_n2OToAirCropResidueDecompositionIndirect.py,sha256=it2PVNYBNAvQWmWLDJ9Evjqtx7SJl-X0ZyQz3Fuvb3k,2119
|
|
941
943
|
tests/models/ipcc2019/test_n2OToAirExcretaDirect.py,sha256=-ddwSZia_QQXSrCbIrv_uQMUO3X9_WNk2WtKF8gSYTM,1627
|
|
@@ -1210,7 +1212,7 @@ tests/models/utils/test_array_builders.py,sha256=_ZxbKVReS9U2s6PhnXRqSKCsa9j-2Bx
|
|
|
1210
1212
|
tests/models/utils/test_blank_node.py,sha256=F5pCV-5bKxqsrubjN1W-PACltBljF7z84_7lFBcDFJs,32871
|
|
1211
1213
|
tests/models/utils/test_cache_sources.py,sha256=xcGMVbYoV23YC4HLBTL_4qZP1ME2cp3DFebgJMxI2TE,721
|
|
1212
1214
|
tests/models/utils/test_crop.py,sha256=d508vQdtB_Q_6hEahNueXed5PaEiLeN7ScbwZIKCiDI,862
|
|
1213
|
-
tests/models/utils/test_cropResidue.py,sha256=
|
|
1215
|
+
tests/models/utils/test_cropResidue.py,sha256=RmOgKEdnhvw9uJbSSLmGyeztFXqiqf7UwDfwrC64ArI,904
|
|
1214
1216
|
tests/models/utils/test_cropResidueManagement.py,sha256=RQt8lexeJzCyxZceIutgDpw7BpcqmjsUB0C0yZC2QpY,930
|
|
1215
1217
|
tests/models/utils/test_currency.py,sha256=BPsojPsY9QW2aj8vgbjkPQXU8GU6wDwwtPZ3HdC4KTU,277
|
|
1216
1218
|
tests/models/utils/test_dataCompleteness.py,sha256=Dx3qRUfEW6xqXPdaitJBny8bkfE6rdZvRO9EynuaPMc,1727
|
|
@@ -1249,8 +1251,8 @@ tests/orchestrator/strategies/run/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeR
|
|
|
1249
1251
|
tests/orchestrator/strategies/run/test_add_blank_node_if_missing.py,sha256=K4xg4UAXfNhSaLyknKVPO7MGBF44Z_gD7CuZ_pe28gU,3512
|
|
1250
1252
|
tests/orchestrator/strategies/run/test_add_key_if_missing.py,sha256=hKwvk1ohcBVnQUCTiDhRW99J0xEa29BpwFi1KC0yWLE,329
|
|
1251
1253
|
tests/orchestrator/strategies/run/test_always.py,sha256=w5-Dhp6yLzgZGAeMRz3OrqZbbAed9gZ1O266a3z9k7w,134
|
|
1252
|
-
hestia_earth_models-0.73.
|
|
1253
|
-
hestia_earth_models-0.73.
|
|
1254
|
-
hestia_earth_models-0.73.
|
|
1255
|
-
hestia_earth_models-0.73.
|
|
1256
|
-
hestia_earth_models-0.73.
|
|
1254
|
+
hestia_earth_models-0.73.5.dist-info/LICENSE,sha256=TD25LoiRJsA5CPUNrcyt1PXlGcbUGFMAeZoBcfCrCNE,1154
|
|
1255
|
+
hestia_earth_models-0.73.5.dist-info/METADATA,sha256=waCb4T4IfTXsSP5YtJg9ac3PfcnmIDejSOW2sgFDf4I,4065
|
|
1256
|
+
hestia_earth_models-0.73.5.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
|
1257
|
+
hestia_earth_models-0.73.5.dist-info/top_level.txt,sha256=1dqA9TqpOLTEgpqa-YBsmbCmmNU1y56AtfFGEceZ2A0,19
|
|
1258
|
+
hestia_earth_models-0.73.5.dist-info/RECORD,,
|
|
@@ -5,14 +5,15 @@ from hestia_earth.models.akagiEtAl2011.utils import MODEL, _should_run
|
|
|
5
5
|
class_path = f"hestia_earth.models.{MODEL}.utils"
|
|
6
6
|
|
|
7
7
|
|
|
8
|
+
@patch(f"{class_path}.get_lookup_value", return_value=10)
|
|
8
9
|
@patch(f"{class_path}.get_crop_residue_burnt_value")
|
|
9
10
|
def test_should_run(mock_product_value, *args):
|
|
10
11
|
# no products => no run
|
|
11
|
-
mock_product_value.return_value =
|
|
12
|
+
mock_product_value.return_value = None
|
|
12
13
|
should_run, *args = _should_run('', {})
|
|
13
14
|
assert not should_run
|
|
14
15
|
|
|
15
16
|
# with products => run
|
|
16
|
-
mock_product_value.return_value =
|
|
17
|
+
mock_product_value.return_value = 10
|
|
17
18
|
should_run, *args = _should_run('', {})
|
|
18
19
|
assert should_run is True
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import logging
|
|
1
2
|
import os
|
|
2
3
|
import json
|
|
3
4
|
import pytest
|
|
@@ -13,7 +14,10 @@ from hestia_earth.models.hestia.landCover import (
|
|
|
13
14
|
|
|
14
15
|
CLASS_PATH = f"hestia_earth.models.{MODEL}.{MODEL_KEY}"
|
|
15
16
|
fixtures_folder = f"{fixtures_path}/{MODEL}/{MODEL_KEY}"
|
|
16
|
-
_folders = [
|
|
17
|
+
_folders = [
|
|
18
|
+
d for d in os.listdir(fixtures_folder)
|
|
19
|
+
if os.path.isdir(os.path.join(fixtures_folder, d)) and not d.startswith("_")
|
|
20
|
+
]
|
|
17
21
|
|
|
18
22
|
FAOSTAT_CLASS_PATH = f"hestia_earth.models.{FAOSTAT_MODEL}.utils"
|
|
19
23
|
faostat_fixtures_folder = f"{fixtures_path}/{FAOSTAT_MODEL}/utils"
|
|
@@ -254,3 +258,31 @@ def test_run(mock, subfolder: str):
|
|
|
254
258
|
|
|
255
259
|
result = run(site)
|
|
256
260
|
assert result == expected
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
def fake_region_lookup(lookup_name: str, term_id: str, column: str, **log_args):
|
|
264
|
+
"""Returns obviously-wrong mock results from Brazil to be distinct from model."""
|
|
265
|
+
return ("2010:55.0")
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
@patch(f"{CLASS_PATH}.get_region_lookup_value", side_effect=fake_region_lookup)
|
|
269
|
+
@patch(f"{CLASS_PATH}._new_management", side_effect=fake_new_management)
|
|
270
|
+
def test_landCover_from_lookup_run(mock_mgmt, mock_region_lookup, caplog):
|
|
271
|
+
caplog.set_level(logging.INFO)
|
|
272
|
+
folder = f"{fixtures_folder}/_from_lookups"
|
|
273
|
+
with open(f"{folder}/site.jsonld", encoding='utf-8') as f:
|
|
274
|
+
site = json.load(f)
|
|
275
|
+
|
|
276
|
+
with open(f"{folder}/result.jsonld", encoding='utf-8') as f:
|
|
277
|
+
expected = json.load(f)
|
|
278
|
+
|
|
279
|
+
result = run(site)
|
|
280
|
+
expected_message = ("site=Brazil-example, requirements=true, model=hestia, model_key=landCover, "
|
|
281
|
+
"has_management_nodes=True, land_use_type=Arable land, allowed_land_use_types=Arable land;"
|
|
282
|
+
"Permanent crops;Permanent meadows and pastures, has_no_prior_land_cover_data=True, "
|
|
283
|
+
"management_nodes=value:100_id:maizePlant_land-use-type:Arable land_endDate:2010-12-31"
|
|
284
|
+
"_startDate:2010-01-01, landCover_from_lookups={'Forest land': 0.55, 'Arable land': 0.55, "
|
|
285
|
+
"'Permanent crops': 0.55, 'Permanent meadows and pastures': 0.55, 'Other land': 0.55}, "
|
|
286
|
+
"should_run_nodes=True")
|
|
287
|
+
assert expected_message in [r.msg for r in caplog.records]
|
|
288
|
+
assert result == expected
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import json
|
|
2
|
+
from os.path import isfile
|
|
3
|
+
from pytest import mark
|
|
4
|
+
from unittest.mock import MagicMock, patch
|
|
5
|
+
|
|
6
|
+
from hestia_earth.models.ipcc2019.biocharOrganicCarbonPerHa import _should_run, MODEL, run, TERM_ID
|
|
7
|
+
|
|
8
|
+
from tests.utils import fake_new_measurement, fixtures_path
|
|
9
|
+
|
|
10
|
+
class_path = f"hestia_earth.models.{MODEL}.{TERM_ID}"
|
|
11
|
+
property_path = "hestia_earth.models.utils.property"
|
|
12
|
+
fixtures_folder = f"{fixtures_path}/{MODEL}/{TERM_ID}"
|
|
13
|
+
|
|
14
|
+
_DEFAULT_PROPERTIES = {
|
|
15
|
+
"biocharManureGasification": {
|
|
16
|
+
"organicCarbonContent": {
|
|
17
|
+
"value": 9,
|
|
18
|
+
"sd": 2.4,
|
|
19
|
+
"min": 0,
|
|
20
|
+
"max": 100
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"biocharBambooLowTemperaturePyrolysis": {
|
|
24
|
+
"organicCarbonContent": {
|
|
25
|
+
"value": 77,
|
|
26
|
+
"sd": 16.5,
|
|
27
|
+
"min": 0,
|
|
28
|
+
"max": 100
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"biocharStrawHighTemperaturePyrolysis": {
|
|
32
|
+
"organicCarbonContent": {
|
|
33
|
+
"value": 65,
|
|
34
|
+
"sd": 14.9,
|
|
35
|
+
"min": 0,
|
|
36
|
+
"max": 100
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"biocharPaperSludgeMediumTemperaturePyrolysis": {
|
|
40
|
+
"organicCarbonContent": {
|
|
41
|
+
"value": 35,
|
|
42
|
+
"sd": 7.1,
|
|
43
|
+
"min": 0,
|
|
44
|
+
"max": 100
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"biocharUnspecifiedFeedstockUnspecifiedProductionMethod": {
|
|
48
|
+
"organicCarbonContent": {
|
|
49
|
+
"value": 40.6,
|
|
50
|
+
"sd": 10.5,
|
|
51
|
+
"min": 0,
|
|
52
|
+
"max": 100
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def fake_find_term_property(term: dict, property: str, *_):
|
|
59
|
+
term_id = term.get('@id', None)
|
|
60
|
+
return _DEFAULT_PROPERTIES.get(term_id, {}).get(property, {})
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def _load_fixture(path: str, default=None):
|
|
64
|
+
if isfile(path):
|
|
65
|
+
with open(path, encoding="utf-8") as f:
|
|
66
|
+
return json.load(f)
|
|
67
|
+
return default
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
# subfolder, should_run
|
|
71
|
+
PARAMS_SHOULD_RUN = [
|
|
72
|
+
("with-stats", True),
|
|
73
|
+
("no-biochar", True),
|
|
74
|
+
("no-cycles", False),
|
|
75
|
+
("with-organic-soils", False),
|
|
76
|
+
("with-relative-func-unit", False),
|
|
77
|
+
("with-site-type-forest", False)
|
|
78
|
+
]
|
|
79
|
+
IDS_SHOULD_RUN = [p[0] for p in PARAMS_SHOULD_RUN]
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
@mark.parametrize("subfolder, should_run", PARAMS_SHOULD_RUN, ids=IDS_SHOULD_RUN)
|
|
83
|
+
@patch(f"{property_path}.find_term_property", side_effect=fake_find_term_property)
|
|
84
|
+
@patch(f"{property_path}.download_term")
|
|
85
|
+
@patch(f"{class_path}.related_cycles")
|
|
86
|
+
def test_should_run(
|
|
87
|
+
related_cycles_mock: MagicMock,
|
|
88
|
+
download_term_mock: MagicMock,
|
|
89
|
+
_find_term_property_mock: MagicMock,
|
|
90
|
+
subfolder: str,
|
|
91
|
+
should_run: bool
|
|
92
|
+
):
|
|
93
|
+
folder = f"{fixtures_folder}/{subfolder}"
|
|
94
|
+
|
|
95
|
+
site = _load_fixture(f"{folder}/site.jsonld", {})
|
|
96
|
+
related_cycles_mock.return_value = _load_fixture(f"{folder}/cycles.jsonld", [])
|
|
97
|
+
|
|
98
|
+
result, *_ = _should_run(site)
|
|
99
|
+
assert result == should_run
|
|
100
|
+
|
|
101
|
+
# Ensure that the property utils are properly mocked.
|
|
102
|
+
download_term_mock.assert_not_called()
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
PARAMS_RUN = [subfolder for subfolder, should_run in PARAMS_SHOULD_RUN if should_run]
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
@mark.parametrize("subfolder", PARAMS_RUN)
|
|
109
|
+
@patch(f"{property_path}.find_term_property", side_effect=fake_find_term_property)
|
|
110
|
+
@patch(f"{property_path}.download_term")
|
|
111
|
+
@patch(f"{class_path}.related_cycles")
|
|
112
|
+
@patch(f"{class_path}._new_measurement", side_effect=fake_new_measurement)
|
|
113
|
+
def test_run(
|
|
114
|
+
_new_measurement_mock: MagicMock,
|
|
115
|
+
related_cycles_mock: MagicMock,
|
|
116
|
+
download_term_mock: MagicMock,
|
|
117
|
+
_find_term_property_mock: MagicMock,
|
|
118
|
+
subfolder: str
|
|
119
|
+
):
|
|
120
|
+
folder = f"{fixtures_folder}/{subfolder}"
|
|
121
|
+
|
|
122
|
+
site = _load_fixture(f"{folder}/site.jsonld", {})
|
|
123
|
+
related_cycles_mock.return_value = _load_fixture(f"{folder}/cycles.jsonld", [])
|
|
124
|
+
|
|
125
|
+
expected = _load_fixture(f"{folder}/result.jsonld", [])
|
|
126
|
+
|
|
127
|
+
result = run(site)
|
|
128
|
+
assert result == expected
|
|
129
|
+
|
|
130
|
+
# Ensure that the property utils are properly mocked.
|
|
131
|
+
download_term_mock.assert_not_called()
|
|
@@ -8,15 +8,16 @@ class_path = f"hestia_earth.models.{MODEL}.{TERM_ID}"
|
|
|
8
8
|
fixtures_folder = f"{fixtures_path}/{MODEL}/{TERM_ID}"
|
|
9
9
|
|
|
10
10
|
|
|
11
|
+
@patch(f"{class_path}.get_lookup_value", return_value=10)
|
|
11
12
|
@patch(f"{class_path}.get_crop_residue_burnt_value")
|
|
12
13
|
def test_should_run(mock_product_value, *args):
|
|
13
14
|
# no products => no run
|
|
14
|
-
mock_product_value.return_value =
|
|
15
|
+
mock_product_value.return_value = None
|
|
15
16
|
should_run, *args = _should_run({})
|
|
16
17
|
assert not should_run
|
|
17
18
|
|
|
18
19
|
# with products => run
|
|
19
|
-
mock_product_value.return_value =
|
|
20
|
+
mock_product_value.return_value = 10
|
|
20
21
|
should_run, *args = _should_run({})
|
|
21
22
|
assert should_run is True
|
|
22
23
|
|
|
@@ -7,20 +7,20 @@ class_path = 'hestia_earth.models.utils.cropResidue'
|
|
|
7
7
|
|
|
8
8
|
@patch(f"{class_path}.find_term_match", return_value=None)
|
|
9
9
|
@patch(f"{class_path}._is_term_type_complete", return_value=False)
|
|
10
|
-
def
|
|
10
|
+
def test_get_crop_residue_burnt_value(mock_data_complete, mock_find_product):
|
|
11
11
|
# product not found no data complete
|
|
12
12
|
mock_data_complete.return_value = False
|
|
13
13
|
mock_find_product.return_value = {}
|
|
14
14
|
value = get_crop_residue_burnt_value({})
|
|
15
|
-
assert value
|
|
15
|
+
assert value is None
|
|
16
16
|
|
|
17
17
|
# product not found and data complete
|
|
18
18
|
mock_data_complete.return_value = True
|
|
19
19
|
mock_find_product.return_value = {}
|
|
20
20
|
value = get_crop_residue_burnt_value({})
|
|
21
|
-
assert value ==
|
|
21
|
+
assert value == 0
|
|
22
22
|
|
|
23
23
|
# product found
|
|
24
24
|
mock_find_product.return_value = {'value': [100]}
|
|
25
25
|
value = get_crop_residue_burnt_value({})
|
|
26
|
-
assert value ==
|
|
26
|
+
assert value == 200
|
|
File without changes
|
|
File without changes
|
|
File without changes
|