hestia-earth-models 0.74.14__py3-none-any.whl → 0.74.16__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_nodes.py +9 -6
- hestia_earth/models/config/ImpactAssessment.json +0 -22
- hestia_earth/models/config/Site.json +11 -3
- hestia_earth/models/cycle/completeness/material.py +2 -3
- hestia_earth/models/emepEea2019/fuelCombustion_utils.py +21 -21
- hestia_earth/models/hestia/landOccupationDuringCycle.py +9 -27
- hestia_earth/models/hestia/resourceUse_utils.py +49 -20
- hestia_earth/models/hestia/soilClassification.py +314 -0
- hestia_earth/models/ipcc2019/aboveGroundBiomass.py +5 -15
- hestia_earth/models/ipcc2019/belowGroundBiomass.py +5 -15
- hestia_earth/models/ipcc2019/biocharOrganicCarbonPerHa.py +5 -39
- hestia_earth/models/ipcc2019/ch4ToAirOrganicSoilCultivation.py +5 -5
- hestia_earth/models/ipcc2019/co2ToAirAboveGroundBiomassStockChange.py +10 -15
- hestia_earth/models/ipcc2019/co2ToAirBelowGroundBiomassStockChange.py +11 -16
- hestia_earth/models/ipcc2019/co2ToAirBiocharStockChange.py +7 -17
- hestia_earth/models/ipcc2019/co2ToAirCarbonStockChange_utils.py +123 -74
- hestia_earth/models/ipcc2019/co2ToAirOrganicSoilCultivation.py +4 -5
- hestia_earth/models/ipcc2019/co2ToAirSoilOrganicCarbonStockChange.py +10 -15
- hestia_earth/models/ipcc2019/n2OToAirOrganicSoilCultivationDirect.py +5 -5
- hestia_earth/models/ipcc2019/nonCo2EmissionsToAirNaturalVegetationBurning.py +18 -47
- hestia_earth/models/ipcc2019/organicCarbonPerHa.py +10 -10
- hestia_earth/models/ipcc2019/organicCarbonPerHa_utils.py +4 -19
- hestia_earth/models/ipcc2019/organicSoilCultivation_utils.py +0 -9
- hestia_earth/models/log.py +75 -1
- hestia_earth/models/mocking/search-results.json +1 -1
- hestia_earth/models/utils/blank_node.py +12 -4
- hestia_earth/models/version.py +1 -1
- {hestia_earth_models-0.74.14.dist-info → hestia_earth_models-0.74.16.dist-info}/METADATA +15 -7
- {hestia_earth_models-0.74.14.dist-info → hestia_earth_models-0.74.16.dist-info}/RECORD +37 -34
- {hestia_earth_models-0.74.14.dist-info → hestia_earth_models-0.74.16.dist-info}/WHEEL +1 -1
- tests/models/ecoalimV9/test_cycle.py +2 -2
- tests/models/hestia/test_landTransformation20YearAverageDuringCycle.py +4 -8
- tests/models/hestia/test_soilClassification.py +72 -0
- tests/models/ipcc2019/test_organicCarbonPerHa_utils.py +4 -48
- tests/models/test_log.py +128 -0
- {hestia_earth_models-0.74.14.dist-info → hestia_earth_models-0.74.16.dist-info/licenses}/LICENSE +0 -0
- {hestia_earth_models-0.74.14.dist-info → hestia_earth_models-0.74.16.dist-info}/top_level.txt +0 -0
tests/models/test_log.py
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
from enum import Enum
|
|
2
|
+
from numpy import array
|
|
3
|
+
from pytest import mark
|
|
4
|
+
|
|
5
|
+
from hestia_earth.models.log import (
|
|
6
|
+
format_bool, format_decimal_percentage, format_enum, format_float, format_int, format_nd_array, format_str
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@mark.parametrize(
|
|
11
|
+
"value, kwargs, expected",
|
|
12
|
+
[
|
|
13
|
+
(True, {}, "True"),
|
|
14
|
+
(False, {}, "False"),
|
|
15
|
+
([], {}, "None"),
|
|
16
|
+
("str", {}, "None"),
|
|
17
|
+
(None, {}, "None"),
|
|
18
|
+
(None, {"default": "Override"}, "Override")
|
|
19
|
+
],
|
|
20
|
+
ids=["True", "False", "list", "str", "None", "None w/ default"]
|
|
21
|
+
)
|
|
22
|
+
def test_format_bool(value, kwargs, expected):
|
|
23
|
+
assert format_bool(value, **kwargs) == expected
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@mark.parametrize(
|
|
27
|
+
"value, kwargs, expected",
|
|
28
|
+
[
|
|
29
|
+
(3.141592653, {}, "314.159 pct"),
|
|
30
|
+
(0, {}, "0 pct"),
|
|
31
|
+
("20", {}, "None"),
|
|
32
|
+
(None, {}, "None"),
|
|
33
|
+
(3.141592653, {"unit": "kg"}, "314.159 kg"),
|
|
34
|
+
(3.141592653, {"ndigits": 4}, "314.1593 pct"),
|
|
35
|
+
(None, {"default": "Override"}, "Override"),
|
|
36
|
+
],
|
|
37
|
+
ids=["float", "zero", "str", "None", "float w/ unit", "float w/ ndigits", "None w/ default"]
|
|
38
|
+
)
|
|
39
|
+
def test_format_decimal_percentage(value, kwargs, expected):
|
|
40
|
+
assert format_decimal_percentage(value, **kwargs) == expected
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class TestEnum(Enum):
|
|
44
|
+
WITH_LEGAL_CHARS = "with legal chars"
|
|
45
|
+
WITH_RESERVED_CHARS = "with_reserved_chars"
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
@mark.parametrize(
|
|
49
|
+
"value, kwargs, expected",
|
|
50
|
+
[
|
|
51
|
+
(TestEnum.WITH_LEGAL_CHARS, {}, TestEnum.WITH_LEGAL_CHARS.value),
|
|
52
|
+
(TestEnum.WITH_RESERVED_CHARS, {}, "with-reserved-chars"),
|
|
53
|
+
("str", {}, "None"),
|
|
54
|
+
(None, {}, "None"),
|
|
55
|
+
(None, {"default": "Override"}, "Override")
|
|
56
|
+
],
|
|
57
|
+
ids=["Enum w/ legal chars", "Enum w/ illegal chars", "str", "None", "None w/ default"]
|
|
58
|
+
)
|
|
59
|
+
def test_format_enum(value, kwargs, expected):
|
|
60
|
+
assert format_enum(value, **kwargs) == expected
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
@mark.parametrize(
|
|
64
|
+
"value, kwargs, expected",
|
|
65
|
+
[
|
|
66
|
+
(3.141592653, {}, "3.142"),
|
|
67
|
+
(0, {}, "0"),
|
|
68
|
+
("20", {}, "None"),
|
|
69
|
+
(None, {}, "None"),
|
|
70
|
+
(3.141592653, {"unit": "kg"}, "3.142 kg"),
|
|
71
|
+
(3.141592653, {"ndigits": 4}, "3.1416"),
|
|
72
|
+
(None, {"default": "Override"}, "Override"),
|
|
73
|
+
],
|
|
74
|
+
ids=["float", "zero", "str", "None", "float w/ unit", "float w/ ndigits", "None w/ default"]
|
|
75
|
+
)
|
|
76
|
+
def test_format_float(value, kwargs, expected):
|
|
77
|
+
assert format_float(value, **kwargs) == expected
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
@mark.parametrize(
|
|
81
|
+
"value, kwargs, expected",
|
|
82
|
+
[
|
|
83
|
+
(3.141592653, {}, "3"),
|
|
84
|
+
(0, {}, "0"),
|
|
85
|
+
("20", {}, "None"),
|
|
86
|
+
(None, {}, "None"),
|
|
87
|
+
(3.141592653, {"unit": "kg"}, "3 kg"),
|
|
88
|
+
(None, {"default": "Override"}, "Override")
|
|
89
|
+
],
|
|
90
|
+
ids=["float", "zero", "str", "None", "float w/ unit", "None w/ default"]
|
|
91
|
+
)
|
|
92
|
+
def test_format_int(value, kwargs, expected):
|
|
93
|
+
assert format_int(value, **kwargs) == expected
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
@mark.parametrize(
|
|
97
|
+
"value, kwargs, expected",
|
|
98
|
+
[
|
|
99
|
+
(array(3.141592653), {}, "3.142 ± 0.0"),
|
|
100
|
+
(array([1, 2, 3, 4]), {}, "2.5 ± 1.118"),
|
|
101
|
+
(array([[11, 12, 13, 14], [21, 22, 23, 24]]), {}, "17.5 ± 5.123"),
|
|
102
|
+
(3.141592653, {}, "3.142"),
|
|
103
|
+
(0, {}, "0"),
|
|
104
|
+
("20", {}, "None"),
|
|
105
|
+
(None, {}, "None"),
|
|
106
|
+
(array(3.141592653), {"unit": "kg"}, "3.142 ± 0.0 kg"),
|
|
107
|
+
(array(3.141592653), {"ndigits": 4}, "3.1416 ± 0.0"),
|
|
108
|
+
(None, {"default": "Override"}, "Override"),
|
|
109
|
+
],
|
|
110
|
+
ids=["scalar", "1d", "2d", "float", "zero", "str", "None", "float w/ unit", "float w/ ndigits", "None w/ default"]
|
|
111
|
+
)
|
|
112
|
+
def test_format_nd_array(value, kwargs, expected):
|
|
113
|
+
assert format_nd_array(value, **kwargs) == expected
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
@mark.parametrize(
|
|
117
|
+
"value, kwargs, expected",
|
|
118
|
+
[
|
|
119
|
+
("string", {}, "string"),
|
|
120
|
+
("some_reserved:chars,get=replaced", {}, "some-reserved-chars-get-replaced"),
|
|
121
|
+
([], {}, "None"),
|
|
122
|
+
(None, {}, "None"),
|
|
123
|
+
(None, {"default": "Override"}, "Override")
|
|
124
|
+
],
|
|
125
|
+
ids=["legal chars", "illegal chars", "list", "None", "None w/ default"]
|
|
126
|
+
)
|
|
127
|
+
def test_format_str(value, kwargs, expected):
|
|
128
|
+
assert format_str(value, **kwargs) == expected
|
{hestia_earth_models-0.74.14.dist-info → hestia_earth_models-0.74.16.dist-info/licenses}/LICENSE
RENAMED
|
File without changes
|
{hestia_earth_models-0.74.14.dist-info → hestia_earth_models-0.74.16.dist-info}/top_level.txt
RENAMED
|
File without changes
|