hestia-earth-models 0.73.7__py3-none-any.whl → 0.73.8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of hestia-earth-models might be problematic. Click here for more details.
- hestia_earth/models/config/Cycle.json +116 -26
- hestia_earth/models/config/ImpactAssessment.json +239 -199
- hestia_earth/models/dammgen2009/noxToAirExcreta.py +11 -9
- hestia_earth/models/ecoalimV9/cycle.py +29 -39
- hestia_earth/models/ecoalimV9/impact_assessment.py +38 -40
- hestia_earth/models/ecoalimV9/utils.py +82 -16
- hestia_earth/models/ecoinventV3/__init__.py +3 -3
- hestia_earth/models/emepEea2019/n2OToAirFuelCombustionDirect.py +2 -2
- hestia_earth/models/hestia/default_emissions.py +2 -6
- hestia_earth/models/hestia/default_resourceUse.py +2 -5
- hestia_earth/models/hestia/seed_emissions.py +7 -3
- hestia_earth/models/impact_assessment/emissions.py +3 -5
- hestia_earth/models/ipcc2019/biocharOrganicCarbonPerHa.py +9 -3
- hestia_earth/models/ipcc2019/co2ToAirAboveGroundBiomassStockChange.py +1 -5
- hestia_earth/models/ipcc2019/co2ToAirBelowGroundBiomassStockChange.py +1 -5
- hestia_earth/models/ipcc2019/co2ToAirCarbonStockChange_utils.py +1 -33
- hestia_earth/models/ipcc2019/co2ToAirSoilOrganicCarbonStockChange.py +1 -5
- hestia_earth/models/ipcc2019/n2OToAirAquacultureSystemsIndirect.py +44 -0
- hestia_earth/models/ipcc2019/n2OToAirCropResidueBurningIndirect.py +43 -0
- hestia_earth/models/ipcc2019/n2OToAirCropResidueDecompositionIndirect.py +13 -70
- hestia_earth/models/ipcc2019/n2OToAirExcretaIndirect.py +13 -70
- hestia_earth/models/ipcc2019/n2OToAirFuelCombustionIndirect.py +43 -0
- hestia_earth/models/ipcc2019/n2OToAirInorganicFertiliserIndirect.py +13 -70
- hestia_earth/models/ipcc2019/n2OToAirNaturalVegetationBurningIndirect.py +43 -0
- hestia_earth/models/ipcc2019/n2OToAirOrganicFertiliserIndirect.py +13 -70
- hestia_earth/models/ipcc2019/n2OToAirOrganicSoilBurningIndirect.py +43 -0
- hestia_earth/models/ipcc2019/n2OToAirOrganicSoilCultivationIndirect.py +43 -0
- hestia_earth/models/ipcc2019/n2OToAir_indirect_emissions_utils.py +112 -0
- hestia_earth/models/ipcc2019/utils.py +0 -25
- hestia_earth/models/jarvisAndPain1994/n2ToAirExcreta.py +11 -9
- hestia_earth/models/linkedImpactAssessment/emissions.py +24 -15
- hestia_earth/models/linkedImpactAssessment/utils.py +5 -1
- hestia_earth/models/mocking/search-results.json +354 -354
- hestia_earth/models/utils/background_emissions.py +17 -10
- hestia_earth/models/utils/emission.py +18 -8
- hestia_earth/models/utils/impact_assessment.py +3 -3
- hestia_earth/models/utils/indicator.py +8 -1
- hestia_earth/models/utils/lookup.py +29 -17
- hestia_earth/models/utils/productivity.py +1 -1
- hestia_earth/models/version.py +1 -1
- hestia_earth/orchestrator/strategies/merge/merge_list.py +41 -54
- {hestia_earth_models-0.73.7.dist-info → hestia_earth_models-0.73.8.dist-info}/METADATA +3 -3
- {hestia_earth_models-0.73.7.dist-info → hestia_earth_models-0.73.8.dist-info}/RECORD +62 -47
- tests/models/dammgen2009/test_noxToAirExcreta.py +2 -2
- tests/models/ecoalimV9/test_cycle.py +1 -1
- tests/models/ecoalimV9/test_impact_assessment.py +1 -1
- tests/models/ecoalimV9/test_utils.py +13 -0
- tests/models/ipcc2019/test_biocharOrganicCarbonPerHa.py +2 -1
- tests/models/ipcc2019/test_n2OToAirAquacultureSystemsIndirect.py +45 -0
- tests/models/ipcc2019/test_n2OToAirCropResidueBurningIndirect.py +45 -0
- tests/models/ipcc2019/test_n2OToAirCropResidueDecompositionIndirect.py +6 -32
- tests/models/ipcc2019/test_n2OToAirExcretaIndirect.py +6 -32
- tests/models/ipcc2019/test_n2OToAirFuelCombustionIndirect.py +45 -0
- tests/models/ipcc2019/test_n2OToAirInorganicFertiliserIndirect.py +6 -32
- tests/models/ipcc2019/test_n2OToAirNaturalVegetationBurningIndirect.py +45 -0
- tests/models/ipcc2019/test_n2OToAirOrganicFertiliserIndirect.py +6 -32
- tests/models/ipcc2019/test_n2OToAirOrganicSoilBurningIndirect.py +45 -0
- tests/models/ipcc2019/test_n2OToAirOrganicSoilCultivationIndirect.py +45 -0
- tests/models/ipcc2019/test_n2OToAir_indirect_emissions_utils.py +19 -0
- {hestia_earth_models-0.73.7.dist-info → hestia_earth_models-0.73.8.dist-info}/LICENSE +0 -0
- {hestia_earth_models-0.73.7.dist-info → hestia_earth_models-0.73.8.dist-info}/WHEEL +0 -0
- {hestia_earth_models-0.73.7.dist-info → hestia_earth_models-0.73.8.dist-info}/top_level.txt +0 -0
|
@@ -69,9 +69,7 @@ def _emission(
|
|
|
69
69
|
min: list[float] = None,
|
|
70
70
|
max: list[float] = None,
|
|
71
71
|
statsDefinition: str = None,
|
|
72
|
-
observations: list[int] = None
|
|
73
|
-
start_date: str,
|
|
74
|
-
end_date: str
|
|
72
|
+
observations: list[int] = None
|
|
75
73
|
) -> dict:
|
|
76
74
|
"""
|
|
77
75
|
Create an emission node based on the provided value and method tier.
|
|
@@ -99,8 +97,6 @@ def _emission(
|
|
|
99
97
|
"max": max,
|
|
100
98
|
"statsDefinition": statsDefinition,
|
|
101
99
|
"observations": observations,
|
|
102
|
-
"startDate": start_date,
|
|
103
|
-
"endDate": end_date,
|
|
104
100
|
"methodTier": method_tier.value,
|
|
105
101
|
"depth": _DEPTH_LOWER
|
|
106
102
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
from hestia_earth.schema import EmissionMethodTier
|
|
2
|
+
|
|
3
|
+
from .n2OToAir_indirect_emissions_utils import run as run_emission
|
|
4
|
+
|
|
5
|
+
REQUIREMENTS = {
|
|
6
|
+
"Cycle": {
|
|
7
|
+
"completeness.cropResidue": "True",
|
|
8
|
+
"emissions": [
|
|
9
|
+
{"@type": "Emission", "value": "", "term.@id": "nh3ToSurfaceWaterAquacultureSystems"},
|
|
10
|
+
{"@type": "Emission", "value": "", "term.@id": "nh3ToAirAquacultureSystems"},
|
|
11
|
+
{"@type": "Emission", "value": "", "term.@id": "noxToAirAquacultureSystems"}
|
|
12
|
+
],
|
|
13
|
+
"optional": {
|
|
14
|
+
"site": {
|
|
15
|
+
"@type": "Site",
|
|
16
|
+
"measurements": [
|
|
17
|
+
{"@type": "Measurement", "value": "", "term.@id": "ecoClimateZone"}
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
LOOKUPS = {
|
|
24
|
+
"emission": [
|
|
25
|
+
"IPCC_2019_EF4_FACTORS", "IPCC_2019_EF4_FACTORS-max", "IPCC_2019_EF4_FACTORS-min",
|
|
26
|
+
"IPCC_2019_EF5_FACTORS", "IPCC_2019_EF5_FACTORS-max", "IPCC_2019_EF5_FACTORS-min"
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
RETURNS = {
|
|
30
|
+
"Emission": [{
|
|
31
|
+
"value": "",
|
|
32
|
+
"methodTier": "tier 1"
|
|
33
|
+
}]
|
|
34
|
+
}
|
|
35
|
+
TERM_ID = 'n2OToAirAquacultureSystemsIndirect'
|
|
36
|
+
TIER = EmissionMethodTier.TIER_1.value
|
|
37
|
+
_NO3_TERM_ID = 'nh3ToSurfaceWaterAquacultureSystems'
|
|
38
|
+
_NH3_TERM_ID = 'nh3ToAirAquacultureSystems'
|
|
39
|
+
_NOX_TERM_ID = 'noxToAirAquacultureSystems'
|
|
40
|
+
_EMISSION_IDS = [_NH3_TERM_ID, _NO3_TERM_ID, _NOX_TERM_ID]
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def run(cycle: dict):
|
|
44
|
+
return run_emission(TERM_ID, _EMISSION_IDS, cycle)
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
from hestia_earth.schema import EmissionMethodTier
|
|
2
|
+
|
|
3
|
+
from .n2OToAir_indirect_emissions_utils import run as run_emission
|
|
4
|
+
|
|
5
|
+
REQUIREMENTS = {
|
|
6
|
+
"Cycle": {
|
|
7
|
+
"completeness.cropResidue": "True",
|
|
8
|
+
"emissions": [
|
|
9
|
+
{"@type": "Emission", "value": "", "term.@id": "nh3ToAirCropResidueBurning"},
|
|
10
|
+
{"@type": "Emission", "value": "", "term.@id": "noxToAirCropResidueBurning"}
|
|
11
|
+
],
|
|
12
|
+
"optional": {
|
|
13
|
+
"site": {
|
|
14
|
+
"@type": "Site",
|
|
15
|
+
"measurements": [
|
|
16
|
+
{"@type": "Measurement", "value": "", "term.@id": "ecoClimateZone"}
|
|
17
|
+
]
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
LOOKUPS = {
|
|
23
|
+
"emission": [
|
|
24
|
+
"IPCC_2019_EF4_FACTORS", "IPCC_2019_EF4_FACTORS-max", "IPCC_2019_EF4_FACTORS-min",
|
|
25
|
+
"IPCC_2019_EF5_FACTORS", "IPCC_2019_EF5_FACTORS-max", "IPCC_2019_EF5_FACTORS-min"
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
RETURNS = {
|
|
29
|
+
"Emission": [{
|
|
30
|
+
"value": "",
|
|
31
|
+
"methodTier": "tier 1"
|
|
32
|
+
}]
|
|
33
|
+
}
|
|
34
|
+
TERM_ID = 'n2OToAirCropResidueBurningIndirect'
|
|
35
|
+
TIER = EmissionMethodTier.TIER_1.value
|
|
36
|
+
_NO3_TERM_ID = None
|
|
37
|
+
_NH3_TERM_ID = 'nh3ToAirCropResidueBurning'
|
|
38
|
+
_NOX_TERM_ID = 'noxToAirCropResidueBurning'
|
|
39
|
+
_EMISSION_IDS = [_NH3_TERM_ID, _NO3_TERM_ID, _NOX_TERM_ID]
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def run(cycle: dict):
|
|
43
|
+
return run_emission(TERM_ID, _EMISSION_IDS, cycle)
|
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
from hestia_earth.schema import EmissionMethodTier
|
|
1
|
+
from hestia_earth.schema import EmissionMethodTier
|
|
2
2
|
|
|
3
|
-
from
|
|
4
|
-
from hestia_earth.models.utils.constant import Units, get_atomic_conversion
|
|
5
|
-
from hestia_earth.models.utils.completeness import _is_term_type_complete
|
|
6
|
-
from hestia_earth.models.utils.emission import _new_emission, get_nh3_no3_nox_to_n
|
|
7
|
-
from hestia_earth.models.utils.cycle import get_ecoClimateZone
|
|
8
|
-
from .utils import ecoClimate_factors, EF4_FACTORS, EF5_FACTORS
|
|
9
|
-
from . import MODEL
|
|
3
|
+
from .n2OToAir_indirect_emissions_utils import run as run_emission
|
|
10
4
|
|
|
11
5
|
REQUIREMENTS = {
|
|
12
6
|
"Cycle": {
|
|
13
|
-
"completeness.cropResidue": "True",
|
|
14
7
|
"emissions": [
|
|
15
8
|
{"@type": "Emission", "value": "", "term.@id": "no3ToGroundwaterCropResidueDecomposition"},
|
|
16
9
|
{"@type": "Emission", "value": "", "term.@id": "nh3ToAirCropResidueDecomposition"},
|
|
@@ -26,6 +19,12 @@ REQUIREMENTS = {
|
|
|
26
19
|
}
|
|
27
20
|
}
|
|
28
21
|
}
|
|
22
|
+
LOOKUPS = {
|
|
23
|
+
"emission": [
|
|
24
|
+
"IPCC_2019_EF4_FACTORS", "IPCC_2019_EF4_FACTORS-max", "IPCC_2019_EF4_FACTORS-min",
|
|
25
|
+
"IPCC_2019_EF5_FACTORS", "IPCC_2019_EF5_FACTORS-max", "IPCC_2019_EF5_FACTORS-min"
|
|
26
|
+
]
|
|
27
|
+
}
|
|
29
28
|
RETURNS = {
|
|
30
29
|
"Emission": [{
|
|
31
30
|
"value": "",
|
|
@@ -34,67 +33,11 @@ RETURNS = {
|
|
|
34
33
|
}
|
|
35
34
|
TERM_ID = 'n2OToAirCropResidueDecompositionIndirect'
|
|
36
35
|
TIER = EmissionMethodTier.TIER_1.value
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
def _emission(value: float, min: float, max: float, aggregated: bool = False):
|
|
43
|
-
emission = _new_emission(TERM_ID, MODEL)
|
|
44
|
-
emission['value'] = [value]
|
|
45
|
-
emission['min'] = [min]
|
|
46
|
-
emission['max'] = [max]
|
|
47
|
-
emission['methodTier'] = TIER
|
|
48
|
-
emission['statsDefinition'] = EmissionStatsDefinition.MODELLED.value
|
|
49
|
-
emission['methodModelDescription'] = 'Aggregated version' if aggregated else 'Disaggregated version'
|
|
50
|
-
return emission
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
def _run(cycle: dict, no3: float, nh3: float, nox: float):
|
|
54
|
-
ecoClimateZone = get_ecoClimateZone(cycle)
|
|
55
|
-
|
|
56
|
-
ef4, aggregated = ecoClimate_factors(EF4_FACTORS, ecoClimateZone=ecoClimateZone)
|
|
57
|
-
ef5 = EF5_FACTORS.get('default')
|
|
58
|
-
|
|
59
|
-
debugValues(cycle, model=MODEL, term=TERM_ID,
|
|
60
|
-
ecoClimateZone=ecoClimateZone,
|
|
61
|
-
ef4_factors_used=log_as_table(ef4),
|
|
62
|
-
ef5_factors_used=log_as_table(ef5),
|
|
63
|
-
aggregated=aggregated)
|
|
64
|
-
|
|
65
|
-
value = sum([
|
|
66
|
-
no3 * ef5['value'],
|
|
67
|
-
nh3 * ef4['value'],
|
|
68
|
-
nox * ef4['value']
|
|
69
|
-
]) * get_atomic_conversion(Units.KG_N2O, Units.TO_N)
|
|
70
|
-
min = sum([
|
|
71
|
-
no3 * ef5['min'],
|
|
72
|
-
nh3 * ef4['min'],
|
|
73
|
-
nox * ef4['min']
|
|
74
|
-
]) * get_atomic_conversion(Units.KG_N2O, Units.TO_N)
|
|
75
|
-
max = sum([
|
|
76
|
-
no3 * ef5['max'],
|
|
77
|
-
nh3 * ef4['max'],
|
|
78
|
-
nox * ef4['max']
|
|
79
|
-
]) * get_atomic_conversion(Units.KG_N2O, Units.TO_N)
|
|
80
|
-
return [_emission(value, min, max, aggregated=aggregated)]
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
def _should_run(cycle: dict):
|
|
84
|
-
nh3_n, no3_n, nox_n = get_nh3_no3_nox_to_n(cycle, NH3_TERM_ID, NO3_TERM_ID, NOX_TERM_ID)
|
|
85
|
-
term_type_complete = _is_term_type_complete(cycle, TermTermType.CROPRESIDUE)
|
|
86
|
-
|
|
87
|
-
logRequirements(cycle, model=MODEL, term=TERM_ID,
|
|
88
|
-
no3_n=no3_n,
|
|
89
|
-
nh3_n=nh3_n,
|
|
90
|
-
nox_n=nox_n,
|
|
91
|
-
term_type_cropResidue_complete=term_type_complete)
|
|
92
|
-
|
|
93
|
-
should_run = all([no3_n is not None, nh3_n is not None, nox_n is not None, term_type_complete])
|
|
94
|
-
logShouldRun(cycle, MODEL, TERM_ID, should_run, methodTier=TIER)
|
|
95
|
-
return should_run, no3_n, nh3_n, nox_n
|
|
36
|
+
_NO3_TERM_ID = 'no3ToGroundwaterCropResidueDecomposition'
|
|
37
|
+
_NH3_TERM_ID = 'nh3ToAirCropResidueDecomposition'
|
|
38
|
+
_NOX_TERM_ID = 'noxToAirCropResidueDecomposition'
|
|
39
|
+
_EMISSION_IDS = [_NH3_TERM_ID, _NO3_TERM_ID, _NOX_TERM_ID]
|
|
96
40
|
|
|
97
41
|
|
|
98
42
|
def run(cycle: dict):
|
|
99
|
-
|
|
100
|
-
return _run(cycle, no3, nh3, nox) if should_run else []
|
|
43
|
+
return run_emission(TERM_ID, _EMISSION_IDS, cycle)
|
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
from hestia_earth.schema import EmissionMethodTier
|
|
1
|
+
from hestia_earth.schema import EmissionMethodTier
|
|
2
2
|
|
|
3
|
-
from
|
|
4
|
-
from hestia_earth.models.utils.constant import Units, get_atomic_conversion
|
|
5
|
-
from hestia_earth.models.utils.completeness import _is_term_type_complete
|
|
6
|
-
from hestia_earth.models.utils.emission import _new_emission, get_nh3_no3_nox_to_n
|
|
7
|
-
from hestia_earth.models.utils.cycle import get_ecoClimateZone
|
|
8
|
-
from .utils import ecoClimate_factors, EF4_FACTORS, EF5_FACTORS
|
|
9
|
-
from . import MODEL
|
|
3
|
+
from .n2OToAir_indirect_emissions_utils import run as run_emission
|
|
10
4
|
|
|
11
5
|
REQUIREMENTS = {
|
|
12
6
|
"Cycle": {
|
|
13
|
-
"completeness.excreta": "True",
|
|
14
7
|
"emissions": [
|
|
15
8
|
{"@type": "Emission", "value": "", "term.@id": "no3ToGroundwaterExcreta"},
|
|
16
9
|
{"@type": "Emission", "value": "", "term.@id": "nh3ToAirExcreta"},
|
|
@@ -26,6 +19,12 @@ REQUIREMENTS = {
|
|
|
26
19
|
}
|
|
27
20
|
}
|
|
28
21
|
}
|
|
22
|
+
LOOKUPS = {
|
|
23
|
+
"emission": [
|
|
24
|
+
"IPCC_2019_EF4_FACTORS", "IPCC_2019_EF4_FACTORS-max", "IPCC_2019_EF4_FACTORS-min",
|
|
25
|
+
"IPCC_2019_EF5_FACTORS", "IPCC_2019_EF5_FACTORS-max", "IPCC_2019_EF5_FACTORS-min"
|
|
26
|
+
]
|
|
27
|
+
}
|
|
29
28
|
RETURNS = {
|
|
30
29
|
"Emission": [{
|
|
31
30
|
"value": "",
|
|
@@ -34,67 +33,11 @@ RETURNS = {
|
|
|
34
33
|
}
|
|
35
34
|
TERM_ID = 'n2OToAirExcretaIndirect'
|
|
36
35
|
TIER = EmissionMethodTier.TIER_1.value
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
def _emission(value: float, min: float, max: float, aggregated: bool = False):
|
|
43
|
-
emission = _new_emission(TERM_ID, MODEL)
|
|
44
|
-
emission['value'] = [value]
|
|
45
|
-
emission['min'] = [min]
|
|
46
|
-
emission['max'] = [max]
|
|
47
|
-
emission['methodTier'] = TIER
|
|
48
|
-
emission['statsDefinition'] = EmissionStatsDefinition.MODELLED.value
|
|
49
|
-
emission['methodModelDescription'] = 'Aggregated version' if aggregated else 'Disaggregated version'
|
|
50
|
-
return emission
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
def _run(cycle: dict, no3: float, nh3: float, nox: float):
|
|
54
|
-
ecoClimateZone = get_ecoClimateZone(cycle)
|
|
55
|
-
|
|
56
|
-
ef4, aggregated = ecoClimate_factors(EF4_FACTORS, ecoClimateZone=ecoClimateZone)
|
|
57
|
-
ef5 = EF5_FACTORS.get('default')
|
|
58
|
-
|
|
59
|
-
debugValues(cycle, model=MODEL, term=TERM_ID,
|
|
60
|
-
ecoClimateZone=ecoClimateZone,
|
|
61
|
-
ef4_factors_used=log_as_table(ef4),
|
|
62
|
-
ef5_factors_used=log_as_table(ef5),
|
|
63
|
-
aggregated=aggregated)
|
|
64
|
-
|
|
65
|
-
value = sum([
|
|
66
|
-
no3 * ef5['value'],
|
|
67
|
-
nh3 * ef4['value'],
|
|
68
|
-
nox * ef4['value']
|
|
69
|
-
]) * get_atomic_conversion(Units.KG_N2O, Units.TO_N)
|
|
70
|
-
min = sum([
|
|
71
|
-
no3 * ef5['min'],
|
|
72
|
-
nh3 * ef4['min'],
|
|
73
|
-
nox * ef4['min']
|
|
74
|
-
]) * get_atomic_conversion(Units.KG_N2O, Units.TO_N)
|
|
75
|
-
max = sum([
|
|
76
|
-
no3 * ef5['max'],
|
|
77
|
-
nh3 * ef4['max'],
|
|
78
|
-
nox * ef4['max']
|
|
79
|
-
]) * get_atomic_conversion(Units.KG_N2O, Units.TO_N)
|
|
80
|
-
return [_emission(value, min, max, aggregated=aggregated)]
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
def _should_run(cycle: dict):
|
|
84
|
-
nh3_n, no3_n, nox_n = get_nh3_no3_nox_to_n(cycle, NH3_TERM_ID, NO3_TERM_ID, NOX_TERM_ID)
|
|
85
|
-
term_type_complete = _is_term_type_complete(cycle, TermTermType.EXCRETA)
|
|
86
|
-
|
|
87
|
-
logRequirements(cycle, model=MODEL, term=TERM_ID,
|
|
88
|
-
no3_n=no3_n,
|
|
89
|
-
nh3_n=nh3_n,
|
|
90
|
-
nox_n=nox_n,
|
|
91
|
-
term_type_excreta_complete=term_type_complete)
|
|
92
|
-
|
|
93
|
-
should_run = all([no3_n is not None, nh3_n is not None, nox_n is not None, term_type_complete])
|
|
94
|
-
logShouldRun(cycle, MODEL, TERM_ID, should_run, methodTier=TIER)
|
|
95
|
-
return should_run, no3_n, nh3_n, nox_n
|
|
36
|
+
_NO3_TERM_ID = 'no3ToGroundwaterExcreta'
|
|
37
|
+
_NH3_TERM_ID = 'nh3ToAirExcreta'
|
|
38
|
+
_NOX_TERM_ID = 'noxToAirExcreta'
|
|
39
|
+
_EMISSION_IDS = [_NH3_TERM_ID, _NO3_TERM_ID, _NOX_TERM_ID]
|
|
96
40
|
|
|
97
41
|
|
|
98
42
|
def run(cycle: dict):
|
|
99
|
-
|
|
100
|
-
return _run(cycle, no3, nh3, nox) if should_run else []
|
|
43
|
+
return run_emission(TERM_ID, _EMISSION_IDS, cycle)
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
from hestia_earth.schema import EmissionMethodTier
|
|
2
|
+
|
|
3
|
+
from .n2OToAir_indirect_emissions_utils import run as run_emission
|
|
4
|
+
|
|
5
|
+
REQUIREMENTS = {
|
|
6
|
+
"Cycle": {
|
|
7
|
+
"completeness.electricityFuel": "True",
|
|
8
|
+
"emissions": [
|
|
9
|
+
{"@type": "Emission", "value": "", "term.@id": "nh3ToAirFuelCombustion"},
|
|
10
|
+
{"@type": "Emission", "value": "", "term.@id": "noxToAirFuelCombustion"}
|
|
11
|
+
],
|
|
12
|
+
"optional": {
|
|
13
|
+
"site": {
|
|
14
|
+
"@type": "Site",
|
|
15
|
+
"measurements": [
|
|
16
|
+
{"@type": "Measurement", "value": "", "term.@id": "ecoClimateZone"}
|
|
17
|
+
]
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
LOOKUPS = {
|
|
23
|
+
"emission": [
|
|
24
|
+
"IPCC_2019_EF4_FACTORS", "IPCC_2019_EF4_FACTORS-max", "IPCC_2019_EF4_FACTORS-min",
|
|
25
|
+
"IPCC_2019_EF5_FACTORS", "IPCC_2019_EF5_FACTORS-max", "IPCC_2019_EF5_FACTORS-min"
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
RETURNS = {
|
|
29
|
+
"Emission": [{
|
|
30
|
+
"value": "",
|
|
31
|
+
"methodTier": "tier 1"
|
|
32
|
+
}]
|
|
33
|
+
}
|
|
34
|
+
TERM_ID = 'n2OToAirFuelCombustionIndirect'
|
|
35
|
+
TIER = EmissionMethodTier.TIER_1.value
|
|
36
|
+
_NO3_TERM_ID = None
|
|
37
|
+
_NH3_TERM_ID = 'nh3ToAirFuelCombustion'
|
|
38
|
+
_NOX_TERM_ID = 'noxToAirFuelCombustion'
|
|
39
|
+
_EMISSION_IDS = [_NH3_TERM_ID, _NO3_TERM_ID, _NOX_TERM_ID]
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def run(cycle: dict):
|
|
43
|
+
return run_emission(TERM_ID, _EMISSION_IDS, cycle)
|
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
from hestia_earth.schema import EmissionMethodTier
|
|
1
|
+
from hestia_earth.schema import EmissionMethodTier
|
|
2
2
|
|
|
3
|
-
from
|
|
4
|
-
from hestia_earth.models.utils.constant import Units, get_atomic_conversion
|
|
5
|
-
from hestia_earth.models.utils.completeness import _is_term_type_complete
|
|
6
|
-
from hestia_earth.models.utils.emission import _new_emission, get_nh3_no3_nox_to_n
|
|
7
|
-
from hestia_earth.models.utils.cycle import get_ecoClimateZone
|
|
8
|
-
from .utils import ecoClimate_factors, EF4_FACTORS, EF5_FACTORS
|
|
9
|
-
from . import MODEL
|
|
3
|
+
from .n2OToAir_indirect_emissions_utils import run as run_emission
|
|
10
4
|
|
|
11
5
|
REQUIREMENTS = {
|
|
12
6
|
"Cycle": {
|
|
13
|
-
"completeness.fertiliser": "True",
|
|
14
7
|
"emissions": [
|
|
15
8
|
{"@type": "Emission", "value": "", "term.@id": "no3ToGroundwaterInorganicFertiliser"},
|
|
16
9
|
{"@type": "Emission", "value": "", "term.@id": "nh3ToAirInorganicFertiliser"},
|
|
@@ -26,6 +19,12 @@ REQUIREMENTS = {
|
|
|
26
19
|
}
|
|
27
20
|
}
|
|
28
21
|
}
|
|
22
|
+
LOOKUPS = {
|
|
23
|
+
"emission": [
|
|
24
|
+
"IPCC_2019_EF4_FACTORS", "IPCC_2019_EF4_FACTORS-max", "IPCC_2019_EF4_FACTORS-min",
|
|
25
|
+
"IPCC_2019_EF5_FACTORS", "IPCC_2019_EF5_FACTORS-max", "IPCC_2019_EF5_FACTORS-min"
|
|
26
|
+
]
|
|
27
|
+
}
|
|
29
28
|
RETURNS = {
|
|
30
29
|
"Emission": [{
|
|
31
30
|
"value": "",
|
|
@@ -34,67 +33,11 @@ RETURNS = {
|
|
|
34
33
|
}
|
|
35
34
|
TERM_ID = 'n2OToAirInorganicFertiliserIndirect'
|
|
36
35
|
TIER = EmissionMethodTier.TIER_1.value
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
def _emission(value: float, min: float, max: float, aggregated: bool = False):
|
|
43
|
-
emission = _new_emission(TERM_ID, MODEL)
|
|
44
|
-
emission['value'] = [value]
|
|
45
|
-
emission['min'] = [min]
|
|
46
|
-
emission['max'] = [max]
|
|
47
|
-
emission['methodTier'] = TIER
|
|
48
|
-
emission['statsDefinition'] = EmissionStatsDefinition.MODELLED.value
|
|
49
|
-
emission['methodModelDescription'] = 'Aggregated version' if aggregated else 'Disaggregated version'
|
|
50
|
-
return emission
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
def _run(cycle: dict, no3: float, nh3: float, nox: float):
|
|
54
|
-
ecoClimateZone = get_ecoClimateZone(cycle)
|
|
55
|
-
|
|
56
|
-
ef4, aggregated = ecoClimate_factors(EF4_FACTORS, ecoClimateZone=ecoClimateZone)
|
|
57
|
-
ef5 = EF5_FACTORS.get('default')
|
|
58
|
-
|
|
59
|
-
debugValues(cycle, model=MODEL, term=TERM_ID,
|
|
60
|
-
ecoClimateZone=ecoClimateZone,
|
|
61
|
-
ef4_factors_used=log_as_table(ef4),
|
|
62
|
-
ef5_factors_used=log_as_table(ef5),
|
|
63
|
-
aggregated=aggregated)
|
|
64
|
-
|
|
65
|
-
value = sum([
|
|
66
|
-
no3 * ef5['value'],
|
|
67
|
-
nh3 * ef4['value'],
|
|
68
|
-
nox * ef4['value']
|
|
69
|
-
]) * get_atomic_conversion(Units.KG_N2O, Units.TO_N)
|
|
70
|
-
min = sum([
|
|
71
|
-
no3 * ef5['min'],
|
|
72
|
-
nh3 * ef4['min'],
|
|
73
|
-
nox * ef4['min']
|
|
74
|
-
]) * get_atomic_conversion(Units.KG_N2O, Units.TO_N)
|
|
75
|
-
max = sum([
|
|
76
|
-
no3 * ef5['max'],
|
|
77
|
-
nh3 * ef4['max'],
|
|
78
|
-
nox * ef4['max']
|
|
79
|
-
]) * get_atomic_conversion(Units.KG_N2O, Units.TO_N)
|
|
80
|
-
return [_emission(value, min, max, aggregated=aggregated)]
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
def _should_run(cycle: dict):
|
|
84
|
-
nh3_n, no3_n, nox_n = get_nh3_no3_nox_to_n(cycle, NH3_TERM_ID, NO3_TERM_ID, NOX_TERM_ID)
|
|
85
|
-
term_type_complete = _is_term_type_complete(cycle, 'fertiliser')
|
|
86
|
-
|
|
87
|
-
logRequirements(cycle, model=MODEL, term=TERM_ID,
|
|
88
|
-
no3_n=no3_n,
|
|
89
|
-
nh3_n=nh3_n,
|
|
90
|
-
nox_n=nox_n,
|
|
91
|
-
term_type_fertiliser_complete=term_type_complete)
|
|
92
|
-
|
|
93
|
-
should_run = all([no3_n is not None, nh3_n is not None, nox_n is not None, term_type_complete])
|
|
94
|
-
logShouldRun(cycle, MODEL, TERM_ID, should_run, methodTier=TIER)
|
|
95
|
-
return should_run, no3_n, nh3_n, nox_n
|
|
36
|
+
_NO3_TERM_ID = 'no3ToGroundwaterInorganicFertiliser'
|
|
37
|
+
_NH3_TERM_ID = 'nh3ToAirInorganicFertiliser'
|
|
38
|
+
_NOX_TERM_ID = 'noxToAirInorganicFertiliser'
|
|
39
|
+
_EMISSION_IDS = [_NH3_TERM_ID, _NO3_TERM_ID, _NOX_TERM_ID]
|
|
96
40
|
|
|
97
41
|
|
|
98
42
|
def run(cycle: dict):
|
|
99
|
-
|
|
100
|
-
return _run(cycle, no3, nh3, nox) if should_run else []
|
|
43
|
+
return run_emission(TERM_ID, _EMISSION_IDS, cycle)
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
from hestia_earth.schema import EmissionMethodTier
|
|
2
|
+
|
|
3
|
+
from .n2OToAir_indirect_emissions_utils import run as run_emission
|
|
4
|
+
|
|
5
|
+
REQUIREMENTS = {
|
|
6
|
+
"Cycle": {
|
|
7
|
+
"completeness.cropResidue": "True",
|
|
8
|
+
"emissions": [
|
|
9
|
+
{"@type": "Emission", "value": "", "term.@id": "nh3ToAirNaturalVegetationBurning"},
|
|
10
|
+
{"@type": "Emission", "value": "", "term.@id": "noxToAirNaturalVegetationBurning"}
|
|
11
|
+
],
|
|
12
|
+
"optional": {
|
|
13
|
+
"site": {
|
|
14
|
+
"@type": "Site",
|
|
15
|
+
"measurements": [
|
|
16
|
+
{"@type": "Measurement", "value": "", "term.@id": "ecoClimateZone"}
|
|
17
|
+
]
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
LOOKUPS = {
|
|
23
|
+
"emission": [
|
|
24
|
+
"IPCC_2019_EF4_FACTORS", "IPCC_2019_EF4_FACTORS-max", "IPCC_2019_EF4_FACTORS-min",
|
|
25
|
+
"IPCC_2019_EF5_FACTORS", "IPCC_2019_EF5_FACTORS-max", "IPCC_2019_EF5_FACTORS-min"
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
RETURNS = {
|
|
29
|
+
"Emission": [{
|
|
30
|
+
"value": "",
|
|
31
|
+
"methodTier": "tier 1"
|
|
32
|
+
}]
|
|
33
|
+
}
|
|
34
|
+
TERM_ID = 'n2OToAirNaturalVegetationBurningIndirect'
|
|
35
|
+
TIER = EmissionMethodTier.TIER_1.value
|
|
36
|
+
_NO3_TERM_ID = None
|
|
37
|
+
_NH3_TERM_ID = 'nh3ToAirNaturalVegetationBurning'
|
|
38
|
+
_NOX_TERM_ID = 'noxToAirNaturalVegetationBurning'
|
|
39
|
+
_EMISSION_IDS = [_NH3_TERM_ID, _NO3_TERM_ID, _NOX_TERM_ID]
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def run(cycle: dict):
|
|
43
|
+
return run_emission(TERM_ID, _EMISSION_IDS, cycle)
|
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
from hestia_earth.schema import EmissionMethodTier
|
|
1
|
+
from hestia_earth.schema import EmissionMethodTier
|
|
2
2
|
|
|
3
|
-
from
|
|
4
|
-
from hestia_earth.models.utils.constant import Units, get_atomic_conversion
|
|
5
|
-
from hestia_earth.models.utils.completeness import _is_term_type_complete
|
|
6
|
-
from hestia_earth.models.utils.emission import _new_emission, get_nh3_no3_nox_to_n
|
|
7
|
-
from hestia_earth.models.utils.cycle import get_ecoClimateZone
|
|
8
|
-
from .utils import ecoClimate_factors, EF4_FACTORS, EF5_FACTORS
|
|
9
|
-
from . import MODEL
|
|
3
|
+
from .n2OToAir_indirect_emissions_utils import run as run_emission
|
|
10
4
|
|
|
11
5
|
REQUIREMENTS = {
|
|
12
6
|
"Cycle": {
|
|
13
|
-
"completeness.fertiliser": "True",
|
|
14
7
|
"emissions": [
|
|
15
8
|
{"@type": "Emission", "value": "", "term.@id": "no3ToGroundwaterOrganicFertiliser"},
|
|
16
9
|
{"@type": "Emission", "value": "", "term.@id": "nh3ToAirOrganicFertiliser"},
|
|
@@ -26,6 +19,12 @@ REQUIREMENTS = {
|
|
|
26
19
|
}
|
|
27
20
|
}
|
|
28
21
|
}
|
|
22
|
+
LOOKUPS = {
|
|
23
|
+
"emission": [
|
|
24
|
+
"IPCC_2019_EF4_FACTORS", "IPCC_2019_EF4_FACTORS-max", "IPCC_2019_EF4_FACTORS-min",
|
|
25
|
+
"IPCC_2019_EF5_FACTORS", "IPCC_2019_EF5_FACTORS-max", "IPCC_2019_EF5_FACTORS-min"
|
|
26
|
+
]
|
|
27
|
+
}
|
|
29
28
|
RETURNS = {
|
|
30
29
|
"Emission": [{
|
|
31
30
|
"value": "",
|
|
@@ -34,67 +33,11 @@ RETURNS = {
|
|
|
34
33
|
}
|
|
35
34
|
TERM_ID = 'n2OToAirOrganicFertiliserIndirect'
|
|
36
35
|
TIER = EmissionMethodTier.TIER_1.value
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
def _emission(value: float, min: float, max: float, aggregated: bool = False):
|
|
43
|
-
emission = _new_emission(TERM_ID, MODEL)
|
|
44
|
-
emission['value'] = [value]
|
|
45
|
-
emission['min'] = [min]
|
|
46
|
-
emission['max'] = [max]
|
|
47
|
-
emission['methodTier'] = TIER
|
|
48
|
-
emission['statsDefinition'] = EmissionStatsDefinition.MODELLED.value
|
|
49
|
-
emission['methodModelDescription'] = 'Aggregated version' if aggregated else 'Disaggregated version'
|
|
50
|
-
return emission
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
def _run(cycle: dict, no3: float, nh3: float, nox: float):
|
|
54
|
-
ecoClimateZone = get_ecoClimateZone(cycle)
|
|
55
|
-
|
|
56
|
-
ef4, aggregated = ecoClimate_factors(EF4_FACTORS, ecoClimateZone=ecoClimateZone)
|
|
57
|
-
ef5 = EF5_FACTORS.get('default')
|
|
58
|
-
|
|
59
|
-
debugValues(cycle, model=MODEL, term=TERM_ID,
|
|
60
|
-
ecoClimateZone=ecoClimateZone,
|
|
61
|
-
ef4_factors_used=log_as_table(ef4),
|
|
62
|
-
ef5_factors_used=log_as_table(ef5),
|
|
63
|
-
aggregated=aggregated)
|
|
64
|
-
|
|
65
|
-
value = sum([
|
|
66
|
-
no3 * ef5['value'],
|
|
67
|
-
nh3 * ef4['value'],
|
|
68
|
-
nox * ef4['value']
|
|
69
|
-
]) * get_atomic_conversion(Units.KG_N2O, Units.TO_N)
|
|
70
|
-
min = sum([
|
|
71
|
-
no3 * ef5['min'],
|
|
72
|
-
nh3 * ef4['min'],
|
|
73
|
-
nox * ef4['min']
|
|
74
|
-
]) * get_atomic_conversion(Units.KG_N2O, Units.TO_N)
|
|
75
|
-
max = sum([
|
|
76
|
-
no3 * ef5['max'],
|
|
77
|
-
nh3 * ef4['max'],
|
|
78
|
-
nox * ef4['max']
|
|
79
|
-
]) * get_atomic_conversion(Units.KG_N2O, Units.TO_N)
|
|
80
|
-
return [_emission(value, min, max, aggregated=aggregated)]
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
def _should_run(cycle: dict):
|
|
84
|
-
nh3_n, no3_n, nox_n = get_nh3_no3_nox_to_n(cycle, NH3_TERM_ID, NO3_TERM_ID, NOX_TERM_ID)
|
|
85
|
-
term_type_complete = _is_term_type_complete(cycle, 'fertiliser')
|
|
86
|
-
|
|
87
|
-
logRequirements(cycle, model=MODEL, term=TERM_ID,
|
|
88
|
-
no3_n=no3_n,
|
|
89
|
-
nh3_n=nh3_n,
|
|
90
|
-
nox_n=nox_n,
|
|
91
|
-
term_type_fertiliser_complete=term_type_complete)
|
|
92
|
-
|
|
93
|
-
should_run = all([no3_n is not None, nh3_n is not None, nox_n is not None, term_type_complete])
|
|
94
|
-
logShouldRun(cycle, MODEL, TERM_ID, should_run, methodTier=TIER)
|
|
95
|
-
return should_run, no3_n, nh3_n, nox_n
|
|
36
|
+
_NO3_TERM_ID = 'no3ToGroundwaterOrganicFertiliser'
|
|
37
|
+
_NH3_TERM_ID = 'nh3ToAirOrganicFertiliser'
|
|
38
|
+
_NOX_TERM_ID = 'noxToAirOrganicFertiliser'
|
|
39
|
+
_EMISSION_IDS = [_NH3_TERM_ID, _NO3_TERM_ID, _NOX_TERM_ID]
|
|
96
40
|
|
|
97
41
|
|
|
98
42
|
def run(cycle: dict):
|
|
99
|
-
|
|
100
|
-
return _run(cycle, no3, nh3, nox) if should_run else []
|
|
43
|
+
return run_emission(TERM_ID, _EMISSION_IDS, cycle)
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
from hestia_earth.schema import EmissionMethodTier
|
|
2
|
+
|
|
3
|
+
from .n2OToAir_indirect_emissions_utils import run as run_emission
|
|
4
|
+
|
|
5
|
+
REQUIREMENTS = {
|
|
6
|
+
"Cycle": {
|
|
7
|
+
"completeness.cropResidue": "True",
|
|
8
|
+
"emissions": [
|
|
9
|
+
{"@type": "Emission", "value": "", "term.@id": "nh3ToAirOrganicSoilBurning"},
|
|
10
|
+
{"@type": "Emission", "value": "", "term.@id": "noxToAirOrganicSoilBurning"}
|
|
11
|
+
],
|
|
12
|
+
"optional": {
|
|
13
|
+
"site": {
|
|
14
|
+
"@type": "Site",
|
|
15
|
+
"measurements": [
|
|
16
|
+
{"@type": "Measurement", "value": "", "term.@id": "ecoClimateZone"}
|
|
17
|
+
]
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
LOOKUPS = {
|
|
23
|
+
"emission": [
|
|
24
|
+
"IPCC_2019_EF4_FACTORS", "IPCC_2019_EF4_FACTORS-max", "IPCC_2019_EF4_FACTORS-min",
|
|
25
|
+
"IPCC_2019_EF5_FACTORS", "IPCC_2019_EF5_FACTORS-max", "IPCC_2019_EF5_FACTORS-min"
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
RETURNS = {
|
|
29
|
+
"Emission": [{
|
|
30
|
+
"value": "",
|
|
31
|
+
"methodTier": "tier 1"
|
|
32
|
+
}]
|
|
33
|
+
}
|
|
34
|
+
TERM_ID = 'n2OToAirOrganicSoilBurningIndirect'
|
|
35
|
+
TIER = EmissionMethodTier.TIER_1.value
|
|
36
|
+
_NO3_TERM_ID = None
|
|
37
|
+
_NH3_TERM_ID = 'nh3ToAirOrganicSoilBurning'
|
|
38
|
+
_NOX_TERM_ID = 'noxToAirOrganicSoilBurning'
|
|
39
|
+
_EMISSION_IDS = [_NH3_TERM_ID, _NO3_TERM_ID, _NOX_TERM_ID]
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def run(cycle: dict):
|
|
43
|
+
return run_emission(TERM_ID, _EMISSION_IDS, cycle)
|