hestia-earth-models 0.71.0__py3-none-any.whl → 0.72.1__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.
@@ -52,12 +52,12 @@ def find_closest_impact(cycle: dict, end_date: str, term: dict, country: dict, m
52
52
  'minimum_should_match': 1
53
53
  }
54
54
  } if term else None,
55
- _match_country(country)
55
+ _match_country(country),
56
+ {'range': {'endDate': {'lte': f"{end_date}-12-31"}}}
56
57
  ]) + must_queries,
57
58
  'should': [
58
59
  # if the Cycle is organic, we can try to match organic aggregate first
59
- {'match': {'name': {'query': 'Organic' if is_organic(cycle) else 'Conventional', 'boost': 1000}}},
60
- {'match': {'endDate': {'query': end_date, 'boost': 1000}}}
60
+ {'match': {'name': {'query': 'Organic' if is_organic(cycle) else 'Conventional', 'boost': 1000}}}
61
61
  ]
62
62
  }
63
63
  }
@@ -3,9 +3,9 @@ from collections.abc import Iterable
3
3
  from functools import reduce
4
4
  from statistics import mode, mean
5
5
  from typing import Any, Optional, Union
6
- from hestia_earth.schema import MeasurementMethodClassification, SchemaType
7
- from hestia_earth.utils.model import linked_node
8
- from hestia_earth.utils.tools import non_empty_list, flatten, safe_parse_float
6
+ from hestia_earth.schema import MeasurementMethodClassification, SchemaType, TermTermType
7
+ from hestia_earth.utils.model import linked_node, filter_list_term_type
8
+ from hestia_earth.utils.tools import non_empty_list, flatten, safe_parse_float, list_sum
9
9
  from hestia_earth.utils.date import diff_in_days
10
10
 
11
11
  from . import flatten_args
