hestia-earth-models 0.73.5__py3-none-any.whl → 0.73.6__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/config/Cycle.json +0 -45
- hestia_earth/models/config/ImpactAssessment.json +0 -24
- hestia_earth/models/geospatialDatabase/potentialEvapotranspirationAnnual.py +2 -1
- hestia_earth/models/geospatialDatabase/precipitationAnnual.py +2 -1
- hestia_earth/models/geospatialDatabase/temperatureAnnual.py +2 -1
- hestia_earth/models/hestia/landCover.py +60 -37
- hestia_earth/models/mocking/search-results.json +308 -308
- hestia_earth/models/utils/__init__.py +10 -1
- hestia_earth/models/utils/blank_node.py +1 -1
- hestia_earth/models/version.py +1 -1
- {hestia_earth_models-0.73.5.dist-info → hestia_earth_models-0.73.6.dist-info}/METADATA +2 -2
- {hestia_earth_models-0.73.5.dist-info → hestia_earth_models-0.73.6.dist-info}/RECORD +17 -20
- tests/models/hestia/test_landCover.py +27 -3
- tests/models/test_utils.py +6 -0
- hestia_earth/models/faostat2018/landTransformation100YearAverageDuringCycle.py +0 -34
- hestia_earth/models/faostat2018/landTransformation20YearAverageDuringCycle.py +0 -34
- tests/models/faostat2018/test_landTransformation100YearAverageDuringCycle.py +0 -21
- tests/models/faostat2018/test_landTransformation20YearAverageDuringCycle.py +0 -21
- {hestia_earth_models-0.73.5.dist-info → hestia_earth_models-0.73.6.dist-info}/LICENSE +0 -0
- {hestia_earth_models-0.73.5.dist-info → hestia_earth_models-0.73.6.dist-info}/WHEEL +0 -0
- {hestia_earth_models-0.73.5.dist-info → hestia_earth_models-0.73.6.dist-info}/top_level.txt +0 -0
|
@@ -11,7 +11,7 @@ from pydash.objects import get
|
|
|
11
11
|
from typing import Union, List, Callable
|
|
12
12
|
from hestia_earth.schema import SchemaType
|
|
13
13
|
from hestia_earth.utils.api import download_hestia
|
|
14
|
-
from hestia_earth.utils.tools import flatten, non_empty_list
|
|
14
|
+
from hestia_earth.utils.tools import flatten, non_empty_list, safe_parse_date
|
|
15
15
|
from hestia_earth.utils.date import is_in_days, is_in_months
|
|
16
16
|
|
|
17
17
|
from .constant import Units
|
|
@@ -157,6 +157,15 @@ def current_date(): return datetime.datetime.now().date().strftime('%Y-%m-%d')
|
|
|
157
157
|
def current_year(): return int(current_date()[:4])
|
|
158
158
|
|
|
159
159
|
|
|
160
|
+
def max_date(date_str: str):
|
|
161
|
+
"""
|
|
162
|
+
If the date is after today, returns today. Otherwise returns the date.
|
|
163
|
+
"""
|
|
164
|
+
date = safe_parse_date(date_str).date()
|
|
165
|
+
max_date = datetime.datetime.now().date()
|
|
166
|
+
return current_date() if date > max_date else date_str
|
|
167
|
+
|
|
168
|
+
|
|
160
169
|
def flatten_args(args) -> list:
|
|
161
170
|
"""
|
|
162
171
|
Flatten the input args into a single list.
|
|
@@ -584,7 +584,7 @@ def cumulative_nodes_match(
|
|
|
584
584
|
"""
|
|
585
585
|
values = [
|
|
586
586
|
get_node_value(
|
|
587
|
-
node, 'value', is_larger_unit, array_treatment
|
|
587
|
+
node, key='value', is_larger_unit=is_larger_unit, array_treatment=array_treatment
|
|
588
588
|
) or default_node_value for node in nodes if function(node)
|
|
589
589
|
]
|
|
590
590
|
|
hestia_earth/models/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
VERSION = '0.73.
|
|
1
|
+
VERSION = '0.73.6'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: hestia-earth-models
|
|
3
|
-
Version: 0.73.
|
|
3
|
+
Version: 0.73.6
|
|
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
|
|
@@ -12,7 +12,7 @@ Classifier: Programming Language :: Python :: 3.6
|
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
13
|
License-File: LICENSE
|
|
14
14
|
Requires-Dist: hestia-earth-schema==33.*
|
|
15
|
-
Requires-Dist: hestia-earth-utils>=0.14.
|
|
15
|
+
Requires-Dist: hestia-earth-utils>=0.14.9
|
|
16
16
|
Requires-Dist: python-dateutil>=2.8.1
|
|
17
17
|
Requires-Dist: CurrencyConverter==0.16.8
|
|
18
18
|
Requires-Dist: haversine>=2.7.0
|
|
@@ -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=gitCsBIWkcodAN8Lqch7WqL2CaXjTfpeoB_0nJ451NM,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
|
|
@@ -35,8 +35,8 @@ hestia_earth/models/cml2001Baseline/terrestrialAcidificationPotentialIncludingFa
|
|
|
35
35
|
hestia_earth/models/cml2001NonBaseline/__init__.py,sha256=vI8wp8Og_e8DiJqYYvp33YoI3t4ffAC31LWlnV20JTg,419
|
|
36
36
|
hestia_earth/models/cml2001NonBaseline/eutrophicationPotentialIncludingFateAverageEurope.py,sha256=lcgyRHY08KCBFPERJNqV4DYGEJCvyHBDnJXD0kEkVqM,1097
|
|
37
37
|
hestia_earth/models/cml2001NonBaseline/terrestrialAcidificationPotentialExcludingFate.py,sha256=xcrxfs9UoV_EWvV-XzMt35oPWCUsTzqg2SGA3j2MFIw,1091
|
|
38
|
-
hestia_earth/models/config/Cycle.json,sha256=
|
|
39
|
-
hestia_earth/models/config/ImpactAssessment.json,sha256=
|
|
38
|
+
hestia_earth/models/config/Cycle.json,sha256=DSwKJd-5UX4Lnt3C3sHeYKHh6Zr2Fe-RgTas2DoDTGA,57840
|
|
39
|
+
hestia_earth/models/config/ImpactAssessment.json,sha256=VLkGnDNGLilYK2410STpB63MO_hzOQCaY6QgUcvJLz0,60323
|
|
40
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
|
|
@@ -136,8 +136,6 @@ hestia_earth/models/fantkeEtAl2016/damageToHumanHealthParticulateMatterFormation
|
|
|
136
136
|
hestia_earth/models/faostat2018/__init__.py,sha256=ecN-pKF1pkFnzmooBrg1VAxJkG76q9v4piiaKGP_vbo,412
|
|
137
137
|
hestia_earth/models/faostat2018/coldCarcassWeightPerHead.py,sha256=Qf_nvHxT4mn9kSNgOEXJUX0oUIOuuw0KSzLf-si04tQ,3105
|
|
138
138
|
hestia_earth/models/faostat2018/coldDressedCarcassWeightPerHead.py,sha256=2WqIFxUMHngcsY7CffAn0bZClB_VXW1egtvBrKOFmxw,3196
|
|
139
|
-
hestia_earth/models/faostat2018/landTransformation100YearAverageDuringCycle.py,sha256=Pp94-1uMHN-jlMIbUQB-Go26WAxtMtTmf8zyyyAEvvk,998
|
|
140
|
-
hestia_earth/models/faostat2018/landTransformation20YearAverageDuringCycle.py,sha256=LNQfb_vqNsJOrgZXVo6m9hBGdI8OaHSnfA9jSbp6JVY,995
|
|
141
139
|
hestia_earth/models/faostat2018/liveweightPerHead.py,sha256=2BmSe8xdEdm68i6t_UkeXQshxLH3WVNyvButsoE_9zE,5031
|
|
142
140
|
hestia_earth/models/faostat2018/readyToCookWeightPerHead.py,sha256=obJLPV8GgG2lEhLqg9RrJLSFPzbasXJnmzHnwkpW7O0,3131
|
|
143
141
|
hestia_earth/models/faostat2018/seed.py,sha256=brDGypvFJR6gpb4VMTW16cN2Jw0jbvD2msV-NMWuwxQ,2948
|
|
@@ -160,10 +158,10 @@ hestia_earth/models/geospatialDatabase/histosol.py,sha256=uVl96zpxPHYDW81SxnEpMP
|
|
|
160
158
|
hestia_earth/models/geospatialDatabase/longFallowRatio.py,sha256=X-qJS0euYVwhGHd4rCnlRSL3KOMLQJl5kO8QqSREcpA,2561
|
|
161
159
|
hestia_earth/models/geospatialDatabase/nutrientLossToAquaticEnvironment.py,sha256=uEsoYJ1mzgUo6fQhUrcJ-ATcFw1j9oEgqMXKbQuFRxQ,1973
|
|
162
160
|
hestia_earth/models/geospatialDatabase/organicCarbonPerKgSoil.py,sha256=pGy35cvt5Rzv2h0ka5PZqZqWp0wThWqJL8o_nVZinCo,2862
|
|
163
|
-
hestia_earth/models/geospatialDatabase/potentialEvapotranspirationAnnual.py,sha256=
|
|
161
|
+
hestia_earth/models/geospatialDatabase/potentialEvapotranspirationAnnual.py,sha256=UZl-1PlopZdhjzeCU2dbxQJhU7IeTIUI6oT4TPQ2mSQ,2453
|
|
164
162
|
hestia_earth/models/geospatialDatabase/potentialEvapotranspirationLongTermAnnualMean.py,sha256=YywD9wCkGFF1q60LocXNvLr-tQ2_9km2PrVnXRgN83E,2125
|
|
165
163
|
hestia_earth/models/geospatialDatabase/potentialEvapotranspirationMonthly.py,sha256=rt-MNUYkFruViMSPJV6r66042227CdCLmccYT48dU4o,3197
|
|
166
|
-
hestia_earth/models/geospatialDatabase/precipitationAnnual.py,sha256=
|
|
164
|
+
hestia_earth/models/geospatialDatabase/precipitationAnnual.py,sha256=ljqttqQ7bZqMOWt9hGxsGGjQ4u1wm7IpUS-J19ttrAU,2714
|
|
167
165
|
hestia_earth/models/geospatialDatabase/precipitationLongTermAnnualMean.py,sha256=wZ_QprRT9ILSNpiUhPdKtTERUsGofQT1kqUaHuJjDOs,2390
|
|
168
166
|
hestia_earth/models/geospatialDatabase/precipitationMonthly.py,sha256=jQ3XLN8Zh7q2LZgLmybzvwR0X2vdi6IDz301EUVbAmE,3261
|
|
169
167
|
hestia_earth/models/geospatialDatabase/region.py,sha256=55tjxaffUaQnJ_kqWd-eejhLMs-5N2CjUQd9FU1wWoU,1448
|
|
@@ -172,7 +170,7 @@ hestia_earth/models/geospatialDatabase/siltContent.py,sha256=rFUlQ3SlwCJFcMYQd5F
|
|
|
172
170
|
hestia_earth/models/geospatialDatabase/slope.py,sha256=g1SpuYks60injv2w-CMjESNfu8KM1JsiYnRT9XZfSuY,1859
|
|
173
171
|
hestia_earth/models/geospatialDatabase/slopeLength.py,sha256=6pGr1qR0EiiUKkeflpYut7eI6UsnXAzHDoHhAzXKFJk,1864
|
|
174
172
|
hestia_earth/models/geospatialDatabase/soilPh.py,sha256=f-jZhIpbsVDe_lGm0rfA7K0vRRTy0M5adKA-_-W11LU,2799
|
|
175
|
-
hestia_earth/models/geospatialDatabase/temperatureAnnual.py,sha256=
|
|
173
|
+
hestia_earth/models/geospatialDatabase/temperatureAnnual.py,sha256=sI1j-Zw5cAlLRElv6c-RhHDMz4vQZV7yuKCEgqEV4sw,2610
|
|
176
174
|
hestia_earth/models/geospatialDatabase/temperatureLongTermAnnualMean.py,sha256=ypQbdbily63m_B7t7_aTaJ8RN9gzzauHeZTFDgFhlds,2230
|
|
177
175
|
hestia_earth/models/geospatialDatabase/temperatureMonthly.py,sha256=E2k2kkhVDtmeFEB4_AZhhq5od57lRDMWu6AqaurgqvQ,3194
|
|
178
176
|
hestia_earth/models/geospatialDatabase/totalNitrogenPerKgSoil.py,sha256=eajSzMCX201k_xrfZZSHtTzEIH29hqgJdztQgQeewig,2853
|
|
@@ -205,7 +203,7 @@ hestia_earth/models/hestia/freshWater.py,sha256=Q-dmFJLZfyYEyFyYkJUOjgmQR3G5YXCX
|
|
|
205
203
|
hestia_earth/models/hestia/histosol.py,sha256=IexiWTSlSJYGjrdpYmRooW6v8LjhYATPQ8smMz1UZBA,1612
|
|
206
204
|
hestia_earth/models/hestia/inorganicFertiliser.py,sha256=We4PBaTXyGwEQTfhX0-J8Xt03p-FB9i9j3tEK5JQ8uE,9026
|
|
207
205
|
hestia_earth/models/hestia/irrigatedTypeUnspecified.py,sha256=VdYzfYxcRzWv21qxRkDn9HBid7-Bt_CgIv4iyXJH03g,1929
|
|
208
|
-
hestia_earth/models/hestia/landCover.py,sha256=
|
|
206
|
+
hestia_earth/models/hestia/landCover.py,sha256=VI3DiDxbdHe54S47ixO4PIPyGVtt-Hw_QRScQokOEVo,35569
|
|
209
207
|
hestia_earth/models/hestia/landTransformation100YearAverageDuringCycle.py,sha256=hF7_DDvrs7swH6ott_ihgYx13UzEKHH6pccYCtzrN8o,1069
|
|
210
208
|
hestia_earth/models/hestia/landTransformation20YearAverageDuringCycle.py,sha256=05SCH6ZjEV3mIleRusBg677zu0xgu5YK0f9FCddgNPg,1067
|
|
211
209
|
hestia_earth/models/hestia/liveAnimal.py,sha256=d7HuUi40c-7TN1kecdRuqbht8PAe7x4ps0NhSuWG34Q,3868
|
|
@@ -449,7 +447,7 @@ hestia_earth/models/linkedImpactAssessment/utils.py,sha256=7M-E7u35fIF0uMoA1hwcr
|
|
|
449
447
|
hestia_earth/models/mocking/__init__.py,sha256=9VX50c-grz-snfd-7MBS0KfF7AadtbKuj7kK6PqtsgE,687
|
|
450
448
|
hestia_earth/models/mocking/build_mock_search.py,sha256=p15ccEUmkmLp1RiGNznxMz3OFHbI8P1-29ExuohiQN8,1355
|
|
451
449
|
hestia_earth/models/mocking/mock_search.py,sha256=ccFe_WrI73JElFmxp4hPNLCX7eeU--lBC1JFR901KJY,1069
|
|
452
|
-
hestia_earth/models/mocking/search-results.json,sha256=
|
|
450
|
+
hestia_earth/models/mocking/search-results.json,sha256=RirhWmqO7ySe_qzdefCJuQb4iacXB_ioJLjaN940VXY,162692
|
|
453
451
|
hestia_earth/models/pooreNemecek2018/__init__.py,sha256=nPboL7ULJzL5nJD5q7q9VOZt_fxbKVm8fmn1Az5YkVY,417
|
|
454
452
|
hestia_earth/models/pooreNemecek2018/aboveGroundCropResidueTotal.py,sha256=oXillpppAas1q9GKmODxe1YXyno3EzV-j12xhzkqtTc,2404
|
|
455
453
|
hestia_earth/models/pooreNemecek2018/belowGroundCropResidue.py,sha256=_pQMPSvI--Xm00H6vXDA4ct_pQXKRGrLE2f-2tQE6y4,2323
|
|
@@ -591,12 +589,12 @@ hestia_earth/models/transformation/product/__init__.py,sha256=47DEQpj8HBSa-_TImW
|
|
|
591
589
|
hestia_earth/models/transformation/product/excreta.py,sha256=tggXIoUujzu8O949_3KFog219k_bQ0IcytpCsJ8oMcc,5384
|
|
592
590
|
hestia_earth/models/usetoxV2/__init__.py,sha256=pK37V3H-KvYcvRKw4Mv8CWrB2N0LFLzmv0jKLdhGGqs,409
|
|
593
591
|
hestia_earth/models/usetoxV2/freshwaterEcotoxicityPotentialCtue.py,sha256=pPX8u-Aq6Pg5Y9xw0CS0S2WkAHQpOMl0lL2tLQwwOuU,918
|
|
594
|
-
hestia_earth/models/utils/__init__.py,sha256=
|
|
592
|
+
hestia_earth/models/utils/__init__.py,sha256=0v-wjG9xzJeitWEUN3XRleM_is1AkVm2r7WkApB7-ho,7136
|
|
595
593
|
hestia_earth/models/utils/aggregated.py,sha256=G7FNJfHqJ_eoXB66kGdjLyZGDOI_gsF56o7VnyW3bqA,4801
|
|
596
594
|
hestia_earth/models/utils/animalProduct.py,sha256=M5IunAKGY6oZv3j1Ascl34ywyeLWApqOIlBzbtlA2FE,721
|
|
597
595
|
hestia_earth/models/utils/aquacultureManagement.py,sha256=dxrbC1Xf140cohxTbSw6TxLAnAASWTdNZwBBam4yQnw,171
|
|
598
596
|
hestia_earth/models/utils/background_emissions.py,sha256=54zuH4yFNc_cle3uYGtK_EjhkG0XGaG5L6eGKiTyOG4,3100
|
|
599
|
-
hestia_earth/models/utils/blank_node.py,sha256=
|
|
597
|
+
hestia_earth/models/utils/blank_node.py,sha256=Y4Q1wnddrMyo9NEqKFcmt43LKHPWDlbe9l1seDcU8K0,56105
|
|
600
598
|
hestia_earth/models/utils/cache_sources.py,sha256=MBkrPpjwNiC4ApDjeYVHZjWBbpvAerXRDrMHpjasAZ0,377
|
|
601
599
|
hestia_earth/models/utils/completeness.py,sha256=iRG4uviOAQQ4T2Nr4LlelPVTS_F1felGZNJYxek_JG8,1239
|
|
602
600
|
hestia_earth/models/utils/constant.py,sha256=DmB3VVuoh7Pz2QDBJqiUG6yAML2i0fOy1BPuPHmhT1w,3442
|
|
@@ -660,6 +658,7 @@ tests/models/test_ecoinventV3.py,sha256=SvBn1ZomoturZhjj4BE2EU46Sq0il-tOJIqutmGa
|
|
|
660
658
|
tests/models/test_ecoinventV3AndEmberClimate.py,sha256=_7sX0s07Xr00uNcVk78L1AdSqI1OpUV3tkkG1hVSY2w,803
|
|
661
659
|
tests/models/test_emissionNotRelevant.py,sha256=TsIV47lpn7joLGx-LlPVqWbshcLf2c6pUvB3FZwLvwY,1023
|
|
662
660
|
tests/models/test_resourceUseNotRelevant.py,sha256=z1zY3pJdffongIsBJaLB7WToBrMiE4wYuHSsAbGEJ7w,983
|
|
661
|
+
tests/models/test_utils.py,sha256=Caa9sCyz25egPrSlu7FQhjXD2vNcQW9gea_ppUYOsEs,186
|
|
663
662
|
tests/models/agribalyse2016/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
664
663
|
tests/models/agribalyse2016/test_fuelElectricity.py,sha256=u_wNlqngJc8NELPr16kYsYQ-_2PcL8BnrfJucY7dccU,1353
|
|
665
664
|
tests/models/agribalyse2016/test_machineryInfrastructureDepreciatedAmountPerCycle.py,sha256=75yJ0yuPbIizpSsHr7CpZnUv01LZbuYsm5s9hE0VL_o,1090
|
|
@@ -776,8 +775,6 @@ tests/models/faostat2018/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
|
|
|
776
775
|
tests/models/faostat2018/test_coldCarcassWeightPerHead.py,sha256=RImhLygwrJ2RoEHjDwhuymvLEitOtNleP_lLoBhiNOs,1736
|
|
777
776
|
tests/models/faostat2018/test_coldDressedCarcassWeightPerHead.py,sha256=hZVKMtf-F5Iz7igZVahDJoqzfm2VtcIlwWBPCry7kqw,1594
|
|
778
777
|
tests/models/faostat2018/test_faostat_utils.py,sha256=25Y6N4kdbBXno0PwosaC94NRW3W2FIyjS4-WoIV9Xmc,1679
|
|
779
|
-
tests/models/faostat2018/test_landTransformation100YearAverageDuringCycle.py,sha256=gcJd_d1GYw7VI8oZHvgbSjUgagp4AyMiMeJBrnpLgAE,753
|
|
780
|
-
tests/models/faostat2018/test_landTransformation20YearAverageDuringCycle.py,sha256=ZRDfN2E-kJOKQkbs6se0x7T03dzmnf4TN1D5uwrLdKA,752
|
|
781
778
|
tests/models/faostat2018/test_liveweightPerHead.py,sha256=Qp4iKZ6Ofq1rGQL8ngESAx2JSPR_97TK4wOymmikdfA,4781
|
|
782
779
|
tests/models/faostat2018/test_readyToCookWeightPerHead.py,sha256=pMDcONs0WUvANcJ6_OPF7TBwMF45JGMxFRPNPtHLqVI,1570
|
|
783
780
|
tests/models/faostat2018/test_seed.py,sha256=tUXoNVveX0m0ed9UXB4zXxIZsPxktXyUXlbWuUKG0sQ,1705
|
|
@@ -845,7 +842,7 @@ tests/models/hestia/test_freshWater.py,sha256=v2UD69csKrniKP3MXkOEHxQeE6O3-lvIVi
|
|
|
845
842
|
tests/models/hestia/test_histosol.py,sha256=7g-3wQPZok2O8mExcnKZxO_T2Ye_h3UHv3HG3Kn8orM,888
|
|
846
843
|
tests/models/hestia/test_inorganicFertiliser.py,sha256=v2Zs1Ig-ChOaq9gXuurcBt12izkH2bRUUuzW6rh3rqQ,643
|
|
847
844
|
tests/models/hestia/test_irrigatedTypeUnspecified.py,sha256=bluZADFagxfXW4QyI0CIJzG97D2V33w333Z9Vwjqo0M,2015
|
|
848
|
-
tests/models/hestia/test_landCover.py,sha256=
|
|
845
|
+
tests/models/hestia/test_landCover.py,sha256=usfFMcVUvZDFpYoo53NdsinbhZjwlEnjtWNuNli03eE,9889
|
|
849
846
|
tests/models/hestia/test_landTransformation100YearAverageDuringCycle.py,sha256=3qa4rWUFqP1VM5-vm_182rhiBYJDxPqJwWtBqJ5K028,956
|
|
850
847
|
tests/models/hestia/test_landTransformation20YearAverageDuringCycle.py,sha256=bUByojQuVeuCfko1_2YtNJi1PT9yktHlcbPi_p-MPvk,1001
|
|
851
848
|
tests/models/hestia/test_liveAnimal.py,sha256=3K9cL1fwr6LlBl1_D8zIaeCOuiExqkDEU7BXx1JK_dk,2139
|
|
@@ -1251,8 +1248,8 @@ tests/orchestrator/strategies/run/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeR
|
|
|
1251
1248
|
tests/orchestrator/strategies/run/test_add_blank_node_if_missing.py,sha256=K4xg4UAXfNhSaLyknKVPO7MGBF44Z_gD7CuZ_pe28gU,3512
|
|
1252
1249
|
tests/orchestrator/strategies/run/test_add_key_if_missing.py,sha256=hKwvk1ohcBVnQUCTiDhRW99J0xEa29BpwFi1KC0yWLE,329
|
|
1253
1250
|
tests/orchestrator/strategies/run/test_always.py,sha256=w5-Dhp6yLzgZGAeMRz3OrqZbbAed9gZ1O266a3z9k7w,134
|
|
1254
|
-
hestia_earth_models-0.73.
|
|
1255
|
-
hestia_earth_models-0.73.
|
|
1256
|
-
hestia_earth_models-0.73.
|
|
1257
|
-
hestia_earth_models-0.73.
|
|
1258
|
-
hestia_earth_models-0.73.
|
|
1251
|
+
hestia_earth_models-0.73.6.dist-info/LICENSE,sha256=TD25LoiRJsA5CPUNrcyt1PXlGcbUGFMAeZoBcfCrCNE,1154
|
|
1252
|
+
hestia_earth_models-0.73.6.dist-info/METADATA,sha256=sI6oUwv9y6tLBVv_TWI8Wj7LWgBYs0ij46PzkKOYypc,4065
|
|
1253
|
+
hestia_earth_models-0.73.6.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
|
1254
|
+
hestia_earth_models-0.73.6.dist-info/top_level.txt,sha256=1dqA9TqpOLTEgpqa-YBsmbCmmNU1y56AtfFGEceZ2A0,19
|
|
1255
|
+
hestia_earth_models-0.73.6.dist-info/RECORD,,
|
|
@@ -4,12 +4,15 @@ import json
|
|
|
4
4
|
import pytest
|
|
5
5
|
from unittest.mock import patch
|
|
6
6
|
|
|
7
|
+
from hestia_earth.models.hestia.utils import (
|
|
8
|
+
FOREST_LAND, PERMANENT_PASTURE, PERMANENT_CROPLAND, ANNUAL_CROPLAND, OTHER_LAND
|
|
9
|
+
)
|
|
7
10
|
from tests.utils import fixtures_path, fake_new_management
|
|
8
11
|
from hestia_earth.models.faostat2018.utils import MODEL as FAOSTAT_MODEL
|
|
9
12
|
from hestia_earth.models.hestia.landCover import (
|
|
10
13
|
MODEL, MODEL_KEY, _get_changes, _estimate_maximum_forest_change,
|
|
11
14
|
run, site_area_sum_to_100, _get_sums_of_crop_expansion, _get_sum_for_land_category, scale_values_to_one,
|
|
12
|
-
_get_most_common_or_alphabetically_first
|
|
15
|
+
_get_most_common_or_alphabetically_first, _get_land_cover_lookup_suffix
|
|
13
16
|
)
|
|
14
17
|
|
|
15
18
|
CLASS_PATH = f"hestia_earth.models.{MODEL}.{MODEL_KEY}"
|
|
@@ -246,6 +249,20 @@ def test_scale_values_to_one(dictionary, expected_result):
|
|
|
246
249
|
assert round(v, 3) == round(expected_result[k], 3)
|
|
247
250
|
|
|
248
251
|
|
|
252
|
+
@pytest.mark.parametrize(
|
|
253
|
+
"land_type,expected",
|
|
254
|
+
[
|
|
255
|
+
(FOREST_LAND, "forest"),
|
|
256
|
+
(ANNUAL_CROPLAND, "annualCropland"),
|
|
257
|
+
(PERMANENT_CROPLAND, "permanentCropland"),
|
|
258
|
+
(PERMANENT_PASTURE, "permanentPasture"),
|
|
259
|
+
(OTHER_LAND, "otherLand"),
|
|
260
|
+
]
|
|
261
|
+
)
|
|
262
|
+
def test_get_land_cover_lookup_suffix(land_type: str, expected: str):
|
|
263
|
+
assert _get_land_cover_lookup_suffix(land_type=land_type) == expected, land_type
|
|
264
|
+
|
|
265
|
+
|
|
249
266
|
@pytest.mark.parametrize("subfolder", _folders)
|
|
250
267
|
@patch(f"{CLASS_PATH}._new_management", side_effect=fake_new_management)
|
|
251
268
|
def test_run(mock, subfolder: str):
|
|
@@ -277,12 +294,19 @@ def test_landCover_from_lookup_run(mock_mgmt, mock_region_lookup, caplog):
|
|
|
277
294
|
expected = json.load(f)
|
|
278
295
|
|
|
279
296
|
result = run(site)
|
|
297
|
+
mock_region_lookup.assert_called_with(
|
|
298
|
+
lookup_name='region-crop-cropGroupingFAOSTAT-landCover-otherLand.csv',
|
|
299
|
+
term_id='GADM-BRA',
|
|
300
|
+
column='Maize plant',
|
|
301
|
+
model='hestia',
|
|
302
|
+
key='landCover'
|
|
303
|
+
)
|
|
280
304
|
expected_message = ("site=Brazil-example, requirements=true, model=hestia, model_key=landCover, "
|
|
281
305
|
"has_management_nodes=True, land_use_type=Arable land, allowed_land_use_types=Arable land;"
|
|
282
306
|
"Permanent crops;Permanent meadows and pastures, has_no_prior_land_cover_data=True, "
|
|
283
307
|
"management_nodes=value:100_id:maizePlant_land-use-type:Arable land_endDate:2010-12-31"
|
|
284
|
-
"_startDate:2010-01-01, landCover_from_lookups=
|
|
285
|
-
"
|
|
308
|
+
"_startDate:2010-01-01, landCover_from_lookups=Forest land:0.55;Arable land:0.55;"
|
|
309
|
+
"Permanent crops:0.55;Permanent meadows and pastures:0.55;Other land:0.55, "
|
|
286
310
|
"should_run_nodes=True")
|
|
287
311
|
assert expected_message in [r.msg for r in caplog.records]
|
|
288
312
|
assert result == expected
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
from .utils import should_run_landTransformationFromCropland, run_landTransformationFromCropland
|
|
2
|
-
|
|
3
|
-
REQUIREMENTS = {
|
|
4
|
-
"ImpactAssessment": {
|
|
5
|
-
"endDate": "",
|
|
6
|
-
"country": {"@type": "Term", "termType": "region"},
|
|
7
|
-
"emissionsResourceUse": [{
|
|
8
|
-
"@type": "Indicator",
|
|
9
|
-
"term.@id": "landTransformation100YearAverageDuringCycle",
|
|
10
|
-
"value": "",
|
|
11
|
-
"previousLandCover": {
|
|
12
|
-
"@type": "Term",
|
|
13
|
-
"termType": "landCover",
|
|
14
|
-
"@id": "cropland"
|
|
15
|
-
}
|
|
16
|
-
}]
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
LOOKUPS = {
|
|
20
|
-
"region-faostatArea": ""
|
|
21
|
-
}
|
|
22
|
-
RETURNS = {
|
|
23
|
-
"Indicator": [{
|
|
24
|
-
"value": "",
|
|
25
|
-
"landCover": "",
|
|
26
|
-
"previousLandCover": ""
|
|
27
|
-
}]
|
|
28
|
-
}
|
|
29
|
-
TERM_ID = 'landTransformation100YearAverageDuringCycle'
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
def run(impact: dict):
|
|
33
|
-
should_run, indicators = should_run_landTransformationFromCropland(TERM_ID, impact)
|
|
34
|
-
return run_landTransformationFromCropland(TERM_ID, impact, indicators, 100) if should_run else []
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
from .utils import should_run_landTransformationFromCropland, run_landTransformationFromCropland
|
|
2
|
-
|
|
3
|
-
REQUIREMENTS = {
|
|
4
|
-
"ImpactAssessment": {
|
|
5
|
-
"endDate": "",
|
|
6
|
-
"country": {"@type": "Term", "termType": "region"},
|
|
7
|
-
"emissionsResourceUse": [{
|
|
8
|
-
"@type": "Indicator",
|
|
9
|
-
"term.@id": "landTransformation20YearAverageDuringCycle",
|
|
10
|
-
"value": "",
|
|
11
|
-
"previousLandCover": {
|
|
12
|
-
"@type": "Term",
|
|
13
|
-
"termType": "landCover",
|
|
14
|
-
"@id": "cropland"
|
|
15
|
-
}
|
|
16
|
-
}]
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
LOOKUPS = {
|
|
20
|
-
"region-faostatArea": ""
|
|
21
|
-
}
|
|
22
|
-
RETURNS = {
|
|
23
|
-
"Indicator": [{
|
|
24
|
-
"value": "",
|
|
25
|
-
"landCover": "",
|
|
26
|
-
"previousLandCover": ""
|
|
27
|
-
}]
|
|
28
|
-
}
|
|
29
|
-
TERM_ID = 'landTransformation20YearAverageDuringCycle'
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
def run(impact: dict):
|
|
33
|
-
should_run, indicators = should_run_landTransformationFromCropland(TERM_ID, impact)
|
|
34
|
-
return run_landTransformationFromCropland(TERM_ID, impact, indicators, 20) if should_run else []
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
from unittest.mock import patch
|
|
2
|
-
import json
|
|
3
|
-
from tests.utils import fixtures_path, fake_new_indicator
|
|
4
|
-
|
|
5
|
-
from hestia_earth.models.faostat2018 import MODEL
|
|
6
|
-
from hestia_earth.models.faostat2018.landTransformation100YearAverageDuringCycle import TERM_ID, run
|
|
7
|
-
|
|
8
|
-
class_path = f"hestia_earth.models.{MODEL}.{TERM_ID}"
|
|
9
|
-
fixtures_folder = f"{fixtures_path}/{MODEL}/{TERM_ID}"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
@patch(f"hestia_earth.models.{MODEL}.utils._new_indicator", side_effect=fake_new_indicator)
|
|
13
|
-
def test_run(*args):
|
|
14
|
-
with open(f"{fixtures_folder}/impact-assessment.jsonld", encoding='utf-8') as f:
|
|
15
|
-
cycle = json.load(f)
|
|
16
|
-
|
|
17
|
-
with open(f"{fixtures_folder}/result.jsonld", encoding='utf-8') as f:
|
|
18
|
-
expected = json.load(f)
|
|
19
|
-
|
|
20
|
-
value = run(cycle)
|
|
21
|
-
assert value == expected
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
from unittest.mock import patch
|
|
2
|
-
import json
|
|
3
|
-
from tests.utils import fixtures_path, fake_new_indicator
|
|
4
|
-
|
|
5
|
-
from hestia_earth.models.faostat2018 import MODEL
|
|
6
|
-
from hestia_earth.models.faostat2018.landTransformation20YearAverageDuringCycle import TERM_ID, run
|
|
7
|
-
|
|
8
|
-
class_path = f"hestia_earth.models.{MODEL}.{TERM_ID}"
|
|
9
|
-
fixtures_folder = f"{fixtures_path}/{MODEL}/{TERM_ID}"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
@patch(f"hestia_earth.models.{MODEL}.utils._new_indicator", side_effect=fake_new_indicator)
|
|
13
|
-
def test_run(*args):
|
|
14
|
-
with open(f"{fixtures_folder}/impact-assessment.jsonld", encoding='utf-8') as f:
|
|
15
|
-
cycle = json.load(f)
|
|
16
|
-
|
|
17
|
-
with open(f"{fixtures_folder}/result.jsonld", encoding='utf-8') as f:
|
|
18
|
-
expected = json.load(f)
|
|
19
|
-
|
|
20
|
-
value = run(cycle)
|
|
21
|
-
assert value == expected
|
|
File without changes
|
|
File without changes
|
|
File without changes
|