hestia-earth-models 0.64.11__py3-none-any.whl → 0.64.13__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/aware/scarcityWeightedWaterUse.py +1 -1
- hestia_earth/models/chaudharyBrooks2018/damageToTerrestrialEcosystemsLandOccupation.py +1 -1
- hestia_earth/models/chaudharyBrooks2018/damageToTerrestrialEcosystemsLandTransformation.py +1 -1
- hestia_earth/models/chaudharyBrooks2018/damageToTerrestrialEcosystemsTotalLandUseEffects.py +3 -2
- hestia_earth/models/cml2001Baseline/eutrophicationPotentialExcludingFate.py +2 -2
- hestia_earth/models/cml2001Baseline/terrestrialAcidificationPotentialIncludingFateAverageEurope.py +2 -2
- hestia_earth/models/cml2001NonBaseline/eutrophicationPotentialIncludingFateAverageEurope.py +2 -2
- hestia_earth/models/cml2001NonBaseline/terrestrialAcidificationPotentialExcludingFate.py +2 -2
- hestia_earth/models/cycle/completeness/seed.py +6 -4
- hestia_earth/models/cycle/concentrateFeed.py +36 -19
- hestia_earth/models/cycle/endDate.py +10 -1
- hestia_earth/models/cycle/milkYield.py +6 -5
- hestia_earth/models/cycle/startDate.py +6 -4
- hestia_earth/models/edip2003/ozoneDepletionPotential.py +2 -2
- hestia_earth/models/emissionNotRelevant/__init__.py +3 -2
- hestia_earth/models/environmentalFootprintV3/freshwaterEcotoxicityPotentialCtue.py +2 -3
- hestia_earth/models/faostat2018/utils.py +72 -12
- hestia_earth/models/hestia/__init__.py +13 -0
- hestia_earth/models/hestia/landCover.py +727 -0
- hestia_earth/models/ipcc2013ExcludingFeedbacks/gwp100.py +2 -2
- hestia_earth/models/ipcc2013IncludingFeedbacks/gwp100.py +2 -2
- hestia_earth/models/ipcc2019/aboveGroundBiomass.py +4 -8
- hestia_earth/models/ipcc2019/animal/fatContent.py +1 -1
- hestia_earth/models/ipcc2019/animal/milkYieldPerAnimal.py +91 -0
- hestia_earth/models/ipcc2019/animal/trueProteinContent.py +1 -1
- hestia_earth/models/ipcc2019/animal/utils.py +17 -12
- hestia_earth/models/ipcc2019/belowGroundBiomass.py +4 -8
- hestia_earth/models/ipcc2019/biomass_utils.py +11 -0
- hestia_earth/models/ipcc2019/ch4ToAirEntericFermentation.py +1 -1
- hestia_earth/models/ipcc2019/co2ToAirAboveGroundBiomassStockChange.py +8 -4
- hestia_earth/models/ipcc2019/co2ToAirBelowGroundBiomassStockChange.py +7 -3
- hestia_earth/models/ipcc2019/co2ToAirCarbonStockChange_utils.py +52 -6
- hestia_earth/models/ipcc2019/co2ToAirSoilOrganicCarbonStockChange.py +7 -3
- hestia_earth/models/ipcc2019/n2OToAirExcretaDirect.py +14 -9
- hestia_earth/models/ipcc2019/organicCarbonPerHa_tier_1_utils.py +9 -3
- hestia_earth/models/ipcc2019/organicCarbonPerHa_tier_2_utils.py +1 -2
- hestia_earth/models/koble2014/aboveGroundCropResidue.py +5 -1
- hestia_earth/models/lcImpactAllEffects100Years/damageToFreshwaterEcosystemsClimateChange.py +2 -2
- hestia_earth/models/lcImpactAllEffects100Years/damageToFreshwaterEcosystemsFreshwaterEcotoxicity.py +2 -3
- hestia_earth/models/lcImpactAllEffects100Years/damageToFreshwaterEcosystemsPdfYear.py +2 -2
- hestia_earth/models/lcImpactAllEffects100Years/damageToHumanHealth.py +2 -2
- hestia_earth/models/lcImpactAllEffects100Years/damageToHumanHealthClimateChange.py +2 -2
- hestia_earth/models/lcImpactAllEffects100Years/damageToHumanHealthHumanToxicityCancerogenic.py +2 -3
- hestia_earth/models/lcImpactAllEffects100Years/damageToHumanHealthHumanToxicityNonCancerogenic.py +2 -3
- hestia_earth/models/lcImpactAllEffects100Years/damageToHumanHealthStratosphericOzoneDepletion.py +2 -2
- hestia_earth/models/lcImpactAllEffects100Years/damageToMarineEcosystemsMarineEcotoxicity.py +2 -3
- hestia_earth/models/lcImpactAllEffects100Years/damageToMarineEcosystemsPdfYear.py +2 -2
- hestia_earth/models/lcImpactAllEffects100Years/damageToTerrestrialEcosystemsClimateChange.py +2 -2
- hestia_earth/models/lcImpactAllEffects100Years/damageToTerrestrialEcosystemsPdfYear.py +2 -2
- hestia_earth/models/lcImpactAllEffects100Years/damageToTerrestrialEcosystemsTerrestrialEcotoxicity.py +2 -3
- hestia_earth/models/lcImpactAllEffectsInfinite/damageToFreshwaterEcosystemsClimateChange.py +2 -2
- hestia_earth/models/lcImpactAllEffectsInfinite/damageToFreshwaterEcosystemsFreshwaterEcotoxicity.py +2 -3
- hestia_earth/models/lcImpactAllEffectsInfinite/damageToFreshwaterEcosystemsPdfYear.py +2 -2
- hestia_earth/models/lcImpactAllEffectsInfinite/damageToHumanHealth.py +2 -2
- hestia_earth/models/lcImpactAllEffectsInfinite/damageToHumanHealthClimateChange.py +2 -2
- hestia_earth/models/lcImpactAllEffectsInfinite/damageToHumanHealthHumanToxicityCancerogenic.py +2 -3
- hestia_earth/models/lcImpactAllEffectsInfinite/damageToHumanHealthHumanToxicityNonCancerogenic.py +2 -3
- hestia_earth/models/lcImpactAllEffectsInfinite/damageToHumanHealthStratosphericOzoneDepletion.py +2 -2
- hestia_earth/models/lcImpactAllEffectsInfinite/damageToMarineEcosystemsMarineEcotoxicity.py +2 -3
- hestia_earth/models/lcImpactAllEffectsInfinite/damageToMarineEcosystemsPdfYear.py +2 -2
- hestia_earth/models/lcImpactAllEffectsInfinite/damageToTerrestrialEcosystemsClimateChange.py +2 -2
- hestia_earth/models/lcImpactAllEffectsInfinite/damageToTerrestrialEcosystemsPdfYear.py +2 -2
- hestia_earth/models/lcImpactAllEffectsInfinite/damageToTerrestrialEcosystemsTerrestrialEcotoxicity.py +2 -3
- hestia_earth/models/lcImpactCertainEffects100Years/damageToFreshwaterEcosystemsFreshwaterEcotoxicity.py +2 -3
- hestia_earth/models/lcImpactCertainEffects100Years/damageToFreshwaterEcosystemsPdfYear.py +2 -2
- hestia_earth/models/lcImpactCertainEffects100Years/damageToHumanHealth.py +2 -2
- hestia_earth/models/lcImpactCertainEffects100Years/damageToHumanHealthClimateChange.py +2 -2
- hestia_earth/models/lcImpactCertainEffects100Years/damageToHumanHealthHumanToxicityCancerogenic.py +2 -3
- hestia_earth/models/lcImpactCertainEffects100Years/damageToHumanHealthHumanToxicityNonCancerogenic.py +2 -3
- hestia_earth/models/lcImpactCertainEffects100Years/damageToHumanHealthStratosphericOzoneDepletion.py +2 -2
- hestia_earth/models/lcImpactCertainEffects100Years/damageToMarineEcosystemsMarineEcotoxicity.py +2 -3
- hestia_earth/models/lcImpactCertainEffects100Years/damageToMarineEcosystemsPdfYear.py +2 -2
- hestia_earth/models/lcImpactCertainEffects100Years/damageToTerrestrialEcosystemsClimateChange.py +2 -2
- hestia_earth/models/lcImpactCertainEffects100Years/damageToTerrestrialEcosystemsPdfYear.py +2 -2
- hestia_earth/models/lcImpactCertainEffects100Years/damageToTerrestrialEcosystemsTerrestrialEcotoxicity.py +2 -3
- hestia_earth/models/lcImpactCertainEffectsInfinite/damageToFreshwaterEcosystemsFreshwaterEcotoxicity.py +2 -3
- hestia_earth/models/lcImpactCertainEffectsInfinite/damageToFreshwaterEcosystemsPdfYear.py +2 -2
- hestia_earth/models/lcImpactCertainEffectsInfinite/damageToHumanHealth.py +2 -2
- hestia_earth/models/lcImpactCertainEffectsInfinite/damageToHumanHealthClimateChange.py +2 -2
- hestia_earth/models/lcImpactCertainEffectsInfinite/damageToHumanHealthHumanToxicityCancerogenic.py +2 -3
- hestia_earth/models/lcImpactCertainEffectsInfinite/damageToHumanHealthHumanToxicityNonCancerogenic.py +2 -3
- hestia_earth/models/lcImpactCertainEffectsInfinite/damageToHumanHealthStratosphericOzoneDepletion.py +2 -2
- hestia_earth/models/lcImpactCertainEffectsInfinite/damageToMarineEcosystemsMarineEcotoxicity.py +2 -3
- hestia_earth/models/lcImpactCertainEffectsInfinite/damageToMarineEcosystemsPdfYear.py +2 -2
- hestia_earth/models/lcImpactCertainEffectsInfinite/damageToTerrestrialEcosystemsClimateChange.py +2 -2
- hestia_earth/models/lcImpactCertainEffectsInfinite/damageToTerrestrialEcosystemsPdfYear.py +2 -2
- hestia_earth/models/lcImpactCertainEffectsInfinite/damageToTerrestrialEcosystemsTerrestrialEcotoxicity.py +2 -3
- hestia_earth/models/linkedImpactAssessment/emissions.py +3 -0
- hestia_earth/models/log.py +4 -3
- hestia_earth/models/mocking/search-results.json +575 -575
- hestia_earth/models/pooreNemecek2018/excretaKgN.py +4 -4
- hestia_earth/models/pooreNemecek2018/excretaKgVs.py +4 -4
- hestia_earth/models/pooreNemecek2018/no3ToGroundwaterCropResidueDecomposition.py +1 -1
- hestia_earth/models/pooreNemecek2018/no3ToGroundwaterExcreta.py +1 -1
- hestia_earth/models/pooreNemecek2018/no3ToGroundwaterInorganicFertiliser.py +1 -1
- hestia_earth/models/pooreNemecek2018/no3ToGroundwaterOrganicFertiliser.py +1 -1
- hestia_earth/models/pooreNemecek2018/{saplings.py → saplingsDepreciatedAmountPerCycle.py} +1 -1
- hestia_earth/models/pooreNemecek2018/utils.py +7 -1
- hestia_earth/models/recipe2016Egalitarian/damageToFreshwaterEcosystemsSpeciesYear.py +2 -2
- hestia_earth/models/recipe2016Egalitarian/damageToHumanHealth.py +2 -2
- hestia_earth/models/recipe2016Egalitarian/damageToMarineEcosystemsSpeciesYear.py +2 -2
- hestia_earth/models/recipe2016Egalitarian/damageToTerrestrialEcosystemsSpeciesYear.py +2 -2
- hestia_earth/models/recipe2016Egalitarian/freshwaterAquaticEcotoxicityPotential14Dcbeq.py +2 -3
- hestia_earth/models/recipe2016Egalitarian/freshwaterEutrophicationPotential.py +2 -2
- hestia_earth/models/recipe2016Egalitarian/humanCarcinogenicToxicity.py +2 -3
- hestia_earth/models/recipe2016Egalitarian/humanNonCarcinogenicToxicity.py +2 -3
- hestia_earth/models/recipe2016Egalitarian/marineAquaticEcotoxicityPotential14Dcbeq.py +2 -3
- hestia_earth/models/recipe2016Egalitarian/marineEutrophicationPotential.py +2 -2
- hestia_earth/models/recipe2016Egalitarian/ozoneDepletionPotential.py +2 -2
- hestia_earth/models/recipe2016Egalitarian/terrestrialAcidificationPotential.py +2 -2
- hestia_earth/models/recipe2016Egalitarian/terrestrialEcotoxicityPotential14Dcbeq.py +2 -3
- hestia_earth/models/recipe2016Hierarchist/damageToFreshwaterEcosystemsSpeciesYear.py +2 -2
- hestia_earth/models/recipe2016Hierarchist/damageToHumanHealth.py +2 -2
- hestia_earth/models/recipe2016Hierarchist/damageToMarineEcosystemsSpeciesYear.py +2 -2
- hestia_earth/models/recipe2016Hierarchist/damageToTerrestrialEcosystemsSpeciesYear.py +2 -2
- hestia_earth/models/recipe2016Hierarchist/freshwaterAquaticEcotoxicityPotential14Dcbeq.py +2 -3
- hestia_earth/models/recipe2016Hierarchist/freshwaterEutrophicationPotential.py +2 -2
- hestia_earth/models/recipe2016Hierarchist/humanCarcinogenicToxicity.py +2 -3
- hestia_earth/models/recipe2016Hierarchist/humanNonCarcinogenicToxicity.py +2 -3
- hestia_earth/models/recipe2016Hierarchist/marineAquaticEcotoxicityPotential14Dcbeq.py +2 -3
- hestia_earth/models/recipe2016Hierarchist/marineEutrophicationPotential.py +2 -2
- hestia_earth/models/recipe2016Hierarchist/ozoneDepletionPotential.py +2 -2
- hestia_earth/models/recipe2016Hierarchist/terrestrialAcidificationPotential.py +2 -2
- hestia_earth/models/recipe2016Hierarchist/terrestrialEcotoxicityPotential14Dcbeq.py +2 -3
- hestia_earth/models/recipe2016Individualist/damageToFreshwaterEcosystemsSpeciesYear.py +2 -2
- hestia_earth/models/recipe2016Individualist/damageToHumanHealth.py +2 -2
- hestia_earth/models/recipe2016Individualist/damageToMarineEcosystemsSpeciesYear.py +2 -2
- hestia_earth/models/recipe2016Individualist/damageToTerrestrialEcosystemsSpeciesYear.py +2 -2
- hestia_earth/models/recipe2016Individualist/freshwaterAquaticEcotoxicityPotential14Dcbeq.py +2 -3
- hestia_earth/models/recipe2016Individualist/freshwaterEutrophicationPotential.py +2 -2
- hestia_earth/models/recipe2016Individualist/humanCarcinogenicToxicity.py +2 -3
- hestia_earth/models/recipe2016Individualist/humanNonCarcinogenicToxicity.py +2 -3
- hestia_earth/models/recipe2016Individualist/marineAquaticEcotoxicityPotential14Dcbeq.py +2 -3
- hestia_earth/models/recipe2016Individualist/marineEutrophicationPotential.py +2 -2
- hestia_earth/models/recipe2016Individualist/ozoneDepletionPotential.py +2 -2
- hestia_earth/models/recipe2016Individualist/terrestrialAcidificationPotential.py +2 -2
- hestia_earth/models/recipe2016Individualist/terrestrialEcotoxicityPotential14Dcbeq.py +2 -3
- hestia_earth/models/site/management.py +142 -144
- hestia_earth/models/stehfestBouwman2006/n2OToAirCropResidueDecompositionDirect.py +1 -1
- hestia_earth/models/stehfestBouwman2006/n2OToAirExcretaDirect.py +1 -1
- hestia_earth/models/stehfestBouwman2006/n2OToAirInorganicFertiliserDirect.py +1 -1
- hestia_earth/models/stehfestBouwman2006/n2OToAirOrganicFertiliserDirect.py +1 -1
- hestia_earth/models/stehfestBouwman2006/noxToAirCropResidueDecomposition.py +1 -1
- hestia_earth/models/stehfestBouwman2006/noxToAirExcreta.py +1 -1
- hestia_earth/models/stehfestBouwman2006/noxToAirInorganicFertiliser.py +1 -1
- hestia_earth/models/stehfestBouwman2006/noxToAirOrganicFertiliser.py +1 -1
- hestia_earth/models/stehfestBouwman2006GisImplementation/noxToAirCropResidueDecomposition.py +1 -1
- hestia_earth/models/stehfestBouwman2006GisImplementation/noxToAirExcreta.py +1 -1
- hestia_earth/models/stehfestBouwman2006GisImplementation/noxToAirInorganicFertiliser.py +1 -1
- hestia_earth/models/stehfestBouwman2006GisImplementation/noxToAirOrganicFertiliser.py +1 -1
- hestia_earth/models/usetoxV2/freshwaterEcotoxicityPotentialCtue.py +2 -3
- hestia_earth/models/utils/__init__.py +4 -1
- hestia_earth/models/utils/blank_node.py +34 -14
- hestia_earth/models/utils/emission.py +1 -8
- hestia_earth/models/utils/lookup.py +2 -1
- hestia_earth/models/utils/management.py +11 -0
- hestia_earth/models/utils/pesticideAI.py +11 -17
- hestia_earth/models/utils/term.py +2 -1
- hestia_earth/models/version.py +1 -1
- {hestia_earth_models-0.64.11.dist-info → hestia_earth_models-0.64.13.dist-info}/METADATA +4 -4
- {hestia_earth_models-0.64.11.dist-info → hestia_earth_models-0.64.13.dist-info}/RECORD +192 -188
- {hestia_earth_models-0.64.11.dist-info → hestia_earth_models-0.64.13.dist-info}/WHEEL +1 -1
- tests/models/cycle/completeness/test_seed.py +1 -1
- tests/models/cycle/test_endDate.py +18 -2
- tests/models/cycle/test_startDate.py +21 -3
- tests/models/faostat2018/test_faostat_utils.py +84 -0
- tests/models/hestia/__init__.py +0 -0
- tests/models/hestia/test_landCover.py +210 -0
- tests/models/ipcc2019/animal/test_milkYieldPerAnimal.py +21 -0
- tests/models/ipcc2019/test_aboveGroundBiomass.py +2 -1
- tests/models/ipcc2019/test_belowGroundBiomass.py +2 -1
- tests/models/ipcc2019/test_co2ToAirAboveGroundBiomassStockChange.py +4 -3
- tests/models/ipcc2019/test_co2ToAirBelowGroundBiomassStockChange.py +3 -3
- tests/models/ipcc2019/test_co2ToAirSoilOrganicCarbonStockChange.py +49 -2
- tests/models/ipcc2019/test_n2OToAirExcretaDirect.py +12 -0
- tests/models/ipcc2019/test_organicCarbonPerHa.py +1 -0
- tests/models/koble2014/test_aboveGroundCropResidue.py +13 -0
- tests/models/pooreNemecek2018/test_no3ToGroundwaterCropResidueDecomposition.py +3 -2
- tests/models/pooreNemecek2018/test_no3ToGroundwaterExcreta.py +3 -2
- tests/models/pooreNemecek2018/test_no3ToGroundwaterInorganicFertiliser.py +3 -2
- tests/models/pooreNemecek2018/test_no3ToGroundwaterOrganicFertiliser.py +3 -2
- tests/models/pooreNemecek2018/{test_saplings.py → test_saplingsDepreciatedAmountPerCycle.py} +1 -1
- tests/models/site/test_management.py +18 -151
- tests/models/utils/test_blank_node.py +57 -1
- tests/models/utils/test_emission.py +1 -6
- tests/models/utils/test_site.py +33 -2
- tests/models/pooreNemecek2018/test_no3ToGroundwaterSoilFlux.py +0 -90
- tests/models/stehfestBouwman2006/test_n2OToAirSoilFlux.py +0 -41
- tests/models/stehfestBouwman2006/test_noxToAirSoilFlux.py +0 -40
- tests/models/stehfestBouwman2006GisImplementation/test_noxToAirSoilFlux.py +0 -33
- /hestia_earth/models/pooreNemecek2018/{no3ToGroundwaterSoilFlux.py → no3ToGroundwaterSoilFlux_utils.py} +0 -0
- /hestia_earth/models/stehfestBouwman2006/{n2OToAirSoilFlux.py → n2OToAirSoilFlux_utils.py} +0 -0
- /hestia_earth/models/stehfestBouwman2006/{noxToAirSoilFlux.py → noxToAirSoilFlux_utils.py} +0 -0
- /hestia_earth/models/stehfestBouwman2006GisImplementation/{noxToAirSoilFlux.py → noxToAirSoilFlux_utils.py} +0 -0
- {hestia_earth_models-0.64.11.dist-info → hestia_earth_models-0.64.13.dist-info}/LICENSE +0 -0
- {hestia_earth_models-0.64.11.dist-info → hestia_earth_models-0.64.13.dist-info}/top_level.txt +0 -0
|
@@ -59,8 +59,9 @@ def run(impact_assessment: dict):
|
|
|
59
59
|
inputs_value = convert_value_from_cycle(
|
|
60
60
|
product, sum_input_impacts(cycle.get('inputs', []), TERM_ID), model=MODEL, term_id=TERM_ID
|
|
61
61
|
)
|
|
62
|
+
value = sum_values([landUseEffects, inputs_value])
|
|
62
63
|
logRequirements(impact_assessment, model=MODEL, term=TERM_ID,
|
|
63
64
|
landUseEffects=landUseEffects,
|
|
64
65
|
inputs_value=inputs_value)
|
|
65
|
-
logShouldRun(impact_assessment, MODEL, TERM_ID,
|
|
66
|
-
return _indicator(
|
|
66
|
+
logShouldRun(impact_assessment, MODEL, TERM_ID, value is not None)
|
|
67
|
+
return _indicator(value) if value is not None else None
|
|
@@ -29,5 +29,5 @@ def run(impact_assessment: dict):
|
|
|
29
29
|
value = impact_emission_lookup_value(MODEL, TERM_ID, impact_assessment, LOOKUPS['emission'])
|
|
30
30
|
logRequirements(impact_assessment, model=MODEL, term=TERM_ID,
|
|
31
31
|
value=value)
|
|
32
|
-
logShouldRun(impact_assessment, MODEL, TERM_ID,
|
|
33
|
-
return _indicator(value)
|
|
32
|
+
logShouldRun(impact_assessment, MODEL, TERM_ID, value is not None)
|
|
33
|
+
return _indicator(value) if value is not None else None
|
hestia_earth/models/cml2001Baseline/terrestrialAcidificationPotentialIncludingFateAverageEurope.py
CHANGED
|
@@ -29,5 +29,5 @@ def run(impact_assessment: dict):
|
|
|
29
29
|
value = impact_emission_lookup_value(MODEL, TERM_ID, impact_assessment, LOOKUPS['emission'])
|
|
30
30
|
logRequirements(impact_assessment, model=MODEL, term=TERM_ID,
|
|
31
31
|
value=value)
|
|
32
|
-
logShouldRun(impact_assessment, MODEL, TERM_ID,
|
|
33
|
-
return _indicator(value)
|
|
32
|
+
logShouldRun(impact_assessment, MODEL, TERM_ID, value is not None)
|
|
33
|
+
return _indicator(value) if value is not None else None
|
|
@@ -29,5 +29,5 @@ def run(impact_assessment: dict):
|
|
|
29
29
|
value = impact_emission_lookup_value(MODEL, TERM_ID, impact_assessment, LOOKUPS['emission'])
|
|
30
30
|
logRequirements(impact_assessment, model=MODEL, term=TERM_ID,
|
|
31
31
|
value=value)
|
|
32
|
-
logShouldRun(impact_assessment, MODEL, TERM_ID,
|
|
33
|
-
return _indicator(value)
|
|
32
|
+
logShouldRun(impact_assessment, MODEL, TERM_ID, value is not None)
|
|
33
|
+
return _indicator(value) if value is not None else None
|
|
@@ -29,5 +29,5 @@ def run(impact_assessment: dict):
|
|
|
29
29
|
value = impact_emission_lookup_value(MODEL, TERM_ID, impact_assessment, LOOKUPS['emission'])
|
|
30
30
|
logRequirements(impact_assessment, model=MODEL, term=TERM_ID,
|
|
31
31
|
value=value)
|
|
32
|
-
logShouldRun(impact_assessment, MODEL, TERM_ID,
|
|
33
|
-
return _indicator(value)
|
|
32
|
+
logShouldRun(impact_assessment, MODEL, TERM_ID, value is not None)
|
|
33
|
+
return _indicator(value) if value is not None else None
|
|
@@ -15,7 +15,7 @@ REQUIREMENTS = {
|
|
|
15
15
|
"Cycle": {
|
|
16
16
|
"completeness.seed": "False",
|
|
17
17
|
"inputs": [
|
|
18
|
-
{"@type": "Input", "value": "", "term.@id": ["seed", "
|
|
18
|
+
{"@type": "Input", "value": "", "term.@id": ["seed", "saplingsDepreciatedAmountPerCycle"]}
|
|
19
19
|
],
|
|
20
20
|
"site": {
|
|
21
21
|
"@type": "Site",
|
|
@@ -46,11 +46,13 @@ def run(cycle: dict):
|
|
|
46
46
|
|
|
47
47
|
product = find_primary_product(cycle) or {}
|
|
48
48
|
term_id = product.get('term', {}).get('@id')
|
|
49
|
-
|
|
49
|
+
has_saplingsDepreciatedAmountPerCycle = find_term_match(cycle.get('inputs', []),
|
|
50
|
+
'saplingsDepreciatedAmountPerCycle',
|
|
51
|
+
None) and is_plantation(MODEL, None, term_id)
|
|
50
52
|
|
|
51
53
|
logRequirements(cycle, model=MODEL, term=None, key=MODEL_KEY,
|
|
52
54
|
site_type_allowed=site_type_allowed,
|
|
53
55
|
has_seed=has_seed,
|
|
54
|
-
|
|
56
|
+
has_saplingsDepreciatedAmountPerCycle=has_saplingsDepreciatedAmountPerCycle)
|
|
55
57
|
|
|
56
|
-
return all([site_type_allowed, has_seed or
|
|
58
|
+
return all([site_type_allowed, has_seed or has_saplingsDepreciatedAmountPerCycle])
|
|
@@ -8,7 +8,7 @@ from hestia_earth.schema import TermTermType
|
|
|
8
8
|
from hestia_earth.utils.model import find_primary_product
|
|
9
9
|
from hestia_earth.utils.tools import list_sum, non_empty_list, flatten
|
|
10
10
|
|
|
11
|
-
from hestia_earth.models.log import logRequirements, logShouldRun
|
|
11
|
+
from hestia_earth.models.log import logRequirements, logShouldRun, log_as_table
|
|
12
12
|
from hestia_earth.models.utils.blank_node import merge_blank_nodes
|
|
13
13
|
from hestia_earth.models.utils.property import _new_property, get_node_property_value, get_property_lookup_value
|
|
14
14
|
from hestia_earth.models.utils.term import get_digestible_energy_terms, get_energy_digestibility_terms
|
|
@@ -42,7 +42,6 @@ LOOKUPS = {
|
|
|
42
42
|
"property": "commonToSupplementInAnimalFeed"
|
|
43
43
|
}
|
|
44
44
|
TERM_ID = 'concentrateFeedBlend,concentrateFeedUnspecified,feedMix'
|
|
45
|
-
FIRST_TERM_ID = TERM_ID.split(',')[0]
|
|
46
45
|
INPUT_TERM_TYPES = [
|
|
47
46
|
TermTermType.CROP.value,
|
|
48
47
|
TermTermType.FORAGE.value,
|
|
@@ -70,40 +69,58 @@ def _weighted_value(values: list):
|
|
|
70
69
|
|
|
71
70
|
|
|
72
71
|
def _calculate_value(cycle: dict, product: dict, inputs: list, property_id: str, values: list):
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
valid_values = [
|
|
73
|
+
(value.get('property-value'), value.get('input-value'))
|
|
74
|
+
for value in values
|
|
75
|
+
if all([value.get('property-value') is not None, value.get('input-value') is not None])
|
|
76
|
+
]
|
|
77
|
+
ratio_inputs_with_props = len(valid_values) / len(inputs) if len(inputs) and len(valid_values) else 0
|
|
75
78
|
min_ratio = _min_ratio(property_id)
|
|
76
79
|
|
|
77
80
|
term_id = product.get('term', {}).get('@id')
|
|
78
81
|
logRequirements(cycle, model=MODEL, term=term_id, property=property_id,
|
|
79
82
|
nb_inputs=len(inputs),
|
|
80
|
-
nb_inputs_with_prop=len(
|
|
83
|
+
nb_inputs_with_prop=len(valid_values),
|
|
81
84
|
ratio_inputs_with_props=ratio_inputs_with_props,
|
|
82
|
-
min_ratio=min_ratio
|
|
85
|
+
min_ratio=min_ratio,
|
|
86
|
+
details=log_as_table(values))
|
|
83
87
|
|
|
84
88
|
should_run = all([ratio_inputs_with_props >= min_ratio])
|
|
85
89
|
logShouldRun(cycle, MODEL, term_id, should_run, property=property_id)
|
|
86
90
|
|
|
87
|
-
return [(property_id, _weighted_value(
|
|
91
|
+
return [(property_id, _weighted_value(valid_values))] if should_run else []
|
|
88
92
|
|
|
89
93
|
|
|
90
94
|
def _calculate_default_value(cycle: dict, product: dict, inputs: list, property_id: str):
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
list_sum(i.get('value', []))
|
|
95
|
-
|
|
95
|
+
term_id = product.get('term', {}).get('@id')
|
|
96
|
+
values = [{
|
|
97
|
+
'input-id': i.get('term', {}).get('@id'),
|
|
98
|
+
'input-value': list_sum(i.get('value', [])),
|
|
99
|
+
'property-id': property_id,
|
|
100
|
+
'property-value': get_node_property_value(
|
|
101
|
+
MODEL, i, property_id, handle_percents=False, term=term_id, property=property_id
|
|
102
|
+
),
|
|
103
|
+
} for i in inputs]
|
|
96
104
|
return _calculate_value(cycle, product, inputs, property_id, values)
|
|
97
105
|
|
|
98
106
|
|
|
99
107
|
def _calculate_N_value(cycle: dict, product: dict, inputs: list, property_id: str):
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
get_node_property_value(
|
|
104
|
-
MODEL,
|
|
105
|
-
|
|
106
|
-
|
|
108
|
+
term_id = product.get('term', {}).get('@id')
|
|
109
|
+
|
|
110
|
+
def fallback_value(input: dict):
|
|
111
|
+
value = get_node_property_value(
|
|
112
|
+
MODEL, input, 'crudeProteinContent', handle_percents=False, term=term_id, property=property_id
|
|
113
|
+
)
|
|
114
|
+
return value * 0.16 if value is not None else None
|
|
115
|
+
|
|
116
|
+
values = [{
|
|
117
|
+
'input-id': i.get('term', {}).get('@id'),
|
|
118
|
+
'input-value': list_sum(i.get('value', [])),
|
|
119
|
+
'property-id': property_id,
|
|
120
|
+
'property-value': get_node_property_value(
|
|
121
|
+
MODEL, i, property_id, handle_percents=False, term=term_id, property=property_id
|
|
122
|
+
) or fallback_value(input=i)
|
|
123
|
+
} for i in inputs]
|
|
107
124
|
return _calculate_value(cycle, product, inputs, property_id, values)
|
|
108
125
|
|
|
109
126
|
|
|
@@ -8,6 +8,7 @@ assumed it ended on the 14th of the month.
|
|
|
8
8
|
from hestia_earth.utils.date import is_in_months
|
|
9
9
|
|
|
10
10
|
from hestia_earth.models.log import logRequirements, logShouldRun
|
|
11
|
+
from hestia_earth.models.utils import last_day_of_month
|
|
11
12
|
from . import MODEL
|
|
12
13
|
|
|
13
14
|
REQUIREMENTS = {
|
|
@@ -24,9 +25,17 @@ RETURNS = {
|
|
|
24
25
|
MODEL_KEY = 'endDate'
|
|
25
26
|
|
|
26
27
|
|
|
28
|
+
def _end_of_month(date: str):
|
|
29
|
+
year = int(date[0:4])
|
|
30
|
+
month = int(date[5:7])
|
|
31
|
+
return last_day_of_month(year, month).strftime('%Y-%m-%d')
|
|
32
|
+
|
|
33
|
+
|
|
27
34
|
def _run(cycle: dict):
|
|
28
35
|
endDate = cycle.get('endDate')
|
|
29
|
-
|
|
36
|
+
is_same_month = endDate[0:7] == cycle.get('startDate', '')[0:7]
|
|
37
|
+
# end of the month if same month as startDate
|
|
38
|
+
return _end_of_month(endDate) if is_same_month else f"{endDate}-14"
|
|
30
39
|
|
|
31
40
|
|
|
32
41
|
def _should_run(cycle: dict):
|
|
@@ -87,15 +87,16 @@ def _run(cycle: dict, product: dict):
|
|
|
87
87
|
|
|
88
88
|
live_animal_term_id = get_liveAnimal_term_id(product, model_key=MODEL_KEY)
|
|
89
89
|
live_animal_node = find_term_match(cycle.get('animals', []), live_animal_term_id)
|
|
90
|
+
animal_value = live_animal_node.get('value', 0)
|
|
90
91
|
|
|
91
|
-
value = list_sum(product.get('value')) / cycleDuration /
|
|
92
|
-
sd = list_sum(product.get('sd')) / cycleDuration /
|
|
92
|
+
value = list_sum(product.get('value')) / cycleDuration / animal_value
|
|
93
|
+
sd = list_sum(product.get('sd')) / cycleDuration / animal_value if all([
|
|
93
94
|
list_sum(product.get('sd', [])) > 0
|
|
94
95
|
]) else None
|
|
95
|
-
min = list_sum(product.get('min')) / cycleDuration /
|
|
96
|
+
min = list_sum(product.get('min')) / cycleDuration / animal_value if all([
|
|
96
97
|
list_sum(product.get('min', [])) > 0
|
|
97
98
|
]) else None
|
|
98
|
-
max = list_sum(product.get('max')) / cycleDuration /
|
|
99
|
+
max = list_sum(product.get('max')) / cycleDuration / animal_value if all([
|
|
99
100
|
list_sum(product.get('max', [])) > 0
|
|
100
101
|
]) else None
|
|
101
102
|
|
|
@@ -136,7 +137,7 @@ def _should_run_product(cycle: dict, product: dict):
|
|
|
136
137
|
missing_milkYield_practice=missing_milkYield_practice)
|
|
137
138
|
|
|
138
139
|
should_run = all([
|
|
139
|
-
has_product_value, has_live_animal_node_value, practice_id, missing_milkYield_practice
|
|
140
|
+
cycleDuration, has_product_value, has_live_animal_node_value, practice_id, missing_milkYield_practice
|
|
140
141
|
])
|
|
141
142
|
logShouldRun(cycle, MODEL, term_id, should_run, model_key=MODEL_KEY)
|
|
142
143
|
return should_run
|
|
@@ -36,22 +36,24 @@ def _run_by_cycleDuration(cycle: dict):
|
|
|
36
36
|
|
|
37
37
|
def _should_run_by_cycleDuration(cycle: dict):
|
|
38
38
|
has_endDate = cycle.get('endDate') is not None
|
|
39
|
-
|
|
39
|
+
has_endDate_day_precision = has_endDate and is_in_days(cycle.get('endDate'))
|
|
40
40
|
has_cycleDuration = cycle.get('cycleDuration') is not None
|
|
41
41
|
|
|
42
42
|
logRequirements(cycle, model=MODEL, key=MODEL_KEY, by='cycleDuration',
|
|
43
43
|
has_endDate=has_endDate,
|
|
44
|
-
|
|
44
|
+
has_endDate_day_precision=has_endDate_day_precision,
|
|
45
45
|
has_cycleDuration=has_cycleDuration)
|
|
46
46
|
|
|
47
|
-
should_run = all([has_endDate,
|
|
47
|
+
should_run = all([has_endDate, has_endDate_day_precision, has_cycleDuration])
|
|
48
48
|
logShouldRun(cycle, MODEL, None, should_run, key=MODEL_KEY, by='cycleDuration')
|
|
49
49
|
return should_run
|
|
50
50
|
|
|
51
51
|
|
|
52
52
|
def _run_by_startDate(cycle: dict):
|
|
53
53
|
startDate = cycle.get('startDate')
|
|
54
|
-
|
|
54
|
+
is_same_month = startDate[0:7] == cycle.get('endDate', '')[0:7]
|
|
55
|
+
# start of the month if same month as end date
|
|
56
|
+
return f"{startDate}-01" if is_same_month else f"{startDate}-15"
|
|
55
57
|
|
|
56
58
|
|
|
57
59
|
def _should_run_by_startDate(cycle: dict):
|
|
@@ -30,5 +30,5 @@ def run(impact_assessment: dict):
|
|
|
30
30
|
value = impact_emission_lookup_value(MODEL, TERM_ID, impact_assessment, LOOKUPS['emission'])
|
|
31
31
|
logRequirements(impact_assessment, model=MODEL, term=TERM_ID,
|
|
32
32
|
value=value)
|
|
33
|
-
logShouldRun(impact_assessment, MODEL, TERM_ID,
|
|
34
|
-
return _indicator(value)
|
|
33
|
+
logShouldRun(impact_assessment, MODEL, TERM_ID, value is not None)
|
|
34
|
+
return _indicator(value) if value is not None else None
|
|
@@ -4,9 +4,10 @@ Emission not relevant
|
|
|
4
4
|
The emission is not relevant for this Site, Cycle, or Product.
|
|
5
5
|
"""
|
|
6
6
|
from hestia_earth.schema import NodeType, TermTermType, EmissionMethodTier
|
|
7
|
+
from hestia_earth.utils.emission import emission_is_in_system_boundary
|
|
7
8
|
|
|
8
9
|
from hestia_earth.models.log import logRequirements, logShouldRun
|
|
9
|
-
from hestia_earth.models.utils.emission import _new_emission
|
|
10
|
+
from hestia_earth.models.utils.emission import _new_emission
|
|
10
11
|
from hestia_earth.models.utils.blank_node import _run_required
|
|
11
12
|
from hestia_earth.models.utils.term import get_all_emission_terms
|
|
12
13
|
|
|
@@ -38,7 +39,7 @@ def _emission(term_id: str):
|
|
|
38
39
|
def _should_run_emission(cycle: dict):
|
|
39
40
|
def run(term_id: str):
|
|
40
41
|
is_not_relevant = not _run_required(MODEL, {'@id': term_id, 'termType': TermTermType.EMISSION.value}, cycle)
|
|
41
|
-
in_system_boundary =
|
|
42
|
+
in_system_boundary = emission_is_in_system_boundary(term_id)
|
|
42
43
|
|
|
43
44
|
should_run = all([is_not_relevant, in_system_boundary])
|
|
44
45
|
if should_run:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from hestia_earth.models.utils.indicator import _new_indicator
|
|
2
|
-
from hestia_earth.models.utils.pesticideAI import impact_lookup_value
|
|
2
|
+
from hestia_earth.models.utils.pesticideAI import impact_lookup_value
|
|
3
3
|
from . import MODEL
|
|
4
4
|
|
|
5
5
|
REQUIREMENTS = {
|
|
@@ -30,5 +30,4 @@ def _indicator(value: float):
|
|
|
30
30
|
|
|
31
31
|
def run(impact_assessment: dict):
|
|
32
32
|
value = impact_lookup_value(MODEL, TERM_ID, impact_assessment, LOOKUPS['pesticideAI'])
|
|
33
|
-
|
|
34
|
-
return _indicator(value) if should_run else None
|
|
33
|
+
return _indicator(value) if value is not None else None
|
|
@@ -2,6 +2,7 @@ from hestia_earth.schema import TermTermType
|
|
|
2
2
|
from hestia_earth.utils.api import download_hestia
|
|
3
3
|
from hestia_earth.utils.lookup import download_lookup, get_table_value, column_name, extract_grouped_data_closest_date
|
|
4
4
|
from hestia_earth.utils.tools import safe_parse_float
|
|
5
|
+
from numpy import recarray
|
|
5
6
|
|
|
6
7
|
from hestia_earth.models.log import logger, debugMissingLookup
|
|
7
8
|
from hestia_earth.models.utils.animalProduct import (
|
|
@@ -53,7 +54,7 @@ def product_equivalent_value(product: dict, year: int, country: str):
|
|
|
53
54
|
return conv_value
|
|
54
55
|
|
|
55
56
|
|
|
56
|
-
def
|
|
57
|
+
def _split_delta(table_value: str, start_year: int, end_year: int):
|
|
57
58
|
start_value = extract_grouped_data_closest_date(table_value, start_year)
|
|
58
59
|
end_value = extract_grouped_data_closest_date(table_value, end_year)
|
|
59
60
|
return safe_parse_float(end_value) - safe_parse_float(start_value) if all([
|
|
@@ -61,22 +62,81 @@ def _cropland_split_delta(table_value: str, start_year: int, end_year: int):
|
|
|
61
62
|
]) else None
|
|
62
63
|
|
|
63
64
|
|
|
64
|
-
def
|
|
65
|
+
def get_sum_of_columns(lookup: recarray, country: str, year: int, columns_list: list) -> float:
|
|
66
|
+
return sum(
|
|
67
|
+
[safe_parse_float(
|
|
68
|
+
extract_grouped_data_closest_date(
|
|
69
|
+
data=get_table_value(lookup, 'termid', country, column_name(col)),
|
|
70
|
+
year=year
|
|
71
|
+
)
|
|
72
|
+
) for col in columns_list]
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def get_single_delta(country: str, start_year: int, end_year: int, column: str):
|
|
65
77
|
lookup = download_lookup('region-faostatArea.csv')
|
|
66
|
-
|
|
67
|
-
get_table_value(lookup, 'termid', country, column_name(
|
|
78
|
+
return _split_delta(
|
|
79
|
+
get_table_value(lookup, 'termid', country, column_name(column)), start_year, end_year
|
|
68
80
|
)
|
|
69
81
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
82
|
+
|
|
83
|
+
def get_land_ratio(
|
|
84
|
+
country: str, start_year: int, end_year: int, first_column: str, second_column: str, total_column: str = None
|
|
85
|
+
):
|
|
86
|
+
"""
|
|
87
|
+
total_column is optional. Assumes that, if missing, total is the sum of values from first and second.
|
|
88
|
+
"""
|
|
89
|
+
lookup = download_lookup('region-faostatArea.csv')
|
|
90
|
+
first_delta = _split_delta(
|
|
91
|
+
get_table_value(lookup, 'termid', country, column_name(first_column)), start_year, end_year
|
|
92
|
+
)
|
|
93
|
+
second_delta = _split_delta(
|
|
94
|
+
get_table_value(lookup, 'termid', country, column_name(second_column)), start_year, end_year
|
|
73
95
|
)
|
|
74
|
-
|
|
75
|
-
|
|
96
|
+
total_delta = (
|
|
97
|
+
get_sum_of_columns(
|
|
98
|
+
lookup=lookup,
|
|
99
|
+
country=country,
|
|
100
|
+
year=end_year,
|
|
101
|
+
columns_list=[first_column, second_column]
|
|
102
|
+
) - get_sum_of_columns(
|
|
103
|
+
lookup=lookup,
|
|
104
|
+
country=country,
|
|
105
|
+
year=start_year,
|
|
106
|
+
columns_list=[first_column, second_column]
|
|
107
|
+
)
|
|
108
|
+
) if total_column is None else _split_delta(
|
|
109
|
+
get_table_value(lookup, 'termid', country, column_name(total_column)), start_year, end_year
|
|
76
110
|
)
|
|
77
111
|
|
|
78
112
|
return (None, None, None) if any([
|
|
79
113
|
total_delta is None,
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
]) else (total_delta,
|
|
114
|
+
first_delta is None,
|
|
115
|
+
second_delta is None
|
|
116
|
+
]) else (total_delta, first_delta, second_delta)
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
def get_cropland_ratio(country: str, start_year: int, end_year: int):
|
|
120
|
+
return get_land_ratio(
|
|
121
|
+
country=country,
|
|
122
|
+
start_year=start_year,
|
|
123
|
+
end_year=end_year,
|
|
124
|
+
first_column='Permanent crops',
|
|
125
|
+
second_column='Arable land',
|
|
126
|
+
total_column='Cropland'
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
def get_change_in_harvested_area_for_crop(country_id: str, crop_name: str, start_year: int, end_year: int = 0):
|
|
131
|
+
lookup = download_lookup('region-crop-cropGroupingFaostatProduction-areaHarvested.csv')
|
|
132
|
+
if end_year == 0 or end_year == start_year:
|
|
133
|
+
return safe_parse_float(
|
|
134
|
+
extract_grouped_data_closest_date(
|
|
135
|
+
data=get_table_value(lookup, 'termid', country_id, column_name(crop_name)),
|
|
136
|
+
year=start_year
|
|
137
|
+
)
|
|
138
|
+
)
|
|
139
|
+
else:
|
|
140
|
+
return _split_delta(
|
|
141
|
+
get_table_value(lookup, 'termid', country_id, column_name(crop_name)), start_year, end_year
|
|
142
|
+
)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from os.path import dirname, abspath
|
|
2
|
+
import sys
|
|
3
|
+
from importlib import import_module
|
|
4
|
+
|
|
5
|
+
from hestia_earth.models.utils.blank_node import run_if_required
|
|
6
|
+
|
|
7
|
+
CURRENT_DIR = dirname(abspath(__file__)) + '/'
|
|
8
|
+
sys.path.append(CURRENT_DIR)
|
|
9
|
+
MODEL = 'hestia'
|
|
10
|
+
PKG = '.'.join(['hestia_earth', 'models', MODEL])
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def run(model: str, data): return run_if_required(MODEL, model, data, import_module(f".{model}", package=PKG))
|