@@ -295,3 +295,16 @@ def group_measurements_by_method_classification(
295
295
 
296
296
  grouped_nodes = reduce(group_node, valid_nodes, defaultdict(list))
297
297
  return dict(grouped_nodes)
298
+
299
+
300
+ def total_other_soilType_value(measurements: list, term_id: str):
301
+ sum_group = get_lookup_value({'@id': term_id, 'termType': TermTermType.SOILTYPE.value}, 'sumMax100Group')
302
+ measurements = [
303
+ m for m in filter_list_term_type(measurements, TermTermType.SOILTYPE)
304
+ if all([
305
+ get_lookup_value(m.get('term'), 'sumMax100Group') == sum_group,
306
+ m.get('depthUpper', 0) == 0,
307
+ m.get('depthLower', 0) == 30
308
+ ])
309
+ ]
310
+ return list_sum([list_sum(m.get('value') or []) for m in measurements])
@@ -1 +1 @@
1
- VERSION = '0.71.0'
1
+ VERSION = '0.72.1'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hestia-earth-models
3
- Version: 0.71.0
3
+ Version: 0.72.1
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
@@ -11,7 +11,7 @@ Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
11
11
  Classifier: Programming Language :: Python :: 3.6
12
12
  Description-Content-Type: text/markdown
13
13
  License-File: LICENSE
14
- Requires-Dist: hestia-earth-schema==32.*
14
+ Requires-Dist: hestia-earth-schema==33.*
15
15
  Requires-Dist: hestia-earth-utils>=0.14.1
16
16
  Requires-Dist: python-dateutil>=2.8.1
17
17
  Requires-Dist: CurrencyConverter==0.16.8
@@ -5,7 +5,7 @@ hestia_earth/models/cache_sites.py,sha256=VwUNMhmCXZIEnligS0jtcWDdn13GIknpzxBMWz
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=TGqNOASPKJDt3woGIzQvAtS3DrQDE911tyRyXtp5MVI,19
8
+ hestia_earth/models/version.py,sha256=b1kCt8lBUYP5qbHrVlYU-YLXGwfp6WGcgt8aSGLTxQs,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/cml2001NonBaseline/__init__.py,sha256=vI8wp8Og_e8DiJqYYvp33Y
35
35
  hestia_earth/models/cml2001NonBaseline/eutrophicationPotentialIncludingFateAverageEurope.py,sha256=lcgyRHY08KCBFPERJNqV4DYGEJCvyHBDnJXD0kEkVqM,1097
36
36
  hestia_earth/models/cml2001NonBaseline/terrestrialAcidificationPotentialExcludingFate.py,sha256=xcrxfs9UoV_EWvV-XzMt35oPWCUsTzqg2SGA3j2MFIw,1091
37
37
  hestia_earth/models/config/Cycle.json,sha256=3akuXAYWwsTc9v4g8y0yGQooDXc_D4y8J5Q7RFLTAmg,58113
38
- hestia_earth/models/config/ImpactAssessment.json,sha256=R22Pa6Szl05s13xFGKmrVZ4EgKD4UyUrruxxVujsJt4,56201
39
- hestia_earth/models/config/Site.json,sha256=vOjDsstMWe4i6PDDfpJ236Qb7gif5I0MMmscK1-LgKM,13866
38
+ hestia_earth/models/config/ImpactAssessment.json,sha256=xlxwRMZRb-znnRFeQYeMvrJfiUOh7XkxUsrv1eW57Jg,60447
39
+ hestia_earth/models/config/Site.json,sha256=dp5tQ37lU_xakeWg4UAgqQR3YoCS7BkasYo1TtNHabo,14074
40
40
  hestia_earth/models/config/__init__.py,sha256=l1WqL7ezlank86ABP4zUia_hIvM9ba-sOE3z6wNrea8,2333
41
41
  hestia_earth/models/config/run-calculations.json,sha256=e3nJ4M6CP1iFzfv8ou_ZUFbFxYkDxJgwuNDXTm4PBDc,615
42
42
  hestia_earth/models/config/trigger-calculations.json,sha256=3dmn2bRuj6QEtSTOLdIy31ho7thgUXyDsnqZzPV9rAQ,623
@@ -120,7 +120,7 @@ hestia_earth/models/emepEea2019/tspToAirAnimalHousing.py,sha256=TaT5GyYK6MyJQHKA
120
120
  hestia_earth/models/emepEea2019/utils.py,sha256=YIHxVu4GwCbxBI5FzsmJ91itWNGx0vnBTCePSwlCnz8,5629
121
121
  hestia_earth/models/emissionNotRelevant/__init__.py,sha256=yAunIZI_4nGV0khRiGhbZAmXmMiuICzEH-pvzWX1lpM,3000
122
122
  hestia_earth/models/environmentalFootprintV3_1/__init__.py,sha256=tF2WrWiV1Wzi2vnRiNXdfPWfmVxgVu9w9-7eA6PA7-s,473
123
- hestia_earth/models/environmentalFootprintV3_1/environmentalFootprintSingleOverallScore.py,sha256=tRx2rRlSDupAWTfB9MqvqwrUCWHy-r-3gHjbgVOYLTs,5239
123
+ hestia_earth/models/environmentalFootprintV3_1/environmentalFootprintSingleOverallScore.py,sha256=XjukJ0ecX62mK7Nhp3JZ7xYg9cKNAWbdhvy5M7VbXH0,5810
124
124
  hestia_earth/models/environmentalFootprintV3_1/freshwaterEcotoxicityPotentialCtue.py,sha256=N_gw2aNoCMW5Z1XM-uAyCF1kfpZUI07giv_bo3Lmr5Q,918
125
125
  hestia_earth/models/environmentalFootprintV3_1/marineEutrophicationPotential.py,sha256=UM9pezQeETfk9i0FtOBRdreaaJ9OqL6G4gYljrKOz-0,1063
126
126
  hestia_earth/models/environmentalFootprintV3_1/photochemicalOzoneCreationPotentialHumanHealthNmvocEq.py,sha256=47raZTA3aUbBpgClTzKnzUI8Vfy9qUwYNdFDUKM3hJ0,1101
@@ -155,7 +155,7 @@ hestia_earth/models/geospatialDatabase/ecoClimateZone.py,sha256=WBeaYmzer3CeviHn
155
155
  hestia_earth/models/geospatialDatabase/ecoregion.py,sha256=Hr2zJd-KGmOB5PU6nAbTtnUDWMBwhFOUf8PwT-lcPis,1206
156
156
  hestia_earth/models/geospatialDatabase/erodibility.py,sha256=M62CetEcHuExeXl7P7DVKZWWbk9tenjaDFvjMsWbga4,1843
157
157
  hestia_earth/models/geospatialDatabase/heavyWinterPrecipitation.py,sha256=54pvHOfcfEUNNhTIWIPGRzqO_t59ACh-zhnLidO2xro,1956
158
- hestia_earth/models/geospatialDatabase/histosol.py,sha256=5zwKdF1t9aOjTzBoear62T0Kzpjco-IJXu4oRYrUFQ8,2387
158
+ hestia_earth/models/geospatialDatabase/histosol.py,sha256=uVl96zpxPHYDW81SxnEpMPpNeVdfzBYRCUhVP6EFN4A,2614
159
159
  hestia_earth/models/geospatialDatabase/longFallowRatio.py,sha256=X-qJS0euYVwhGHd4rCnlRSL3KOMLQJl5kO8QqSREcpA,2561
160
160
  hestia_earth/models/geospatialDatabase/nutrientLossToAquaticEnvironment.py,sha256=uEsoYJ1mzgUo6fQhUrcJ-ATcFw1j9oEgqMXKbQuFRxQ,1973
161
161
  hestia_earth/models/geospatialDatabase/organicCarbonPerKgSoil.py,sha256=O_3GdoyY3FrwAq37MHleb0kiXZhsqpuAcik9TYpAvU4,2830
@@ -199,9 +199,10 @@ hestia_earth/models/hestia/excretaKgN.py,sha256=-GfHPx6AECNPW2i_ioCuf-DhW7Xau201
199
199
  hestia_earth/models/hestia/excretaKgVs.py,sha256=fzBV7hgznevLTcvHyHKQk9upkCgmJ0xH1NuMETeSF8A,2860
200
200
  hestia_earth/models/hestia/flowingWater.py,sha256=Iy5PCWun7GMrr0zszd0zpp9lKADpXesjC3doqLY4n28,1603
201
201
  hestia_earth/models/hestia/freshWater.py,sha256=EHUWNFmgIqr9y7DTcn1_HcpJdI7WP1cv4LMrkpaf8zQ,1262
202
+ hestia_earth/models/hestia/histosol.py,sha256=IexiWTSlSJYGjrdpYmRooW6v8LjhYATPQ8smMz1UZBA,1612
202
203
  hestia_earth/models/hestia/inorganicFertiliser.py,sha256=SQv5X4vkgmvUIUV79dJ71Y9u2EW3T5Scu2GoTr3K0Yw,8930
203
204
  hestia_earth/models/hestia/irrigatedTypeUnspecified.py,sha256=VdYzfYxcRzWv21qxRkDn9HBid7-Bt_CgIv4iyXJH03g,1929
204
- hestia_earth/models/hestia/landCover.py,sha256=Bt7zQzp8gS0oL8ljsXLYPBG5cQzxOkFaJnKwrcTDlxQ,32360
205
+ hestia_earth/models/hestia/landCover.py,sha256=WrmtrhkHhT9ZQOwVCiUtdJIc1VXB_yizig5CtfHwc0k,32840
205
206
  hestia_earth/models/hestia/landTransformation100YearAverageDuringCycle.py,sha256=7KWgpAo2gILzsxdgnO8gI3tAf3tF0IhyGkneYI6PEDc,1018
206
207
  hestia_earth/models/hestia/landTransformation20YearAverageDuringCycle.py,sha256=1StzrYhMsX-hdwBTeLnLMZWl5EEnCoEYpGPRkqy8a-A,1016
207
208
  hestia_earth/models/hestia/liveAnimal.py,sha256=95HfqgFA_qRhdIeR2X5MJ9zzIm4nMHDvJ0BCnuTYe5Q,3860
@@ -296,7 +297,7 @@ hestia_earth/models/ipcc2019/co2ToAirCarbonStockChange_utils.py,sha256=pJCdb8hys
296
297
  hestia_earth/models/ipcc2019/co2ToAirLimeHydrolysis.py,sha256=X3-M4Mn3fdGsUR7ZGjBXXWrPFBGD1ipV8_4O94lB7Z8,2487
297
298
  hestia_earth/models/ipcc2019/co2ToAirOrganicSoilCultivation.py,sha256=e-hUmPMv_UxUM5otGkwToa8GheHzNbmYOlG9A8Lbw7M,7633
298
299
  hestia_earth/models/ipcc2019/co2ToAirSoilOrganicCarbonStockChange.py,sha256=4aRBzNpDNSw20IKNzz7zOq28sorrJUB5gxmHemgOZT0,6576
299
- hestia_earth/models/ipcc2019/co2ToAirUreaHydrolysis.py,sha256=3TXZa2zuj-Df54qAPz3CUcml5T3MpAvGH8vDPIGha_c,3738
300
+ hestia_earth/models/ipcc2019/co2ToAirUreaHydrolysis.py,sha256=TH9B0VLChh5NmB2uh0PiPVM6xiqgQK1czBMbuuccoRg,3871
300
301
  hestia_earth/models/ipcc2019/croppingDuration.py,sha256=wgXzEHsl2demqzKnZK6Ak7UKUu_CVU41ZsmwxG2uiOg,3055
301
302
  hestia_earth/models/ipcc2019/ligninContent.py,sha256=Qh-UH4lv1TIf7wWlbAPwIZZHxzbbmQgND3m15pt5Si8,7285
302
303
  hestia_earth/models/ipcc2019/n2OToAirCropResidueDecompositionDirect.py,sha256=Fand7NbT27unwgFTxi_9NxT024s63vQ7U6-tk9yp3d8,3990
@@ -319,7 +320,7 @@ hestia_earth/models/ipcc2019/nonCo2EmissionsToAirNaturalVegetationBurning.py,sha
319
320
  hestia_earth/models/ipcc2019/noxToAirInorganicFertiliser.py,sha256=fmmFgjtvOD2TrrLY03jYly_KvDnCsAXqhL_tmZQQt-A,4480
320
321
  hestia_earth/models/ipcc2019/noxToAirOrganicFertiliser.py,sha256=9dx_MRTwJGxJRq6mj2EJQMdQ2w6j7lw0fQk0If_cIGc,4152
321
322
  hestia_earth/models/ipcc2019/organicCarbonPerHa.py,sha256=D8Lph5clGjXb5F7sk-jlnqE30C2lokhqndpA0hUMwTk,7791
322
- hestia_earth/models/ipcc2019/organicCarbonPerHa_tier_1.py,sha256=bG2djvq4_C1mxkuLIL2DNmNU1Fk8tTmPJfGnS85JVlQ,78565
323
+ hestia_earth/models/ipcc2019/organicCarbonPerHa_tier_1.py,sha256=7At4xCtNWpyzOg6GFIL_nMCpLi82Y6RleCZgXbIMi_k,79161
323
324
  hestia_earth/models/ipcc2019/organicCarbonPerHa_tier_2.py,sha256=5_AltohTyRMBT8dFdULOdTS79Ydpbb2CaYZGlYQEFQY,69244
324
325
  hestia_earth/models/ipcc2019/organicCarbonPerHa_utils.py,sha256=s_F3fyHhPuqragrHxluqdK0GCGnEor17jGlGKue0UsA,9867
325
326
  hestia_earth/models/ipcc2019/organicSoilCultivation_utils.py,sha256=mJCKYZxqk5vFknckjIjGw478BjZbvKC_xQ-zYpvJ8xM,5628
@@ -443,7 +444,7 @@ hestia_earth/models/linkedImpactAssessment/utils.py,sha256=S1zlux02gU2Lajrtoq-zQ
443
444
  hestia_earth/models/mocking/__init__.py,sha256=9VX50c-grz-snfd-7MBS0KfF7AadtbKuj7kK6PqtsgE,687
444
445
  hestia_earth/models/mocking/build_mock_search.py,sha256=p15ccEUmkmLp1RiGNznxMz3OFHbI8P1-29ExuohiQN8,1355
445
446
  hestia_earth/models/mocking/mock_search.py,sha256=ccFe_WrI73JElFmxp4hPNLCX7eeU--lBC1JFR901KJY,1069
446
- hestia_earth/models/mocking/search-results.json,sha256=MUUOK3z0psCeafvNnBPksx-O0NJURHzsODDZCHUg4VE,162536
447
+ hestia_earth/models/mocking/search-results.json,sha256=8wwO2BrbtYzGsQ6YGbGRe4nREqtmX5yk_sRhEGMlSxs,162530
447
448
  hestia_earth/models/pooreNemecek2018/__init__.py,sha256=nPboL7ULJzL5nJD5q7q9VOZt_fxbKVm8fmn1Az5YkVY,417
448
449
  hestia_earth/models/pooreNemecek2018/aboveGroundCropResidueTotal.py,sha256=Qt-mel4dkhK6N5uUOutNOinCTFjbjtGzITaaI0LvYc4,2396
449
450
  hestia_earth/models/pooreNemecek2018/belowGroundCropResidue.py,sha256=JT0RybbvWVlo01FO8K0Yj41HrEaJT3Kj1xfayr2X-xw,2315
@@ -585,7 +586,7 @@ hestia_earth/models/transformation/product/excreta.py,sha256=tggXIoUujzu8O949_3K
585
586
  hestia_earth/models/usetoxV2/__init__.py,sha256=pK37V3H-KvYcvRKw4Mv8CWrB2N0LFLzmv0jKLdhGGqs,409
586
587
  hestia_earth/models/usetoxV2/freshwaterEcotoxicityPotentialCtue.py,sha256=pPX8u-Aq6Pg5Y9xw0CS0S2WkAHQpOMl0lL2tLQwwOuU,918
587
588
  hestia_earth/models/utils/__init__.py,sha256=hXSBcHSMYWjg_Fe_H5IVsxu_OmVCTummZ205t_GE6pY,6847
588
- hestia_earth/models/utils/aggregated.py,sha256=gZLSY9D8MMr3VGZ2sai_5LTxdPMReuW3CXVpjPLS8xk,4807
589
+ hestia_earth/models/utils/aggregated.py,sha256=G7FNJfHqJ_eoXB66kGdjLyZGDOI_gsF56o7VnyW3bqA,4801
589
590
  hestia_earth/models/utils/animalProduct.py,sha256=M5IunAKGY6oZv3j1Ascl34ywyeLWApqOIlBzbtlA2FE,721
590
591
  hestia_earth/models/utils/aquacultureManagement.py,sha256=dxrbC1Xf140cohxTbSw6TxLAnAASWTdNZwBBam4yQnw,171
591
592
  hestia_earth/models/utils/array_builders.py,sha256=ko1pDZKaUudZqxOZ99vJamKAdoR6ND4ZmxVrYH6YjPc,19498
@@ -614,7 +615,7 @@ hestia_earth/models/utils/landCover.py,sha256=8-nfynzCx9gf9YfhpuoH6Cn4kQwWFpYA5R
614
615
  hestia_earth/models/utils/liveAnimal.py,sha256=GnajBPZw5d94raf80KtLloaOqlfqGAPwUtP9bRlGWeE,1754
615
616
  hestia_earth/models/utils/lookup.py,sha256=UCkg_MluWfgkznQBCXCZECahGmI7VNszVclLGRoXhlA,6190
616
617
  hestia_earth/models/utils/management.py,sha256=urvoHvTw5wrO12POjGQ50Or25X1Y4Gx26l4fDoVt-Ck,376
617
- hestia_earth/models/utils/measurement.py,sha256=CzSLmddbF-YMOn5mF0Y5eT1np5kUCmsSep5HYwyf44c,11093
618
+ hestia_earth/models/utils/measurement.py,sha256=EalW6D3wnD7jygV-m1miIZRkQ_S9qIqWGuXpcDrYk28,11685
618
619
  hestia_earth/models/utils/method.py,sha256=ZYN2_Fyeiwr9pmvD84ZPg7ZHBlvaIY2A6XL4F_KByS0,740
619
620
  hestia_earth/models/utils/organicFertiliser.py,sha256=2HY-a0EBzUw4DkEAXClLMXVCEZTKYf0BwFHBo7lQ5Tg,363
620
621
  hestia_earth/models/utils/pesticideAI.py,sha256=DQIAjgkWjKPyuMLUvnEgVkeQGCEOBjyJJktWU747b00,2047
@@ -754,7 +755,7 @@ tests/models/emepEea2019/test_so2ToAirFuelCombustion.py,sha256=RkC_ux5bxo6bIdcXI
754
755
  tests/models/emepEea2019/test_tspToAirAnimalHousing.py,sha256=4MNDsxIeUk5_3IvZwEZslxgoPNyQN9OQFDNY3uGNX6E,714
755
756
  tests/models/emepEea2019/test_utils.py,sha256=MUIeHgcCHLhbYWgleKIiKqO2Q4RX321J53YpOt9cogA,7060
756
757
  tests/models/environmentalFootprintV3_1/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
757
- tests/models/environmentalFootprintV3_1/test_environmentalFootprintSingleOverallScore.py,sha256=F4oz4UadhpBlyh4JvLPOWAxGSIKnJVTTDaSzOT3Ihgk,4909
758
+ tests/models/environmentalFootprintV3_1/test_environmentalFootprintSingleOverallScore.py,sha256=yJXnquW4sUfBz_1uX5Qzhyqheoqthh47uQ2tBhgyReg,5863
758
759
  tests/models/environmentalFootprintV3_1/test_freshwaterEcotoxicityPotentialCtue.py,sha256=WE-DcerljCjXMYE4f3Sv5ZCVHP0oTjbWkOGuvaa4p10,926
759
760
  tests/models/environmentalFootprintV3_1/test_marineEutrophicationPotential.py,sha256=kY_pu_7SjSZl_l41mttMn4BpKl13TTV9jQYSHFMNXhI,968
760
761
  tests/models/environmentalFootprintV3_1/test_photochemicalOzoneCreationPotentialHumanHealthNmvocEq.py,sha256=Z4KGhYmnao0J1rC_jY9P_8Lu9UKe-_RyrdO5k56EIsg,1022
@@ -789,7 +790,7 @@ tests/models/geospatialDatabase/test_ecoClimateZone.py,sha256=ad0BBOhjl6uMUP_-Qh
789
790
  tests/models/geospatialDatabase/test_ecoregion.py,sha256=xPEXQKXpF4ghpVwuyZWC-4mmN9qywF-s_QKkmU40H70,868
790
791
  tests/models/geospatialDatabase/test_erodibility.py,sha256=UW6SZS1nY3rzr2TqRcFDoq6a5KJ6ox-8L0k-im23R0s,1013
791
792
  tests/models/geospatialDatabase/test_heavyWinterPrecipitation.py,sha256=1xv7L_b3ochbcu6y6TQrTUL0ZLr6aR44kAPsEN_1kAE,1026
792
- tests/models/geospatialDatabase/test_histosol.py,sha256=Jc4N7Qt2zx09L8lj9Kjmr1q36T96MBNlasxGB0jD4EQ,1102
793
+ tests/models/geospatialDatabase/test_histosol.py,sha256=neoBruV0gRGm2PheAZiuTjIFiqzQss-FRUENjjM3zmc,1170
793
794
  tests/models/geospatialDatabase/test_longFallowRatio.py,sha256=VoYURFuOnlC8ozxcMLTzv99MGlymlVXd596T5MKVvOU,1004
794
795
  tests/models/geospatialDatabase/test_nutrientLossToAquaticEnvironment.py,sha256=ZtoNdI_dB3Nk79Ts9JJrlda7z6HRE2cwCQHC2DiWCsY,1034
795
796
  tests/models/geospatialDatabase/test_organicCarbonPerKgSoil.py,sha256=sx9raq5YGuyVjZ5GfNeo36LXNT5zfvn3W-kDWeoaJWI,1636
@@ -834,6 +835,7 @@ tests/models/hestia/test_excretaKgVs.py,sha256=3dNFATeYM5LI1y3Q3m5cbazvNp-zMKLwt
834
835
  tests/models/hestia/test_feedConversionRatio.py,sha256=LgO9Tl4yHKh0XyTe9dXqt1ccqY2UFcrJh5fIUfFMq9w,2132
835
836
  tests/models/hestia/test_flowingWater.py,sha256=0-70Iyr0HKQHHC5jFEF9LUQQZ23spOo5tFWXQ8kfR7w,1372
836
837
  tests/models/hestia/test_freshWater.py,sha256=v2UD69csKrniKP3MXkOEHxQeE6O3-lvIViCvLA7Zgws,984
838
+ tests/models/hestia/test_histosol.py,sha256=7g-3wQPZok2O8mExcnKZxO_T2Ye_h3UHv3HG3Kn8orM,888
837
839
  tests/models/hestia/test_inorganicFertiliser.py,sha256=v2Zs1Ig-ChOaq9gXuurcBt12izkH2bRUUuzW6rh3rqQ,643
838
840
  tests/models/hestia/test_irrigatedTypeUnspecified.py,sha256=bluZADFagxfXW4QyI0CIJzG97D2V33w333Z9Vwjqo0M,2015
839
841
  tests/models/hestia/test_landCover.py,sha256=XwzHCbJQt-jBpCnXcWLumTREyMNEEkUAuM2GViJl3iU,7492
@@ -924,7 +926,7 @@ tests/models/ipcc2019/test_co2ToAirCarbonStockChange_utils.py,sha256=wCEtrbMl6ze
924
926
  tests/models/ipcc2019/test_co2ToAirLimeHydrolysis.py,sha256=r7QmCH0YURS41JZxH2mFAC0J29WqmdkKG9EoEgv27AA,1350
925
927
  tests/models/ipcc2019/test_co2ToAirOrganicSoilCultivation.py,sha256=w4MBn2bYwyiv001xEU2RI9Q8L2Eu9lFC0CoxBcOzkWU,1761
926
928
  tests/models/ipcc2019/test_co2ToAirSoilOrganicCarbonStockChange.py,sha256=gPT_yyQBRoISSizW-7qE32VEeFXxsc55K3-3eZMJlOU,5688
927
- tests/models/ipcc2019/test_co2ToAirUreaHydrolysis.py,sha256=MmtEME0xjsa3KojFk_fxOLK6RZM_6p5HIpY2DOFHVu4,1530
929
+ tests/models/ipcc2019/test_co2ToAirUreaHydrolysis.py,sha256=2u4_jtekmVzLTwKpNr1fVcAzgegm17Fh9h59JRXFpOM,1030
928
930
  tests/models/ipcc2019/test_croppingDuration.py,sha256=1oRW1QaEwQvBadyVhaDi-jlkjuNqodyAinl88TdPmiY,1879
929
931
  tests/models/ipcc2019/test_ligninContent.py,sha256=eIKEN__ab-0R52EhlhPSBiHnmTl6xOf1XbI33O-W9A4,4146
930
932
  tests/models/ipcc2019/test_n2OToAirCropResidueDecompositionDirect.py,sha256=vKbWQNZAGPtsqonM-Cc3n3hNitft0hcjn2TNrTFC1iY,2729
@@ -947,7 +949,7 @@ tests/models/ipcc2019/test_nonCo2EmissionsToAirNaturalVegetationBurning.py,sha25
947
949
  tests/models/ipcc2019/test_noxToAirInorganicFertiliser.py,sha256=NZBSBJLM_j2PEpHRON2ysgKNF8x5sHfQVoAKQdGsfzk,1537
948
950
  tests/models/ipcc2019/test_noxToAirOrganicFertiliser.py,sha256=LR5pjV5vRbgSSQAw8kYRp_ij4CHInzgaDS6EggQuBiw,1104
949
951
  tests/models/ipcc2019/test_organicCarbonPerHa.py,sha256=g_uOqzj6EiyvoAZRpd4PakMYQ7Vfn0QiDGLCTVz92A8,15607
950
- tests/models/ipcc2019/test_organicCarbonPerHa_tier_1.py,sha256=7vmjes9efXPCUcRDZ6HuW8CNFGXnbpmyfXdgBPGbZEE,20621
952
+ tests/models/ipcc2019/test_organicCarbonPerHa_tier_1.py,sha256=lSGxHvfz84etnXbu6cJU0Fh06H_lI3yIlSiF3Wg9tec,20683
951
953
  tests/models/ipcc2019/test_organicCarbonPerHa_tier_2.py,sha256=OKkISE_gcF1yrEHzHowk65MbDRdgy-ILdzGWIy6X8JU,5502
952
954
  tests/models/ipcc2019/test_organicCarbonPerHa_utils.py,sha256=Zd2QlN_Q3k9djuByOH62A00tryVzlvNtsd46N79TTeU,1778
953
955
  tests/models/ipcc2019/test_pastureGrass.py,sha256=6B8ZmuI1w4rA4wGduWx0l6e0BgGz8b2knTUIcT0GDOg,2725
@@ -1241,8 +1243,8 @@ tests/orchestrator/strategies/run/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeR
1241
1243
  tests/orchestrator/strategies/run/test_add_blank_node_if_missing.py,sha256=K4xg4UAXfNhSaLyknKVPO7MGBF44Z_gD7CuZ_pe28gU,3512
1242
1244
  tests/orchestrator/strategies/run/test_add_key_if_missing.py,sha256=hKwvk1ohcBVnQUCTiDhRW99J0xEa29BpwFi1KC0yWLE,329
1243
1245
  tests/orchestrator/strategies/run/test_always.py,sha256=w5-Dhp6yLzgZGAeMRz3OrqZbbAed9gZ1O266a3z9k7w,134
1244
- hestia_earth_models-0.71.0.dist-info/LICENSE,sha256=TD25LoiRJsA5CPUNrcyt1PXlGcbUGFMAeZoBcfCrCNE,1154
1245
- hestia_earth_models-0.71.0.dist-info/METADATA,sha256=5p6Ye5i0cwJrJ1nGa6xuPTTjP4s7vnYp-wFChLqTNCw,4045
1246
- hestia_earth_models-0.71.0.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
1247
- hestia_earth_models-0.71.0.dist-info/top_level.txt,sha256=1dqA9TqpOLTEgpqa-YBsmbCmmNU1y56AtfFGEceZ2A0,19
1248
- hestia_earth_models-0.71.0.dist-info/RECORD,,
1246
+ hestia_earth_models-0.72.1.dist-info/LICENSE,sha256=TD25LoiRJsA5CPUNrcyt1PXlGcbUGFMAeZoBcfCrCNE,1154
1247
+ hestia_earth_models-0.72.1.dist-info/METADATA,sha256=eY_6ZGKA6McC3md_Lib1ee4LdMWonXsBPVgovCQG6Vk,4045
1248
+ hestia_earth_models-0.72.1.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
1249
+ hestia_earth_models-0.72.1.dist-info/top_level.txt,sha256=1dqA9TqpOLTEgpqa-YBsmbCmmNU1y56AtfFGEceZ2A0,19
1250
+ hestia_earth_models-0.72.1.dist-info/RECORD,,
@@ -1,7 +1,6 @@
1
1
  import json
2
- from unittest.mock import patch, Mock
3
-
4
2
  from pytest import mark
3
+ from unittest.mock import patch, Mock
5
4
 
6
5
  from hestia_earth.models.environmentalFootprintV3_1 import MODEL_FOLDER
7
6
  from hestia_earth.models.environmentalFootprintV3_1.environmentalFootprintSingleOverallScore import MODEL, TERM_ID, \
@@ -20,6 +19,7 @@ def fake_rounded_indicator(value: float):
20
19
 
21
20
  methodModelEFV31 = {"@type": "Term", "@id": "environmentalFootprintV3-1"}
22
21
  methodModelFantkeEtAl2016 = {"@type": "Term", "@id": "fantkeEtAl2016"}
22
+ methodModelfrischknechtEtAl2000 = {"@type": "Term", "@id": "frischknechtEtAl2000"}
23
23
 
24
24
  ozone_indicator = {"@type": "Indicator",
25
25
  "term": {"@id": "ozoneDepletionPotential", "termType": "characterisedIndicator"},
@@ -68,6 +68,22 @@ bad_indicator_no_method_model = {
68
68
  "value": 0.000420443840380047
69
69
  }
70
70
 
71
+ ionising_radiation_indicator_radon = {
72
+ "@type": "Indicator",
73
+ "term": {"@id": "ionisingRadiationKbqU235Eq", "termType": "characterisedIndicator"},
74
+ "value": 0.11156637927360424,
75
+ "inputs": [{"@id": "radon222"}],
76
+ "methodModel": methodModelfrischknechtEtAl2000
77
+ }
78
+
79
+ ionising_radiation_indicator_plutonium238 = {
80
+ "@type": "Indicator",
81
+ "term": {"@id": "ionisingRadiationKbqU235Eq", "termType": "characterisedIndicator"},
82
+ "value": 8.567909489437642e-13,
83
+ "inputs": [{"@id": "plutonium238"}],
84
+ "methodModel": methodModelfrischknechtEtAl2000
85
+ }
86
+
71
87
 
72
88
  @mark.parametrize(
73
89
  "impacts, expected, num_inputs",
@@ -84,6 +100,8 @@ bad_indicator_no_method_model = {
84
100
  ([ozone_indicator, acid_indicator], True, 2),
85
101
  ([ozone_indicator, other_valid_ozone_indicator], True, 1),
86
102
  ([bad_indicator_no_val, acid_indicator], False, 1),
103
+ ([ionising_radiation_indicator_radon, ionising_radiation_indicator_plutonium238], True, 2),
104
+ ([ionising_radiation_indicator_radon, ionising_radiation_indicator_radon], False, 2),
87
105
  ],
88
106
  ids=[
89
107
  "No indicators => no run",
@@ -98,6 +116,8 @@ bad_indicator_no_method_model = {
98
116
  "2 good indicators => run",
99
117
  "2 ozone_indicator different methodModel => run with 1",
100
118
  "one bad one good indicator => no run",
119
+ "multiple radiation indicators => run with 2",
120
+ "duplicate radiation indicators => no run",
101
121
  ]
102
122
  )
103
123
  def test_should_run(impacts, expected, num_inputs):
@@ -1,32 +1,33 @@
1
- from unittest.mock import patch
1
+ import os
2
2
  import json
3
+ import pytest
4
+ from unittest.mock import MagicMock, patch
3
5
  from tests.utils import fixtures_path, fake_new_measurement
4
6
 
5
- from hestia_earth.models.geospatialDatabase.histosol import MODEL, TERM_ID, run, _should_run
7
+ from hestia_earth.models.geospatialDatabase.histosol import MODEL, TERM_ID, run
6
8
 
7
9
  class_path = f"hestia_earth.models.{MODEL}.{TERM_ID}"
8
10
  fixtures_folder = f"{fixtures_path}/{MODEL}/{TERM_ID}"
11
+ _folders = [d for d in os.listdir(fixtures_folder) if os.path.isdir(os.path.join(fixtures_folder, d))]
9
12
 
10
13
 
11
- @patch(f"{class_path}.should_download", return_value=True)
12
- @patch(f"{class_path}.has_geospatial_data")
13
- def test_should_run(*args):
14
- # with no soilType => run
15
- site = {'measurements': []}
16
- assert _should_run(site) is True
17
-
18
- # with an existing soilType => NO run
19
- with open(f"{fixtures_folder}/with-soilType.jsonld", encoding='utf-8') as f:
20
- site = json.load(f)
21
- assert not _should_run(site)
22
-
23
-
14
+ @pytest.mark.parametrize("folder", _folders)
24
15
  @patch(f"{class_path}.get_source", return_value={})
16
+ @patch(f"{class_path}.download", return_value=50)
17
+ @patch(f"{class_path}.should_download", return_value=True)
25
18
  @patch(f"{class_path}._new_measurement", side_effect=fake_new_measurement)
26
- @patch(f"{class_path}.download", return_value=None)
27
- def test_run(mock_download, *args):
28
- with open(f"{fixtures_path}/{MODEL}/site.jsonld", encoding='utf-8') as f:
19
+ def test_run(
20
+ mock_new_measurement: MagicMock,
21
+ mock_should_download: MagicMock,
22
+ mock_download: MagicMock,
23
+ mock_get_source: MagicMock,
24
+ folder: str
25
+ ):
26
+ with open(f"{fixtures_folder}/{folder}/site.jsonld", encoding='utf-8') as f:
29
27
  site = json.load(f)
30
28
 
31
- run(site)
32
- mock_download.assert_called_once()
29
+ with open(f"{fixtures_folder}/{folder}/result.jsonld", encoding='utf-8') as f:
30
+ expected = json.load(f)
31
+
32
+ value = run(site)
33
+ assert value == expected, folder
@@ -0,0 +1,24 @@
1
+ import os
2
+ import json
3
+ import pytest
4
+ from unittest.mock import MagicMock, patch
5
+ from tests.utils import fixtures_path, fake_new_measurement
6
+
7
+ from hestia_earth.models.hestia.histosol import MODEL, TERM_ID, run
8
+
9
+ class_path = f"hestia_earth.models.{MODEL}.{TERM_ID}"
10
+ fixtures_folder = f"{fixtures_path}/{MODEL}/{TERM_ID}"
11
+ _folders = [d for d in os.listdir(fixtures_folder) if os.path.isdir(os.path.join(fixtures_folder, d))]
12
+
13
+
14
+ @pytest.mark.parametrize("folder", _folders)
15
+ @patch(f"{class_path}._new_measurement", side_effect=fake_new_measurement)
16
+ def test_run(mock_new_measurement: MagicMock, folder: str):
17
+ with open(f"{fixtures_folder}/{folder}/site.jsonld", encoding='utf-8') as f:
18
+ site = json.load(f)
19
+
20
+ with open(f"{fixtures_folder}/{folder}/result.jsonld", encoding='utf-8') as f:
21
+ expected = json.load(f)
22
+
23
+ value = run(site)
24
+ assert value == expected, folder
@@ -1,11 +1,14 @@
1
- from unittest.mock import patch
1
+ import os
2
2
  import json
3
+ import pytest
4
+ from unittest.mock import patch
3
5
  from tests.utils import fixtures_path, fake_new_emission
4
6
 
5
- from hestia_earth.models.ipcc2019.co2ToAirUreaHydrolysis import MODEL, TERM_ID, run, _should_run
7
+ from hestia_earth.models.ipcc2019.co2ToAirUreaHydrolysis import MODEL, TERM_ID, run
6
8
 
7
9
  class_path = f"hestia_earth.models.{MODEL}.{TERM_ID}"
8
10
  fixtures_folder = f"{fixtures_path}/{MODEL}/{TERM_ID}"
11
+ _folders = [d for d in os.listdir(fixtures_folder) if os.path.isdir(os.path.join(fixtures_folder, d))]
9
12
  TERMS = [
10
13
  'ureaKgN',
11
14
  'ureaAmmoniumNitrateKgN',
@@ -13,42 +16,15 @@ TERMS = [
13
16
  ]
14
17
 
15
18
 
16
- @patch(f"{class_path}.get_urea_terms", return_value=TERMS)
17
- def test_should_run(*args):
18
- # no inputs => no run
19
- cycle = {'inputs': []}
20
- should_run, *args = _should_run(cycle)
21
- assert not should_run
22
-
23
- # with urea input => run
24
- cycle['inputs'].append({
25
- 'term': {
26
- '@id': TERMS[0]
27
- },
28
- 'value': [100]
29
- })
30
- should_run, *args = _should_run(cycle)
31
- assert should_run is True
32
-
33
- # with inorganicNitrogenFertiliserUnspecifiedKgN input => run
34
- cycle['inputs'].append({
35
- 'term': {
36
- '@id': 'inorganicNitrogenFertiliserUnspecifiedKgN'
37
- },
38
- 'value': [100]
39
- })
40
- should_run, *args = _should_run(cycle)
41
- assert should_run is True
42
-
43
-
19
+ @pytest.mark.parametrize('folder', _folders)
44
20
  @patch(f"{class_path}.get_urea_terms", return_value=TERMS)
45
21
  @patch(f"{class_path}._new_emission", side_effect=fake_new_emission)
46
- def test_run(*args):
47
- with open(f"{fixtures_folder}/cycle.jsonld", encoding='utf-8') as f:
22
+ def test_run(mock_new_emission, mock_get_terms, folder):
23
+ with open(f"{fixtures_folder}/{folder}/cycle.jsonld", encoding='utf-8') as f:
48
24
  cycle = json.load(f)
49
25
 
50
- with open(f"{fixtures_folder}/result.jsonld", encoding='utf-8') as f:
26
+ with open(f"{fixtures_folder}/{folder}/result.jsonld", encoding='utf-8') as f:
51
27
  expected = json.load(f)
52
28
 
53
29
  value = run(cycle)
54
- assert value == expected
30
+ assert value == expected, folder
@@ -120,7 +120,8 @@ SOIL_CATEGORY_PARAMS = [
120
120
  ("usdaSoilType/pod", IpccSoilCategory.SPODIC_SOILS),
121
121
  ("usdaSoilType/san", IpccSoilCategory.SANDY_SOILS),
122
122
  ("usdaSoilType/vol", IpccSoilCategory.VOLCANIC_SOILS),
123
- ("usdaSoilType/wet", IpccSoilCategory.WETLAND_SOILS)
123
+ ("usdaSoilType/wet", IpccSoilCategory.WETLAND_SOILS),
124
+ ("with-depths", IpccSoilCategory.HIGH_ACTIVITY_CLAY_SOILS) # Closes #1248
124
125
  ]
125
126
 
126
127
 
@@ -202,12 +203,12 @@ MANAGEMENT_CATEGORY_PARAMS = [
202
203
  IpccLandUseCategory.GRASSLAND,
203
204
  IpccManagementCategory.NOMINALLY_MANAGED
204
205
  ),
205
- ("nominally-managed/unknown", IpccLandUseCategory.GRASSLAND, IpccManagementCategory.NOMINALLY_MANAGED),
206
206
  ("not-relevant", IpccLandUseCategory.OTHER, IpccManagementCategory.NOT_RELEVANT),
207
207
  ("reduced-tillage", IpccLandUseCategory.ANNUAL_CROPS, IpccManagementCategory.REDUCED_TILLAGE),
208
208
  ("severely-degraded", IpccLandUseCategory.GRASSLAND, IpccManagementCategory.SEVERELY_DEGRADED),
209
209
  ("unknown/annual-crops", IpccLandUseCategory.ANNUAL_CROPS, IpccManagementCategory.UNKNOWN),
210
- ("unknown/annual-crops-wet", IpccLandUseCategory.ANNUAL_CROPS_WET, IpccManagementCategory.UNKNOWN)
210
+ ("unknown/annual-crops-wet", IpccLandUseCategory.ANNUAL_CROPS_WET, IpccManagementCategory.UNKNOWN),
211
+ ("unknown/grassland", IpccLandUseCategory.GRASSLAND, IpccManagementCategory.UNKNOWN)
211
212
  ]
212
213
 
213
214