hestia-earth-models 0.59.6__py3-none-any.whl → 0.60.0__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/cache_sites.py +8 -8
- hestia_earth/models/cycle/siteDuration.py +1 -1
- hestia_earth/models/emepEea2019/nh3ToAirInorganicFertiliser.py +9 -6
- hestia_earth/models/faostat2018/product/price.py +14 -3
- hestia_earth/models/geospatialDatabase/utils.py +0 -1
- hestia_earth/models/ipcc2019/animal/__init__.py +0 -0
- hestia_earth/models/ipcc2019/animal/pastureGrass.py +298 -0
- hestia_earth/models/ipcc2019/co2ToAirLimeHydrolysis.py +1 -1
- hestia_earth/models/ipcc2019/{co2ToAirSoilCarbonStockChangeManagementChange.py → co2ToAirSoilOrganicCarbonStockChangeManagementChange.py} +2 -2
- hestia_earth/models/ipcc2019/co2ToAirUreaHydrolysis.py +2 -7
- hestia_earth/models/ipcc2019/organicCarbonPerHa.py +7 -2
- hestia_earth/models/ipcc2019/pastureGrass.py +73 -447
- hestia_earth/models/ipcc2019/pastureGrass_utils.py +415 -0
- hestia_earth/models/mocking/search-results.json +215 -207
- hestia_earth/models/site/pre_checks/cache_geospatialDatabase.py +14 -2
- hestia_earth/models/utils/completeness.py +17 -14
- hestia_earth/models/utils/feedipedia.py +23 -23
- hestia_earth/models/utils/property.py +4 -1
- hestia_earth/models/utils/site.py +7 -4
- hestia_earth/models/version.py +1 -1
- {hestia_earth_models-0.59.6.dist-info → hestia_earth_models-0.60.0.dist-info}/LICENSE +1 -1
- {hestia_earth_models-0.59.6.dist-info → hestia_earth_models-0.60.0.dist-info}/METADATA +1 -1
- {hestia_earth_models-0.59.6.dist-info → hestia_earth_models-0.60.0.dist-info}/RECORD +49 -44
- tests/models/cycle/animal/input/test_properties.py +3 -1
- tests/models/cycle/animal/test_properties.py +4 -2
- tests/models/cycle/input/test_properties.py +3 -1
- tests/models/cycle/product/test_properties.py +2 -1
- tests/models/cycle/test_coldCarcassWeightPerHead.py +1 -0
- tests/models/cycle/test_coldDressedCarcassWeightPerHead.py +1 -0
- tests/models/cycle/test_energyContentLowerHeatingValue.py +1 -0
- tests/models/cycle/test_feedConversionRatio.py +10 -0
- tests/models/cycle/test_readyToCookWeightPerHead.py +1 -0
- tests/models/faostat2018/product/test_price.py +15 -3
- tests/models/ipcc2006/test_n2OToAirCropResidueDecompositionDirect.py +4 -1
- tests/models/ipcc2019/animal/__init__.py +0 -0
- tests/models/ipcc2019/animal/test_pastureGrass.py +45 -0
- tests/models/ipcc2019/test_ch4ToAirEntericFermentation.py +32 -8
- tests/models/ipcc2019/{test_co2ToAirSoilCarbonStockChangeManagementChange.py → test_co2ToAirSoilOrganicCarbonStockChangeManagementChange.py} +1 -1
- tests/models/ipcc2019/test_n2OToAirCropResidueDecompositionDirect.py +6 -1
- tests/models/ipcc2019/test_n2OToAirInorganicFertiliserDirect.py +6 -1
- tests/models/ipcc2019/test_n2OToAirOrganicFertiliserDirect.py +6 -1
- tests/models/ipcc2019/test_organicCarbonPerHa.py +95 -40
- tests/models/ipcc2019/test_pastureGrass.py +32 -8
- tests/models/pooreNemecek2018/test_excretaKgN.py +5 -0
- tests/models/pooreNemecek2018/test_excretaKgVs.py +5 -0
- tests/models/pooreNemecek2018/test_no3ToGroundwaterSoilFlux.py +1 -0
- tests/models/test_cache_sites.py +22 -7
- {hestia_earth_models-0.59.6.dist-info → hestia_earth_models-0.60.0.dist-info}/WHEEL +0 -0
- {hestia_earth_models-0.59.6.dist-info → hestia_earth_models-0.60.0.dist-info}/top_level.txt +0 -0
|
@@ -59,6 +59,7 @@ def test_should_run(mock_animal_produced, mock_get_feed, *args):
|
|
|
59
59
|
assert should_run is True
|
|
60
60
|
|
|
61
61
|
|
|
62
|
+
@patch("hestia_earth.models.utils.property.download_hestia", return_value={'units': '%'})
|
|
62
63
|
@patch(f"{class_path}._new_product", side_effect=fake_new_product)
|
|
63
64
|
def test_run(*args):
|
|
64
65
|
with open(f"{fixtures_folder}/cycle.jsonld", encoding='utf-8') as f:
|
|
@@ -71,6 +72,7 @@ def test_run(*args):
|
|
|
71
72
|
assert value == expected
|
|
72
73
|
|
|
73
74
|
|
|
75
|
+
@patch("hestia_earth.models.utils.property.download_hestia", return_value={'units': '%'})
|
|
74
76
|
@patch(f"{class_path}._new_product", side_effect=fake_new_product)
|
|
75
77
|
def test_run_with_liveweight(*args):
|
|
76
78
|
with open(f"{fixtures_folder}/with-liveweight/cycle.jsonld", encoding='utf-8') as f:
|
|
@@ -83,6 +85,7 @@ def test_run_with_liveweight(*args):
|
|
|
83
85
|
assert value == expected
|
|
84
86
|
|
|
85
87
|
|
|
88
|
+
@patch("hestia_earth.models.utils.property.download_hestia", return_value={'units': '%'})
|
|
86
89
|
@patch(f"{class_path}._new_product", side_effect=fake_new_product)
|
|
87
90
|
def test_run_with_carcass(*args):
|
|
88
91
|
with open(f"{fixtures_folder}/with-carcass/cycle.jsonld", encoding='utf-8') as f:
|
|
@@ -95,6 +98,7 @@ def test_run_with_carcass(*args):
|
|
|
95
98
|
assert value == expected
|
|
96
99
|
|
|
97
100
|
|
|
101
|
+
@patch("hestia_earth.models.utils.property.download_hestia", return_value={'units': '%'})
|
|
98
102
|
@patch(f"{class_path}._new_product", side_effect=fake_new_product)
|
|
99
103
|
def test_run_with_head(*args):
|
|
100
104
|
with open(f"{fixtures_folder}/with-head/cycle.jsonld", encoding='utf-8') as f:
|
|
@@ -107,6 +111,7 @@ def test_run_with_head(*args):
|
|
|
107
111
|
assert value == expected
|
|
108
112
|
|
|
109
113
|
|
|
114
|
+
@patch("hestia_earth.models.utils.property.download_hestia", return_value={'units': '%'})
|
|
110
115
|
@patch(f"{class_path}._new_product", side_effect=fake_new_product)
|
|
111
116
|
def test_run_with_liveAquaticSpecies(*args):
|
|
112
117
|
with open(f"{fixtures_folder}/with-liveAquaticSpecies/cycle.jsonld", encoding='utf-8') as f:
|
|
@@ -8,6 +8,7 @@ class_path = f"hestia_earth.models.{MODEL}.excretaKgVs"
|
|
|
8
8
|
fixtures_folder = f"{fixtures_path}/{MODEL}/excretaKgVs"
|
|
9
9
|
|
|
10
10
|
|
|
11
|
+
@patch(f"{class_path}.get_node_property", return_value={'value': 1490.6951744738524})
|
|
11
12
|
@patch(f"{class_path}.convert_to_carbon", return_value=5)
|
|
12
13
|
@patch(f"{class_path}._get_carbonContent", return_value=5)
|
|
13
14
|
@patch(f"{class_path}._get_conv_aq_ocsed", return_value=0.35)
|
|
@@ -78,6 +79,8 @@ def test_should_run(*args):
|
|
|
78
79
|
assert should_run is True
|
|
79
80
|
|
|
80
81
|
|
|
82
|
+
@patch("hestia_earth.models.utils.property.download_hestia", return_value={'units': '%'})
|
|
83
|
+
@patch(f"{class_path}.get_node_property", return_value={'value': 1490.6951744738524})
|
|
81
84
|
@patch(f"{class_path}._new_product", side_effect=fake_new_product)
|
|
82
85
|
def test_run(*args):
|
|
83
86
|
with open(f"{fixtures_folder}/cycle.jsonld", encoding='utf-8') as f:
|
|
@@ -90,6 +93,8 @@ def test_run(*args):
|
|
|
90
93
|
assert value == expected
|
|
91
94
|
|
|
92
95
|
|
|
96
|
+
@patch("hestia_earth.models.utils.property.download_hestia", return_value={'units': '%'})
|
|
97
|
+
@patch(f"{class_path}.get_node_property", return_value={'value': 1490.6951744738524})
|
|
93
98
|
@patch(f"{class_path}._new_product", side_effect=fake_new_product)
|
|
94
99
|
def test_run_excretaKgN(*args):
|
|
95
100
|
with open(f"{fixtures_folder}/with-excretaKgN/cycle.jsonld", encoding='utf-8') as f:
|
|
@@ -8,6 +8,7 @@ class_path = f"hestia_earth.models.{MODEL}.{TERM_ID}"
|
|
|
8
8
|
fixtures_folder = f"{fixtures_path}/{MODEL}/{TERM_ID}"
|
|
9
9
|
|
|
10
10
|
|
|
11
|
+
@patch(f"{class_path}.get_rice_paddy_terms", return_value=FLOODED_RICE_TERMS)
|
|
11
12
|
@patch(f"{class_path}.find_primary_product", return_value={'term': {'@id': 'product'}})
|
|
12
13
|
@patch(f"{class_path}.get_crop_residue_decomposition_N_total", return_value=10)
|
|
13
14
|
@patch(f"{class_path}.most_relevant_measurement_value", return_value=0)
|
tests/models/test_cache_sites.py
CHANGED
|
@@ -7,13 +7,14 @@ from hestia_earth.models.cache_sites import run
|
|
|
7
7
|
|
|
8
8
|
class_path = 'hestia_earth.models.cache_sites'
|
|
9
9
|
fixtures_folder = os.path.join(fixtures_path, 'cache_sites')
|
|
10
|
+
coordinates = [{"latitude": 46.47, "longitude": 2.94}]
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
@patch(f"{class_path}._run_query", return_value=[10] * 100)
|
|
13
14
|
def test_run(mock_run_query, *args):
|
|
14
15
|
with open(f"{fixtures_folder}/data.json", encoding='utf-8') as f:
|
|
15
16
|
data = json.load(f)
|
|
16
|
-
with open(f"{fixtures_folder}/
|
|
17
|
+
with open(f"{fixtures_folder}/cache.json", encoding='utf-8') as f:
|
|
17
18
|
cache = json.load(f)
|
|
18
19
|
with open(f"{fixtures_folder}/params.json", encoding='utf-8') as f:
|
|
19
20
|
params = json.load(f)
|
|
@@ -22,9 +23,6 @@ def test_run(mock_run_query, *args):
|
|
|
22
23
|
expected = [site | {'_cache': cache} for site in data.get('nodes', [])]
|
|
23
24
|
assert sites == expected
|
|
24
25
|
|
|
25
|
-
# unique list of coordinates
|
|
26
|
-
coordinates = [{"latitude": 46.47, "longitude": 2.94}]
|
|
27
|
-
|
|
28
26
|
mock_run_query.assert_has_calls([
|
|
29
27
|
call({
|
|
30
28
|
"ee_type": "raster",
|
|
@@ -37,9 +35,15 @@ def test_run(mock_run_query, *args):
|
|
|
37
35
|
"coordinates": coordinates
|
|
38
36
|
})
|
|
39
37
|
])
|
|
40
|
-
mock_run_query.reset_mock()
|
|
41
38
|
|
|
42
|
-
|
|
39
|
+
|
|
40
|
+
@patch(f"{class_path}._run_query", return_value=[10] * 100)
|
|
41
|
+
def test_run_include_region(mock_run_query, *args):
|
|
42
|
+
with open(f"{fixtures_folder}/data.json", encoding='utf-8') as f:
|
|
43
|
+
data = json.load(f)
|
|
44
|
+
with open(f"{fixtures_folder}/params.json", encoding='utf-8') as f:
|
|
45
|
+
params = json.load(f)
|
|
46
|
+
|
|
43
47
|
run(data.get('nodes', []), [2019, 2020], include_region=True)
|
|
44
48
|
mock_run_query.assert_has_calls([
|
|
45
49
|
call({
|
|
@@ -53,4 +57,15 @@ def test_run(mock_run_query, *args):
|
|
|
53
57
|
"coordinates": coordinates
|
|
54
58
|
})
|
|
55
59
|
])
|
|
56
|
-
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
@patch(f"{class_path}._run_query", return_value=[10] * 100)
|
|
63
|
+
def test_run_years_only(*args):
|
|
64
|
+
with open(f"{fixtures_folder}/data.json", encoding='utf-8') as f:
|
|
65
|
+
data = json.load(f)
|
|
66
|
+
with open(f"{fixtures_folder}/years-only/cache.json", encoding='utf-8') as f:
|
|
67
|
+
cache = json.load(f)
|
|
68
|
+
|
|
69
|
+
sites = run(data.get('nodes', []), [2019, 2020], years_only=True)
|
|
70
|
+
expected = [site | {'_cache': cache} for site in data.get('nodes', [])]
|
|
71
|
+
assert sites == expected
|
|
File without changes
|
|
File without changes
|