hestia-earth-models 0.64.9__py3-none-any.whl → 0.64.11__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/cml2001Baseline/abioticResourceDepletionFossilFuels.py +175 -0
- hestia_earth/models/cml2001Baseline/abioticResourceDepletionMineralsAndMetals.py +136 -0
- 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/cropResidue.py +15 -10
- hestia_earth/models/cycle/completeness/freshForage.py +60 -0
- hestia_earth/models/edip2003/ozoneDepletionPotential.py +2 -2
- hestia_earth/models/environmentalFootprintV3/soilQualityIndexLandTransformation.py +2 -2
- hestia_earth/models/fantkeEtAl2016/damageToHumanHealthParticulateMatterFormation.py +7 -17
- hestia_earth/models/ipcc2013ExcludingFeedbacks/gwp100.py +2 -2
- hestia_earth/models/ipcc2013IncludingFeedbacks/gwp100.py +2 -2
- hestia_earth/models/ipcc2019/aboveGroundBiomass.py +31 -243
- hestia_earth/models/ipcc2019/belowGroundBiomass.py +529 -0
- hestia_earth/models/ipcc2019/biomass_utils.py +406 -0
- hestia_earth/models/ipcc2019/{co2ToAirAboveGroundBiomassStockChangeLandUseChange.py → co2ToAirAboveGroundBiomassStockChange.py} +19 -7
- hestia_earth/models/ipcc2019/{co2ToAirBelowGroundBiomassStockChangeLandUseChange.py → co2ToAirBelowGroundBiomassStockChange.py} +19 -7
- hestia_earth/models/ipcc2019/co2ToAirCarbonStockChange_utils.py +402 -73
- hestia_earth/models/ipcc2019/{co2ToAirSoilOrganicCarbonStockChangeManagementChange.py → co2ToAirSoilOrganicCarbonStockChange.py} +20 -8
- hestia_earth/models/ipcc2019/organicCarbonPerHa.py +3 -1
- hestia_earth/models/ipcc2019/pastureGrass_utils.py +6 -7
- hestia_earth/models/ipcc2021/gwp100.py +2 -2
- hestia_earth/models/lcImpactAllEffects100Years/damageToFreshwaterEcosystemsClimateChange.py +2 -2
- hestia_earth/models/lcImpactAllEffects100Years/damageToFreshwaterEcosystemsFreshwaterEutrophication.py +2 -2
- hestia_earth/models/lcImpactAllEffects100Years/damageToFreshwaterEcosystemsWaterStress.py +2 -2
- hestia_earth/models/lcImpactAllEffects100Years/damageToHumanHealthClimateChange.py +2 -2
- hestia_earth/models/lcImpactAllEffects100Years/damageToHumanHealthParticulateMatterFormation.py +2 -2
- hestia_earth/models/lcImpactAllEffects100Years/damageToHumanHealthPhotochemicalOzoneFormation.py +2 -2
- hestia_earth/models/lcImpactAllEffects100Years/damageToHumanHealthStratosphericOzoneDepletion.py +2 -2
- hestia_earth/models/lcImpactAllEffects100Years/damageToHumanHealthWaterStress.py +2 -2
- hestia_earth/models/lcImpactAllEffects100Years/damageToMarineEcosystemsMarineEutrophication.py +2 -2
- hestia_earth/models/lcImpactAllEffects100Years/damageToTerrestrialEcosystemsClimateChange.py +2 -2
- hestia_earth/models/lcImpactAllEffects100Years/damageToTerrestrialEcosystemsPhotochemicalOzoneFormation.py +2 -2
- hestia_earth/models/lcImpactAllEffects100Years/damageToTerrestrialEcosystemsTerrestrialAcidification.py +2 -2
- hestia_earth/models/lcImpactAllEffectsInfinite/damageToFreshwaterEcosystemsClimateChange.py +2 -2
- hestia_earth/models/lcImpactAllEffectsInfinite/damageToFreshwaterEcosystemsFreshwaterEutrophication.py +2 -2
- hestia_earth/models/lcImpactAllEffectsInfinite/damageToFreshwaterEcosystemsWaterStress.py +2 -2
- hestia_earth/models/lcImpactAllEffectsInfinite/damageToHumanHealthClimateChange.py +2 -2
- hestia_earth/models/lcImpactAllEffectsInfinite/damageToHumanHealthParticulateMatterFormation.py +2 -2
- hestia_earth/models/lcImpactAllEffectsInfinite/damageToHumanHealthPhotochemicalOzoneFormation.py +2 -2
- hestia_earth/models/lcImpactAllEffectsInfinite/damageToHumanHealthStratosphericOzoneDepletion.py +2 -2
- hestia_earth/models/lcImpactAllEffectsInfinite/damageToHumanHealthWaterStress.py +2 -2
- hestia_earth/models/lcImpactAllEffectsInfinite/damageToMarineEcosystemsMarineEutrophication.py +2 -2
- hestia_earth/models/lcImpactAllEffectsInfinite/damageToTerrestrialEcosystemsClimateChange.py +2 -2
- hestia_earth/models/lcImpactAllEffectsInfinite/damageToTerrestrialEcosystemsPhotochemicalOzoneFormation.py +2 -2
- hestia_earth/models/lcImpactAllEffectsInfinite/damageToTerrestrialEcosystemsTerrestrialAcidification.py +2 -2
- hestia_earth/models/lcImpactCertainEffects100Years/damageToFreshwaterEcosystemsFreshwaterEutrophication.py +2 -2
- hestia_earth/models/lcImpactCertainEffects100Years/damageToFreshwaterEcosystemsWaterStress.py +2 -2
- hestia_earth/models/lcImpactCertainEffects100Years/damageToHumanHealthClimateChange.py +2 -2
- hestia_earth/models/lcImpactCertainEffects100Years/damageToHumanHealthParticulateMatterFormation.py +2 -2
- hestia_earth/models/lcImpactCertainEffects100Years/damageToHumanHealthPhotochemicalOzoneFormation.py +2 -2
- hestia_earth/models/lcImpactCertainEffects100Years/damageToHumanHealthStratosphericOzoneDepletion.py +2 -2
- hestia_earth/models/lcImpactCertainEffects100Years/damageToHumanHealthWaterStress.py +2 -2
- hestia_earth/models/lcImpactCertainEffects100Years/damageToMarineEcosystemsMarineEutrophication.py +2 -2
- hestia_earth/models/lcImpactCertainEffects100Years/damageToTerrestrialEcosystemsClimateChange.py +2 -2
- hestia_earth/models/lcImpactCertainEffects100Years/damageToTerrestrialEcosystemsPhotochemicalOzoneFormation.py +2 -2
- hestia_earth/models/lcImpactCertainEffects100Years/damageToTerrestrialEcosystemsTerrestrialAcidification.py +2 -2
- hestia_earth/models/lcImpactCertainEffectsInfinite/damageToFreshwaterEcosystemsFreshwaterEutrophication.py +2 -2
- hestia_earth/models/lcImpactCertainEffectsInfinite/damageToFreshwaterEcosystemsWaterStress.py +2 -2
- hestia_earth/models/lcImpactCertainEffectsInfinite/damageToHumanHealthClimateChange.py +2 -2
- hestia_earth/models/lcImpactCertainEffectsInfinite/damageToHumanHealthParticulateMatterFormation.py +2 -2
- hestia_earth/models/lcImpactCertainEffectsInfinite/damageToHumanHealthPhotochemicalOzoneFormation.py +2 -2
- hestia_earth/models/lcImpactCertainEffectsInfinite/damageToHumanHealthStratosphericOzoneDepletion.py +2 -2
- hestia_earth/models/lcImpactCertainEffectsInfinite/damageToHumanHealthWaterStress.py +2 -2
- hestia_earth/models/lcImpactCertainEffectsInfinite/damageToMarineEcosystemsMarineEutrophication.py +2 -2
- hestia_earth/models/lcImpactCertainEffectsInfinite/damageToTerrestrialEcosystemsClimateChange.py +2 -2
- hestia_earth/models/lcImpactCertainEffectsInfinite/damageToTerrestrialEcosystemsPhotochemicalOzoneFormation.py +2 -2
- hestia_earth/models/lcImpactCertainEffectsInfinite/damageToTerrestrialEcosystemsTerrestrialAcidification.py +2 -2
- hestia_earth/models/mocking/build_mock_search.py +44 -0
- hestia_earth/models/mocking/mock_search.py +8 -49
- hestia_earth/models/mocking/search-results.json +3055 -558
- hestia_earth/models/poschEtAl2008/terrestrialAcidificationPotentialAccumulatedExceedance.py +3 -3
- hestia_earth/models/poschEtAl2008/terrestrialEutrophicationPotentialAccumulatedExceedance.py +3 -3
- hestia_earth/models/preload_requests.py +1 -1
- hestia_earth/models/recipe2016Egalitarian/ecosystemDamageOzoneFormation.py +2 -2
- hestia_earth/models/recipe2016Egalitarian/freshwaterEutrophicationPotential.py +2 -2
- hestia_earth/models/recipe2016Egalitarian/humanDamageOzoneFormation.py +2 -2
- 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/recipe2016Hierarchist/ecosystemDamageOzoneFormation.py +2 -2
- hestia_earth/models/recipe2016Hierarchist/freshwaterEutrophicationPotential.py +2 -2
- hestia_earth/models/recipe2016Hierarchist/humanDamageOzoneFormation.py +2 -2
- 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/recipe2016Individualist/ecosystemDamageOzoneFormation.py +2 -2
- hestia_earth/models/recipe2016Individualist/freshwaterEutrophicationPotential.py +2 -2
- hestia_earth/models/recipe2016Individualist/humanDamageOzoneFormation.py +2 -2
- 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/schmidt2007/utils.py +13 -4
- hestia_earth/models/utils/blank_node.py +73 -3
- hestia_earth/models/utils/constant.py +8 -1
- hestia_earth/models/utils/cycle.py +10 -13
- hestia_earth/models/utils/fuel.py +1 -1
- hestia_earth/models/utils/impact_assessment.py +49 -24
- hestia_earth/models/utils/lookup.py +36 -7
- hestia_earth/models/utils/pesticideAI.py +1 -1
- hestia_earth/models/utils/property.py +11 -4
- hestia_earth/models/utils/term.py +15 -8
- hestia_earth/models/version.py +1 -1
- {hestia_earth_models-0.64.9.dist-info → hestia_earth_models-0.64.11.dist-info}/METADATA +2 -2
- {hestia_earth_models-0.64.9.dist-info → hestia_earth_models-0.64.11.dist-info}/RECORD +123 -114
- {hestia_earth_models-0.64.9.dist-info → hestia_earth_models-0.64.11.dist-info}/WHEEL +1 -1
- tests/models/cml2001Baseline/test_abioticResourceDepletionFossilFuels.py +196 -0
- tests/models/cml2001Baseline/test_abioticResourceDepletionMineralsAndMetals.py +124 -0
- tests/models/cycle/completeness/test_freshForage.py +21 -0
- tests/models/edip2003/test_ozoneDepletionPotential.py +1 -13
- tests/models/environmentalFootprintV3/test_soilQualityIndexLandTransformation.py +1 -2
- tests/models/impact_assessment/test_emissions.py +1 -0
- tests/models/ipcc2019/test_aboveGroundBiomass.py +27 -63
- tests/models/ipcc2019/test_belowGroundBiomass.py +146 -0
- tests/models/ipcc2019/test_biomass_utils.py +115 -0
- tests/models/ipcc2019/{test_co2ToAirAboveGroundBiomassStockChangeLandUseChange.py → test_co2ToAirAboveGroundBiomassStockChange.py} +5 -5
- tests/models/ipcc2019/{test_co2ToAirBelowGroundBiomassStockChangeLandUseChange.py → test_co2ToAirBelowGroundBiomassStockChange.py} +5 -5
- tests/models/ipcc2019/{test_co2ToAirSoilOrganicCarbonStockChangeManagementChange.py → test_co2ToAirSoilOrganicCarbonStockChange.py} +5 -5
- tests/models/ipcc2021/test_gwp100.py +2 -2
- tests/models/utils/test_impact_assessment.py +3 -3
- hestia_earth/models/ipcc2019/aboveGroundBiomass_utils.py +0 -180
- tests/models/ipcc2019/test_aboveGroundBiomass_utils.py +0 -92
- {hestia_earth_models-0.64.9.dist-info → hestia_earth_models-0.64.11.dist-info}/LICENSE +0 -0
- {hestia_earth_models-0.64.9.dist-info → hestia_earth_models-0.64.11.dist-info}/top_level.txt +0 -0
|
@@ -36,8 +36,8 @@ def _indicator(value: float):
|
|
|
36
36
|
|
|
37
37
|
def run(impact_assessment: dict):
|
|
38
38
|
value = impact_country_value(MODEL, TERM_ID, impact_assessment, f"{list(LOOKUPS.keys())[0]}.csv",
|
|
39
|
-
country_fallback=True
|
|
39
|
+
country_fallback=True)
|
|
40
40
|
logRequirements(impact_assessment, model=MODEL, term=TERM_ID,
|
|
41
41
|
value=value)
|
|
42
|
-
logShouldRun(impact_assessment, MODEL, TERM_ID,
|
|
43
|
-
return _indicator(value)
|
|
42
|
+
logShouldRun(impact_assessment, MODEL, TERM_ID, value is not None)
|
|
43
|
+
return None if value is None else _indicator(value)
|
hestia_earth/models/poschEtAl2008/terrestrialEutrophicationPotentialAccumulatedExceedance.py
CHANGED
|
@@ -36,8 +36,8 @@ def _indicator(value: float):
|
|
|
36
36
|
|
|
37
37
|
def run(impact_assessment: dict):
|
|
38
38
|
value = impact_country_value(MODEL, TERM_ID, impact_assessment, f"{list(LOOKUPS.keys())[0]}.csv",
|
|
39
|
-
country_fallback=True
|
|
39
|
+
country_fallback=True)
|
|
40
40
|
logRequirements(impact_assessment, model=MODEL, term=TERM_ID,
|
|
41
41
|
value=value)
|
|
42
|
-
logShouldRun(impact_assessment, MODEL, TERM_ID,
|
|
43
|
-
return _indicator(value)
|
|
42
|
+
logShouldRun(impact_assessment, MODEL, TERM_ID, value is not None)
|
|
43
|
+
return None if value is None else _indicator(value)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from hestia_earth.models.log import logRequirements, logShouldRun
|
|
2
2
|
from hestia_earth.models.utils import sum_values
|
|
3
3
|
from hestia_earth.models.utils.indicator import _new_indicator
|
|
4
|
-
from hestia_earth.models.utils.impact_assessment import
|
|
4
|
+
from hestia_earth.models.utils.impact_assessment import impact_emission_lookup_value
|
|
5
5
|
from hestia_earth.models.utils.pesticideAI import impact_lookup_value as pesticides_lookup_value
|
|
6
6
|
from . import MODEL
|
|
7
7
|
|
|
@@ -34,7 +34,7 @@ def _indicator(value: float):
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
def run(impact_assessment: dict):
|
|
37
|
-
emissions_value =
|
|
37
|
+
emissions_value = impact_emission_lookup_value(MODEL, TERM_ID, impact_assessment, LOOKUPS['emission'])
|
|
38
38
|
logRequirements(impact_assessment, model=MODEL, term=TERM_ID,
|
|
39
39
|
emissions_value=emissions_value)
|
|
40
40
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from hestia_earth.models.log import logRequirements, logShouldRun
|
|
2
2
|
from hestia_earth.models.utils.indicator import _new_indicator
|
|
3
|
-
from hestia_earth.models.utils.impact_assessment import
|
|
3
|
+
from hestia_earth.models.utils.impact_assessment import impact_emission_lookup_value
|
|
4
4
|
from . import MODEL
|
|
5
5
|
|
|
6
6
|
REQUIREMENTS = {
|
|
@@ -26,7 +26,7 @@ def _indicator(value: float):
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
def run(impact_assessment: dict):
|
|
29
|
-
value =
|
|
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
32
|
logShouldRun(impact_assessment, MODEL, TERM_ID, True)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from hestia_earth.models.log import logRequirements, logShouldRun
|
|
2
2
|
from hestia_earth.models.utils import sum_values
|
|
3
3
|
from hestia_earth.models.utils.indicator import _new_indicator
|
|
4
|
-
from hestia_earth.models.utils.impact_assessment import
|
|
4
|
+
from hestia_earth.models.utils.impact_assessment import impact_emission_lookup_value
|
|
5
5
|
from hestia_earth.models.utils.pesticideAI import impact_lookup_value as pesticides_lookup_value
|
|
6
6
|
from . import MODEL
|
|
7
7
|
|
|
@@ -34,7 +34,7 @@ def _indicator(value: float):
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
def run(impact_assessment: dict):
|
|
37
|
-
emissions_value =
|
|
37
|
+
emissions_value = impact_emission_lookup_value(MODEL, TERM_ID, impact_assessment, LOOKUPS['emission'])
|
|
38
38
|
logRequirements(impact_assessment, model=MODEL, term=TERM_ID,
|
|
39
39
|
emissions_value=emissions_value)
|
|
40
40
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from hestia_earth.models.log import logRequirements, logShouldRun
|
|
2
2
|
from hestia_earth.models.utils.indicator import _new_indicator
|
|
3
|
-
from hestia_earth.models.utils.impact_assessment import
|
|
3
|
+
from hestia_earth.models.utils.impact_assessment import impact_emission_lookup_value
|
|
4
4
|
from . import MODEL
|
|
5
5
|
|
|
6
6
|
REQUIREMENTS = {
|
|
@@ -26,7 +26,7 @@ def _indicator(value: float):
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
def run(impact_assessment: dict):
|
|
29
|
-
value =
|
|
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
32
|
logShouldRun(impact_assessment, MODEL, TERM_ID, True)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from hestia_earth.models.log import logRequirements, logShouldRun
|
|
2
2
|
from hestia_earth.models.utils.indicator import _new_indicator
|
|
3
|
-
from hestia_earth.models.utils.impact_assessment import
|
|
3
|
+
from hestia_earth.models.utils.impact_assessment import impact_emission_lookup_value
|
|
4
4
|
from . import MODEL
|
|
5
5
|
|
|
6
6
|
REQUIREMENTS = {
|
|
@@ -26,7 +26,7 @@ def _indicator(value: float):
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
def run(impact_assessment: dict):
|
|
29
|
-
value =
|
|
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
32
|
logShouldRun(impact_assessment, MODEL, TERM_ID, True)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from hestia_earth.models.log import logRequirements, logShouldRun
|
|
2
2
|
from hestia_earth.models.utils.indicator import _new_indicator
|
|
3
|
-
from hestia_earth.models.utils.impact_assessment import
|
|
3
|
+
from hestia_earth.models.utils.impact_assessment import impact_emission_lookup_value
|
|
4
4
|
from . import MODEL
|
|
5
5
|
|
|
6
6
|
REQUIREMENTS = {
|
|
@@ -26,7 +26,7 @@ def _indicator(value: float):
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
def run(impact_assessment: dict):
|
|
29
|
-
value =
|
|
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
32
|
logShouldRun(impact_assessment, MODEL, TERM_ID, True)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from hestia_earth.models.log import logRequirements, logShouldRun
|
|
2
2
|
from hestia_earth.models.utils import sum_values
|
|
3
3
|
from hestia_earth.models.utils.indicator import _new_indicator
|
|
4
|
-
from hestia_earth.models.utils.impact_assessment import
|
|
4
|
+
from hestia_earth.models.utils.impact_assessment import impact_emission_lookup_value
|
|
5
5
|
from hestia_earth.models.utils.pesticideAI import impact_lookup_value as pesticides_lookup_value
|
|
6
6
|
from . import MODEL
|
|
7
7
|
|
|
@@ -34,7 +34,7 @@ def _indicator(value: float):
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
def run(impact_assessment: dict):
|
|
37
|
-
emissions_value =
|
|
37
|
+
emissions_value = impact_emission_lookup_value(MODEL, TERM_ID, impact_assessment, LOOKUPS['emission'])
|
|
38
38
|
logRequirements(impact_assessment, model=MODEL, term=TERM_ID,
|
|
39
39
|
emissions_value=emissions_value)
|
|
40
40
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from hestia_earth.models.log import logRequirements, logShouldRun
|
|
2
2
|
from hestia_earth.models.utils.indicator import _new_indicator
|
|
3
|
-
from hestia_earth.models.utils.impact_assessment import
|
|
3
|
+
from hestia_earth.models.utils.impact_assessment import impact_emission_lookup_value
|
|
4
4
|
from . import MODEL
|
|
5
5
|
|
|
6
6
|
REQUIREMENTS = {
|
|
@@ -26,7 +26,7 @@ def _indicator(value: float):
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
def run(impact_assessment: dict):
|
|
29
|
-
value =
|
|
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
32
|
logShouldRun(impact_assessment, MODEL, TERM_ID, True)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from hestia_earth.models.log import logRequirements, logShouldRun
|
|
2
2
|
from hestia_earth.models.utils import sum_values
|
|
3
3
|
from hestia_earth.models.utils.indicator import _new_indicator
|
|
4
|
-
from hestia_earth.models.utils.impact_assessment import
|
|
4
|
+
from hestia_earth.models.utils.impact_assessment import impact_emission_lookup_value
|
|
5
5
|
from hestia_earth.models.utils.pesticideAI import impact_lookup_value as pesticides_lookup_value
|
|
6
6
|
from . import MODEL
|
|
7
7
|
|
|
@@ -34,7 +34,7 @@ def _indicator(value: float):
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
def run(impact_assessment: dict):
|
|
37
|
-
emissions_value =
|
|
37
|
+
emissions_value = impact_emission_lookup_value(MODEL, TERM_ID, impact_assessment, LOOKUPS['emission'])
|
|
38
38
|
logRequirements(impact_assessment, model=MODEL, term=TERM_ID,
|
|
39
39
|
emissions_value=emissions_value)
|
|
40
40
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from hestia_earth.models.log import logRequirements, logShouldRun
|
|
2
2
|
from hestia_earth.models.utils.indicator import _new_indicator
|
|
3
|
-
from hestia_earth.models.utils.impact_assessment import
|
|
3
|
+
from hestia_earth.models.utils.impact_assessment import impact_emission_lookup_value
|
|
4
4
|
from . import MODEL
|
|
5
5
|
|
|
6
6
|
REQUIREMENTS = {
|
|
@@ -26,7 +26,7 @@ def _indicator(value: float):
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
def run(impact_assessment: dict):
|
|
29
|
-
value =
|
|
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
32
|
logShouldRun(impact_assessment, MODEL, TERM_ID, True)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from hestia_earth.models.log import logRequirements, logShouldRun
|
|
2
2
|
from hestia_earth.models.utils.indicator import _new_indicator
|
|
3
|
-
from hestia_earth.models.utils.impact_assessment import
|
|
3
|
+
from hestia_earth.models.utils.impact_assessment import impact_emission_lookup_value
|
|
4
4
|
from . import MODEL
|
|
5
5
|
|
|
6
6
|
REQUIREMENTS = {
|
|
@@ -26,7 +26,7 @@ def _indicator(value: float):
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
def run(impact_assessment: dict):
|
|
29
|
-
value =
|
|
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
32
|
logShouldRun(impact_assessment, MODEL, TERM_ID, True)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from hestia_earth.models.log import logRequirements, logShouldRun
|
|
2
2
|
from hestia_earth.models.utils.indicator import _new_indicator
|
|
3
|
-
from hestia_earth.models.utils.impact_assessment import
|
|
3
|
+
from hestia_earth.models.utils.impact_assessment import impact_emission_lookup_value
|
|
4
4
|
from . import MODEL
|
|
5
5
|
|
|
6
6
|
REQUIREMENTS = {
|
|
@@ -26,7 +26,7 @@ def _indicator(value: float):
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
def run(impact_assessment: dict):
|
|
29
|
-
value =
|
|
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
32
|
logShouldRun(impact_assessment, MODEL, TERM_ID, True)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from hestia_earth.models.log import logRequirements, logShouldRun
|
|
2
2
|
from hestia_earth.models.utils import sum_values
|
|
3
3
|
from hestia_earth.models.utils.indicator import _new_indicator
|
|
4
|
-
from hestia_earth.models.utils.impact_assessment import
|
|
4
|
+
from hestia_earth.models.utils.impact_assessment import impact_emission_lookup_value
|
|
5
5
|
from hestia_earth.models.utils.pesticideAI import impact_lookup_value as pesticides_lookup_value
|
|
6
6
|
from . import MODEL
|
|
7
7
|
|
|
@@ -34,7 +34,7 @@ def _indicator(value: float):
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
def run(impact_assessment: dict):
|
|
37
|
-
emissions_value =
|
|
37
|
+
emissions_value = impact_emission_lookup_value(MODEL, TERM_ID, impact_assessment, LOOKUPS['emission'])
|
|
38
38
|
logRequirements(impact_assessment, model=MODEL, term=TERM_ID,
|
|
39
39
|
emissions_value=emissions_value)
|
|
40
40
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from hestia_earth.models.log import logRequirements, logShouldRun
|
|
2
2
|
from hestia_earth.models.utils.indicator import _new_indicator
|
|
3
|
-
from hestia_earth.models.utils.impact_assessment import
|
|
3
|
+
from hestia_earth.models.utils.impact_assessment import impact_emission_lookup_value
|
|
4
4
|
from . import MODEL
|
|
5
5
|
|
|
6
6
|
REQUIREMENTS = {
|
|
@@ -26,7 +26,7 @@ def _indicator(value: float):
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
def run(impact_assessment: dict):
|
|
29
|
-
value =
|
|
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
32
|
logShouldRun(impact_assessment, MODEL, TERM_ID, True)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from hestia_earth.models.log import logRequirements, logShouldRun
|
|
2
2
|
from hestia_earth.models.utils import sum_values
|
|
3
3
|
from hestia_earth.models.utils.indicator import _new_indicator
|
|
4
|
-
from hestia_earth.models.utils.impact_assessment import
|
|
4
|
+
from hestia_earth.models.utils.impact_assessment import impact_emission_lookup_value
|
|
5
5
|
from hestia_earth.models.utils.pesticideAI import impact_lookup_value as pesticides_lookup_value
|
|
6
6
|
from . import MODEL
|
|
7
7
|
|
|
@@ -34,7 +34,7 @@ def _indicator(value: float):
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
def run(impact_assessment: dict):
|
|
37
|
-
emissions_value =
|
|
37
|
+
emissions_value = impact_emission_lookup_value(MODEL, TERM_ID, impact_assessment, LOOKUPS['emission'])
|
|
38
38
|
logRequirements(impact_assessment, model=MODEL, term=TERM_ID,
|
|
39
39
|
emissions_value=emissions_value)
|
|
40
40
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from hestia_earth.models.log import logRequirements, logShouldRun
|
|
2
2
|
from hestia_earth.models.utils.indicator import _new_indicator
|
|
3
|
-
from hestia_earth.models.utils.impact_assessment import
|
|
3
|
+
from hestia_earth.models.utils.impact_assessment import impact_emission_lookup_value
|
|
4
4
|
from . import MODEL
|
|
5
5
|
|
|
6
6
|
REQUIREMENTS = {
|
|
@@ -26,7 +26,7 @@ def _indicator(value: float):
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
def run(impact_assessment: dict):
|
|
29
|
-
value =
|
|
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
32
|
logShouldRun(impact_assessment, MODEL, TERM_ID, True)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from hestia_earth.models.log import logRequirements, logShouldRun
|
|
2
2
|
from hestia_earth.models.utils.indicator import _new_indicator
|
|
3
|
-
from hestia_earth.models.utils.impact_assessment import
|
|
3
|
+
from hestia_earth.models.utils.impact_assessment import impact_emission_lookup_value
|
|
4
4
|
from . import MODEL
|
|
5
5
|
|
|
6
6
|
REQUIREMENTS = {
|
|
@@ -26,7 +26,7 @@ def _indicator(value: float):
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
def run(impact_assessment: dict):
|
|
29
|
-
value =
|
|
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
32
|
logShouldRun(impact_assessment, MODEL, TERM_ID, True)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from hestia_earth.models.log import logRequirements, logShouldRun
|
|
2
2
|
from hestia_earth.models.utils.indicator import _new_indicator
|
|
3
|
-
from hestia_earth.models.utils.impact_assessment import
|
|
3
|
+
from hestia_earth.models.utils.impact_assessment import impact_emission_lookup_value
|
|
4
4
|
from . import MODEL
|
|
5
5
|
|
|
6
6
|
REQUIREMENTS = {
|
|
@@ -26,7 +26,7 @@ def _indicator(value: float):
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
def run(impact_assessment: dict):
|
|
29
|
-
value =
|
|
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
32
|
logShouldRun(impact_assessment, MODEL, TERM_ID, True)
|
|
@@ -3,14 +3,23 @@ from hestia_earth.utils.model import filter_list_term_type
|
|
|
3
3
|
from hestia_earth.utils.tools import non_empty_list
|
|
4
4
|
|
|
5
5
|
from hestia_earth.models.utils.completeness import _is_term_type_complete
|
|
6
|
-
from hestia_earth.models.utils.lookup import
|
|
6
|
+
from hestia_earth.models.utils.lookup import all_factor_value
|
|
7
|
+
from . import MODEL
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
def get_waste_values(term_id: str, cycle: dict, lookup_col: str):
|
|
10
11
|
products = filter_list_term_type(cycle.get('products', []), TermTermType.WASTE)
|
|
11
|
-
|
|
12
|
+
value = all_factor_value(
|
|
13
|
+
model=MODEL,
|
|
14
|
+
term_id=term_id,
|
|
15
|
+
node=cycle,
|
|
16
|
+
lookup_name=f"{TermTermType.WASTE.value}.csv",
|
|
17
|
+
lookup_col=lookup_col,
|
|
18
|
+
blank_nodes=products,
|
|
19
|
+
default_no_values=None
|
|
20
|
+
)
|
|
12
21
|
return [0] if all([
|
|
13
|
-
|
|
22
|
+
value is None,
|
|
14
23
|
_is_term_type_complete(cycle, TermTermType.WASTE),
|
|
15
24
|
cycle.get('@type', cycle.get('type')) == NodeType.CYCLE.value # ignore adding 0 value for Transformation
|
|
16
|
-
]) else
|
|
25
|
+
]) else non_empty_list([value])
|
|
@@ -28,14 +28,14 @@ from hestia_earth.utils.tools import (
|
|
|
28
28
|
)
|
|
29
29
|
|
|
30
30
|
from . import is_from_model, _filter_list_term_unit, is_iterable, full_date_str
|
|
31
|
-
from .constant import Units
|
|
31
|
+
from .constant import Units, get_atomic_conversion
|
|
32
32
|
from .lookup import (
|
|
33
33
|
is_model_siteType_allowed,
|
|
34
34
|
is_siteType_allowed,
|
|
35
35
|
is_product_id_allowed, is_product_termType_allowed,
|
|
36
|
-
is_input_id_allowed, is_input_termType_allowed
|
|
36
|
+
is_input_id_allowed, is_input_termType_allowed, _node_value
|
|
37
37
|
)
|
|
38
|
-
from .property import get_node_property, get_node_property_value
|
|
38
|
+
from .property import get_node_property, get_node_property_value, find_term_property
|
|
39
39
|
from .term import get_lookup_value
|
|
40
40
|
from ..log import debugValues, log_as_table
|
|
41
41
|
|
|
@@ -1387,3 +1387,73 @@ def most_relevant_blank_node_by_id(nodes: list, term_id: str, date: str):
|
|
|
1387
1387
|
return {} if len(filtered_nodes) == 0 \
|
|
1388
1388
|
else _shallowest_node(_most_recent_nodes(filtered_nodes, date)) \
|
|
1389
1389
|
if date and len(filtered_nodes) > 1 else filtered_nodes[0]
|
|
1390
|
+
|
|
1391
|
+
|
|
1392
|
+
PROPERTY_UNITS_CONVERSIONS = {
|
|
1393
|
+
Units.KG.value: {
|
|
1394
|
+
Units.MJ.value: [
|
|
1395
|
+
'energyContentHigherHeatingValue', # "kg" to "mj"
|
|
1396
|
+
]
|
|
1397
|
+
},
|
|
1398
|
+
Units.M3.value: {
|
|
1399
|
+
Units.MJ.value: [
|
|
1400
|
+
'density', # "m3" to "kg"
|
|
1401
|
+
'energyContentHigherHeatingValue', # "kg" to "mj"
|
|
1402
|
+
]
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
|
|
1406
|
+
|
|
1407
|
+
def _convert_via_property(node: dict, node_value: Union[int, float], property_field: str) -> Optional[float]:
|
|
1408
|
+
"""
|
|
1409
|
+
Converts a node_value number from one unit to another using a property_field associated
|
|
1410
|
+
with a term inside term node such as "density" or 'energyContentHigherHeatingValue' or listed
|
|
1411
|
+
in https://www.hestia.earth/glossary?page=1&termType=property
|
|
1412
|
+
|
|
1413
|
+
Will return none if the property_field is not found
|
|
1414
|
+
|
|
1415
|
+
Parameters
|
|
1416
|
+
----------
|
|
1417
|
+
node: a dict containing a term
|
|
1418
|
+
node_value: value to be converted as float or int
|
|
1419
|
+
property_field: str such as "density"
|
|
1420
|
+
|
|
1421
|
+
Returns float or None
|
|
1422
|
+
-------
|
|
1423
|
+
"""
|
|
1424
|
+
node_property = find_term_property(node, property_field, default={}, keep_in_memory=True)
|
|
1425
|
+
node_property_value = safe_parse_float(node_property.get("value", 0))
|
|
1426
|
+
|
|
1427
|
+
return node_value * node_property_value if node_value is not None and bool(node_property_value) else None
|
|
1428
|
+
|
|
1429
|
+
|
|
1430
|
+
def convert_unit(node, dest_unit: Units, node_value: Union[int, float] = None) -> Optional[Union[int, float]]:
|
|
1431
|
+
"""
|
|
1432
|
+
Convert a number `value` inside a node or a optional `node_value` belonging to a term `node`, to unit `dest_unit`
|
|
1433
|
+
using the ATOMIC_WEIGHT_CONVERSIONS map or failing that, the PROPERTY_UNITS_CONVERSIONS map and lookups
|
|
1434
|
+
"""
|
|
1435
|
+
src_unit = node.get("units", "")
|
|
1436
|
+
|
|
1437
|
+
node_value = _node_value(node) if node_value is None else node_value
|
|
1438
|
+
|
|
1439
|
+
return node_value if src_unit == dest_unit.value else (
|
|
1440
|
+
node_value * get_atomic_conversion(src_unit, dest_unit)
|
|
1441
|
+
if get_atomic_conversion(src_unit, dest_unit, default_value=None) is not None
|
|
1442
|
+
else convert_unit_properties(node_value, node, dest_unit)
|
|
1443
|
+
) if node_value else None
|
|
1444
|
+
|
|
1445
|
+
|
|
1446
|
+
def convert_unit_properties(node_value: Union[int, float], node: dict, dest_unit: Units) -> Optional[Union[int, float]]:
|
|
1447
|
+
"""
|
|
1448
|
+
Convert a number `node_value` belonging to a term `node`, to unit `to_units` by chaining multiple unit conversions
|
|
1449
|
+
together.
|
|
1450
|
+
Uses terms properties for the conversion.
|
|
1451
|
+
Uses cached calls to download_hestia() internally for speedup
|
|
1452
|
+
Returns None if no conversion possible.
|
|
1453
|
+
"""
|
|
1454
|
+
src_unit = node.get('units', '')
|
|
1455
|
+
conversions = PROPERTY_UNITS_CONVERSIONS.get(src_unit, {}).get(dest_unit.value, [])
|
|
1456
|
+
return reduce(
|
|
1457
|
+
lambda value, conversion_property_field: _convert_via_property(node, value, conversion_property_field),
|
|
1458
|
+
conversions, node_value
|
|
1459
|
+
) if conversions else None
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from enum import Enum
|
|
2
|
+
|
|
2
3
|
from hestia_earth.utils.tools import list_sum
|
|
3
4
|
|
|
4
5
|
|
|
@@ -35,6 +36,9 @@ class Units(Enum):
|
|
|
35
36
|
PERCENTAGE_AREA = '% area'
|
|
36
37
|
TO_C = '-C'
|
|
37
38
|
TO_N = '-N'
|
|
39
|
+
KW_H = 'kWh'
|
|
40
|
+
MJ = 'MJ'
|
|
41
|
+
M3 = "m3"
|
|
38
42
|
|
|
39
43
|
|
|
40
44
|
C = 12.012
|
|
@@ -93,7 +97,10 @@ ATOMIC_WEIGHT_CONVERSIONS = {
|
|
|
93
97
|
},
|
|
94
98
|
Units.KG_NH4.value: {
|
|
95
99
|
Units.TO_N.value: (N + H*4) / N # Conv_Mol_NH4N_NH4
|
|
96
|
-
}
|
|
100
|
+
},
|
|
101
|
+
Units.KW_H.value: {
|
|
102
|
+
Units.MJ.value: 3.6
|
|
103
|
+
},
|
|
97
104
|
}
|
|
98
105
|
|
|
99
106
|
|
|
@@ -3,7 +3,7 @@ from hestia_earth.utils.model import filter_list_term_type, find_term_match, fin
|
|
|
3
3
|
from hestia_earth.utils.tools import list_sum, safe_parse_float, safe_parse_date, non_empty_list
|
|
4
4
|
|
|
5
5
|
from ..log import logRequirements, debugValues
|
|
6
|
-
from .lookup import
|
|
6
|
+
from .lookup import all_factor_value, is_siteType_allowed
|
|
7
7
|
from .term import get_lookup_value
|
|
8
8
|
from .property import get_node_property
|
|
9
9
|
from .completeness import _is_term_type_complete
|
|
@@ -386,9 +386,7 @@ def cycle_end_year(cycle: dict):
|
|
|
386
386
|
return date.year if date else None
|
|
387
387
|
|
|
388
388
|
|
|
389
|
-
def impact_lookup_value(
|
|
390
|
-
model: str, term_id: str, blank_nodes: list, lookup_col: str, allow_missing: bool = True
|
|
391
|
-
) -> float:
|
|
389
|
+
def impact_lookup_value(model: str, term_id: str, cycle: dict, blank_nodes: list, lookup_col: str) -> float:
|
|
392
390
|
"""
|
|
393
391
|
Calculate the value of the impact based on lookup factors and cycle values.
|
|
394
392
|
|
|
@@ -409,15 +407,14 @@ def impact_lookup_value(
|
|
|
409
407
|
The impact total value.
|
|
410
408
|
"""
|
|
411
409
|
term_type = blank_nodes[0].get('term', {}).get('termType') if len(blank_nodes) > 0 else None
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
return list_sum(values) if len(values) > 0 and (allow_missing or all_nodes_have_value) else None
|
|
410
|
+
return all_factor_value(
|
|
411
|
+
model=model,
|
|
412
|
+
term_id=term_id,
|
|
413
|
+
node=cycle,
|
|
414
|
+
lookup_name=f"{term_type}.csv",
|
|
415
|
+
lookup_col=lookup_col,
|
|
416
|
+
blank_nodes=blank_nodes
|
|
417
|
+
)
|
|
421
418
|
|
|
422
419
|
|
|
423
420
|
def get_ecoClimateZone(cycle: dict) -> int:
|
|
@@ -13,7 +13,7 @@ def impact_lookup_value(model: str, term_id: str, impact_assessment: dict, looku
|
|
|
13
13
|
fuels = filter_list_term_type(cycle.get('inputs', []), TermTermType.FUEL)
|
|
14
14
|
has_fuels_inputs = len(fuels) > 0
|
|
15
15
|
fuels_total_value = convert_value_from_cycle(
|
|
16
|
-
product, cycle_lookup_value(model, term_id, fuels, lookup_col), model=model, term_id=term_id
|
|
16
|
+
product, cycle_lookup_value(model, term_id, cycle, fuels, lookup_col), model=model, term_id=term_id
|
|
17
17
|
) if has_fuels_inputs else None
|
|
18
18
|
logRequirements(impact_assessment, model=model, term=term_id,
|
|
19
19
|
term_type_electricityFuel_complete=fuel_complete,
|