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
|
@@ -2,40 +2,14 @@ from unittest.mock import patch
|
|
|
2
2
|
import json
|
|
3
3
|
from tests.utils import fixtures_path, fake_new_emission
|
|
4
4
|
|
|
5
|
-
from hestia_earth.models.ipcc2019
|
|
6
|
-
|
|
7
|
-
)
|
|
5
|
+
from hestia_earth.models.ipcc2019 import MODEL
|
|
6
|
+
from hestia_earth.models.ipcc2019.n2OToAirInorganicFertiliserIndirect import TERM_ID, run
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
utils_path = f"hestia_earth.models.{MODEL}.n2OToAir_indirect_emissions_utils"
|
|
10
9
|
fixtures_folder = f"{fixtures_path}/{MODEL}/{TERM_ID}"
|
|
11
10
|
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
# no emissions => no run
|
|
15
|
-
cycle = {'completeness': {'fertiliser': True}, 'emissions': []}
|
|
16
|
-
should_run, *args = _should_run(cycle)
|
|
17
|
-
assert not should_run
|
|
18
|
-
|
|
19
|
-
# with no3 emission => run
|
|
20
|
-
cycle['emissions'] = [
|
|
21
|
-
{
|
|
22
|
-
'term': {'@id': NO3_TERM_ID},
|
|
23
|
-
'value': [100]
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
'term': {'@id': NH3_TERM_ID},
|
|
27
|
-
'value': [100]
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
'term': {'@id': NOX_TERM_ID},
|
|
31
|
-
'value': [100]
|
|
32
|
-
}
|
|
33
|
-
]
|
|
34
|
-
should_run, *args = _should_run(cycle)
|
|
35
|
-
assert should_run is True
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
@patch(f"{class_path}._new_emission", side_effect=fake_new_emission)
|
|
12
|
+
@patch(f"{utils_path}._new_emission", side_effect=fake_new_emission)
|
|
39
13
|
def test_run(*args):
|
|
40
14
|
with open(f"{fixtures_folder}/cycle.jsonld", encoding='utf-8') as f:
|
|
41
15
|
cycle = json.load(f)
|
|
@@ -47,7 +21,7 @@ def test_run(*args):
|
|
|
47
21
|
assert value == expected
|
|
48
22
|
|
|
49
23
|
|
|
50
|
-
@patch(f"{
|
|
24
|
+
@patch(f"{utils_path}._new_emission", side_effect=fake_new_emission)
|
|
51
25
|
def test_run_wet(*args):
|
|
52
26
|
with open(f"{fixtures_folder}/ecoClimateZone-wet/cycle.jsonld", encoding='utf-8') as f:
|
|
53
27
|
cycle = json.load(f)
|
|
@@ -59,7 +33,7 @@ def test_run_wet(*args):
|
|
|
59
33
|
assert value == expected
|
|
60
34
|
|
|
61
35
|
|
|
62
|
-
@patch(f"{
|
|
36
|
+
@patch(f"{utils_path}._new_emission", side_effect=fake_new_emission)
|
|
63
37
|
def test_run_dry(*args):
|
|
64
38
|
with open(f"{fixtures_folder}/ecoClimateZone-dry/cycle.jsonld", encoding='utf-8') as f:
|
|
65
39
|
cycle = json.load(f)
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
from unittest.mock import patch
|
|
2
|
+
import json
|
|
3
|
+
from tests.utils import fixtures_path, fake_new_emission
|
|
4
|
+
|
|
5
|
+
from hestia_earth.models.ipcc2019 import MODEL
|
|
6
|
+
from hestia_earth.models.ipcc2019.n2OToAirNaturalVegetationBurningIndirect import TERM_ID, run
|
|
7
|
+
|
|
8
|
+
utils_path = f"hestia_earth.models.{MODEL}.n2OToAir_indirect_emissions_utils"
|
|
9
|
+
fixtures_folder = f"{fixtures_path}/{MODEL}/{TERM_ID}"
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@patch(f"{utils_path}._new_emission", side_effect=fake_new_emission)
|
|
13
|
+
def test_run(*args):
|
|
14
|
+
with open(f"{fixtures_folder}/cycle.jsonld", encoding='utf-8') as f:
|
|
15
|
+
cycle = json.load(f)
|
|
16
|
+
|
|
17
|
+
with open(f"{fixtures_folder}/result.jsonld", encoding='utf-8') as f:
|
|
18
|
+
expected = json.load(f)
|
|
19
|
+
|
|
20
|
+
value = run(cycle)
|
|
21
|
+
assert value == expected
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@patch(f"{utils_path}._new_emission", side_effect=fake_new_emission)
|
|
25
|
+
def test_run_wet(*args):
|
|
26
|
+
with open(f"{fixtures_folder}/ecoClimateZone-wet/cycle.jsonld", encoding='utf-8') as f:
|
|
27
|
+
cycle = json.load(f)
|
|
28
|
+
|
|
29
|
+
with open(f"{fixtures_folder}/ecoClimateZone-wet/result.jsonld", encoding='utf-8') as f:
|
|
30
|
+
expected = json.load(f)
|
|
31
|
+
|
|
32
|
+
value = run(cycle)
|
|
33
|
+
assert value == expected
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@patch(f"{utils_path}._new_emission", side_effect=fake_new_emission)
|
|
37
|
+
def test_run_dry(*args):
|
|
38
|
+
with open(f"{fixtures_folder}/ecoClimateZone-dry/cycle.jsonld", encoding='utf-8') as f:
|
|
39
|
+
cycle = json.load(f)
|
|
40
|
+
|
|
41
|
+
with open(f"{fixtures_folder}/ecoClimateZone-dry/result.jsonld", encoding='utf-8') as f:
|
|
42
|
+
expected = json.load(f)
|
|
43
|
+
|
|
44
|
+
value = run(cycle)
|
|
45
|
+
assert value == expected
|
|
@@ -2,40 +2,14 @@ from unittest.mock import patch
|
|
|
2
2
|
import json
|
|
3
3
|
from tests.utils import fixtures_path, fake_new_emission
|
|
4
4
|
|
|
5
|
-
from hestia_earth.models.ipcc2019
|
|
6
|
-
|
|
7
|
-
)
|
|
5
|
+
from hestia_earth.models.ipcc2019 import MODEL
|
|
6
|
+
from hestia_earth.models.ipcc2019.n2OToAirOrganicFertiliserIndirect import TERM_ID, run
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
utils_path = f"hestia_earth.models.{MODEL}.n2OToAir_indirect_emissions_utils"
|
|
10
9
|
fixtures_folder = f"{fixtures_path}/{MODEL}/{TERM_ID}"
|
|
11
10
|
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
# no emissions => no run
|
|
15
|
-
cycle = {'completeness': {'fertiliser': True}, 'emissions': []}
|
|
16
|
-
should_run, *args = _should_run(cycle)
|
|
17
|
-
assert not should_run
|
|
18
|
-
|
|
19
|
-
# with no3 emission => run
|
|
20
|
-
cycle['emissions'] = [
|
|
21
|
-
{
|
|
22
|
-
'term': {'@id': NO3_TERM_ID},
|
|
23
|
-
'value': [100]
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
'term': {'@id': NH3_TERM_ID},
|
|
27
|
-
'value': [100]
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
'term': {'@id': NOX_TERM_ID},
|
|
31
|
-
'value': [100]
|
|
32
|
-
}
|
|
33
|
-
]
|
|
34
|
-
should_run, *args = _should_run(cycle)
|
|
35
|
-
assert should_run is True
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
@patch(f"{class_path}._new_emission", side_effect=fake_new_emission)
|
|
12
|
+
@patch(f"{utils_path}._new_emission", side_effect=fake_new_emission)
|
|
39
13
|
def test_run(*args):
|
|
40
14
|
with open(f"{fixtures_folder}/cycle.jsonld", encoding='utf-8') as f:
|
|
41
15
|
cycle = json.load(f)
|
|
@@ -47,7 +21,7 @@ def test_run(*args):
|
|
|
47
21
|
assert value == expected
|
|
48
22
|
|
|
49
23
|
|
|
50
|
-
@patch(f"{
|
|
24
|
+
@patch(f"{utils_path}._new_emission", side_effect=fake_new_emission)
|
|
51
25
|
def test_run_wet(*args):
|
|
52
26
|
with open(f"{fixtures_folder}/ecoClimateZone-wet/cycle.jsonld", encoding='utf-8') as f:
|
|
53
27
|
cycle = json.load(f)
|
|
@@ -59,7 +33,7 @@ def test_run_wet(*args):
|
|
|
59
33
|
assert value == expected
|
|
60
34
|
|
|
61
35
|
|
|
62
|
-
@patch(f"{
|
|
36
|
+
@patch(f"{utils_path}._new_emission", side_effect=fake_new_emission)
|
|
63
37
|
def test_run_dry(*args):
|
|
64
38
|
with open(f"{fixtures_folder}/ecoClimateZone-dry/cycle.jsonld", encoding='utf-8') as f:
|
|
65
39
|
cycle = json.load(f)
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
from unittest.mock import patch
|
|
2
|
+
import json
|
|
3
|
+
from tests.utils import fixtures_path, fake_new_emission
|
|
4
|
+
|
|
5
|
+
from hestia_earth.models.ipcc2019 import MODEL
|
|
6
|
+
from hestia_earth.models.ipcc2019.n2OToAirOrganicSoilBurningIndirect import TERM_ID, run
|
|
7
|
+
|
|
8
|
+
utils_path = f"hestia_earth.models.{MODEL}.n2OToAir_indirect_emissions_utils"
|
|
9
|
+
fixtures_folder = f"{fixtures_path}/{MODEL}/{TERM_ID}"
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@patch(f"{utils_path}._new_emission", side_effect=fake_new_emission)
|
|
13
|
+
def test_run(*args):
|
|
14
|
+
with open(f"{fixtures_folder}/cycle.jsonld", encoding='utf-8') as f:
|
|
15
|
+
cycle = json.load(f)
|
|
16
|
+
|
|
17
|
+
with open(f"{fixtures_folder}/result.jsonld", encoding='utf-8') as f:
|
|
18
|
+
expected = json.load(f)
|
|
19
|
+
|
|
20
|
+
value = run(cycle)
|
|
21
|
+
assert value == expected
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@patch(f"{utils_path}._new_emission", side_effect=fake_new_emission)
|
|
25
|
+
def test_run_wet(*args):
|
|
26
|
+
with open(f"{fixtures_folder}/ecoClimateZone-wet/cycle.jsonld", encoding='utf-8') as f:
|
|
27
|
+
cycle = json.load(f)
|
|
28
|
+
|
|
29
|
+
with open(f"{fixtures_folder}/ecoClimateZone-wet/result.jsonld", encoding='utf-8') as f:
|
|
30
|
+
expected = json.load(f)
|
|
31
|
+
|
|
32
|
+
value = run(cycle)
|
|
33
|
+
assert value == expected
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@patch(f"{utils_path}._new_emission", side_effect=fake_new_emission)
|
|
37
|
+
def test_run_dry(*args):
|
|
38
|
+
with open(f"{fixtures_folder}/ecoClimateZone-dry/cycle.jsonld", encoding='utf-8') as f:
|
|
39
|
+
cycle = json.load(f)
|
|
40
|
+
|
|
41
|
+
with open(f"{fixtures_folder}/ecoClimateZone-dry/result.jsonld", encoding='utf-8') as f:
|
|
42
|
+
expected = json.load(f)
|
|
43
|
+
|
|
44
|
+
value = run(cycle)
|
|
45
|
+
assert value == expected
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
from unittest.mock import patch
|
|
2
|
+
import json
|
|
3
|
+
from tests.utils import fixtures_path, fake_new_emission
|
|
4
|
+
|
|
5
|
+
from hestia_earth.models.ipcc2019 import MODEL
|
|
6
|
+
from hestia_earth.models.ipcc2019.n2OToAirOrganicSoilCultivationIndirect import TERM_ID, run
|
|
7
|
+
|
|
8
|
+
utils_path = f"hestia_earth.models.{MODEL}.n2OToAir_indirect_emissions_utils"
|
|
9
|
+
fixtures_folder = f"{fixtures_path}/{MODEL}/{TERM_ID}"
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@patch(f"{utils_path}._new_emission", side_effect=fake_new_emission)
|
|
13
|
+
def test_run(*args):
|
|
14
|
+
with open(f"{fixtures_folder}/cycle.jsonld", encoding='utf-8') as f:
|
|
15
|
+
cycle = json.load(f)
|
|
16
|
+
|
|
17
|
+
with open(f"{fixtures_folder}/result.jsonld", encoding='utf-8') as f:
|
|
18
|
+
expected = json.load(f)
|
|
19
|
+
|
|
20
|
+
value = run(cycle)
|
|
21
|
+
assert value == expected
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@patch(f"{utils_path}._new_emission", side_effect=fake_new_emission)
|
|
25
|
+
def test_run_wet(*args):
|
|
26
|
+
with open(f"{fixtures_folder}/ecoClimateZone-wet/cycle.jsonld", encoding='utf-8') as f:
|
|
27
|
+
cycle = json.load(f)
|
|
28
|
+
|
|
29
|
+
with open(f"{fixtures_folder}/ecoClimateZone-wet/result.jsonld", encoding='utf-8') as f:
|
|
30
|
+
expected = json.load(f)
|
|
31
|
+
|
|
32
|
+
value = run(cycle)
|
|
33
|
+
assert value == expected
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@patch(f"{utils_path}._new_emission", side_effect=fake_new_emission)
|
|
37
|
+
def test_run_dry(*args):
|
|
38
|
+
with open(f"{fixtures_folder}/ecoClimateZone-dry/cycle.jsonld", encoding='utf-8') as f:
|
|
39
|
+
cycle = json.load(f)
|
|
40
|
+
|
|
41
|
+
with open(f"{fixtures_folder}/ecoClimateZone-dry/result.jsonld", encoding='utf-8') as f:
|
|
42
|
+
expected = json.load(f)
|
|
43
|
+
|
|
44
|
+
value = run(cycle)
|
|
45
|
+
assert value == expected
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from hestia_earth.models.ipcc2019.n2OToAir_indirect_emissions_utils import _should_run
|
|
2
|
+
from hestia_earth.models.ipcc2019.n2OToAirCropResidueDecompositionIndirect import _EMISSION_IDS
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def test_should_run():
|
|
6
|
+
# no emissions => no run
|
|
7
|
+
cycle = {'completeness': {'cropResidue': True}, 'emissions': []}
|
|
8
|
+
should_run, *args = _should_run('', _EMISSION_IDS, cycle)
|
|
9
|
+
assert not should_run
|
|
10
|
+
|
|
11
|
+
# with no3 emission => run
|
|
12
|
+
cycle['emissions'] = [
|
|
13
|
+
{
|
|
14
|
+
'term': {'@id': id},
|
|
15
|
+
'value': [100]
|
|
16
|
+
} for id in _EMISSION_IDS
|
|
17
|
+
]
|
|
18
|
+
should_run, *args = _should_run('', _EMISSION_IDS, cycle)
|
|
19
|
+
assert should_run is True
|
|
File without changes
|
|
File without changes
|
|
File without changes
|