hestia-earth-models 0.54.2__py3-none-any.whl → 0.55.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/cycle/completeness/{other.py → seed.py} +5 -5
- hestia_earth/models/cycle/completeness/{soilAmendments.py → soilAmendment.py} +4 -4
- hestia_earth/models/cycle/product/economicValueShare.py +2 -2
- hestia_earth/models/environmentalFootprintV3/freshwaterEcotoxicityPotentialCtue.py +1 -1
- hestia_earth/models/geospatialDatabase/drainageClass.py +2 -2
- hestia_earth/models/ipcc2019/co2ToAirLimeHydrolysis.py +3 -1
- hestia_earth/models/ipcc2019/organicCarbonPerHa.py +14 -15
- hestia_earth/models/lcImpactAllEffects100Years/damageToFreshwaterEcosystemsFreshwaterEcotoxicity.py +1 -1
- hestia_earth/models/lcImpactAllEffects100Years/damageToHumanHealthHumanToxicityCancerogenic.py +1 -1
- hestia_earth/models/lcImpactAllEffects100Years/damageToHumanHealthHumanToxicityNonCancerogenic.py +1 -1
- hestia_earth/models/lcImpactAllEffects100Years/damageToMarineEcosystemsMarineEcotoxicity.py +1 -1
- hestia_earth/models/lcImpactAllEffects100Years/damageToTerrestrialEcosystemsTerrestrialEcotoxicity.py +1 -1
- hestia_earth/models/lcImpactAllEffectsInfinite/damageToFreshwaterEcosystemsFreshwaterEcotoxicity.py +1 -1
- hestia_earth/models/lcImpactAllEffectsInfinite/damageToHumanHealthHumanToxicityCancerogenic.py +1 -1
- hestia_earth/models/lcImpactAllEffectsInfinite/damageToHumanHealthHumanToxicityNonCancerogenic.py +1 -1
- hestia_earth/models/lcImpactAllEffectsInfinite/damageToMarineEcosystemsMarineEcotoxicity.py +1 -1
- hestia_earth/models/lcImpactAllEffectsInfinite/damageToTerrestrialEcosystemsTerrestrialEcotoxicity.py +1 -1
- hestia_earth/models/lcImpactCertainEffects100Years/damageToFreshwaterEcosystemsFreshwaterEcotoxicity.py +1 -1
- hestia_earth/models/lcImpactCertainEffects100Years/damageToHumanHealthHumanToxicityCancerogenic.py +1 -1
- hestia_earth/models/lcImpactCertainEffects100Years/damageToHumanHealthHumanToxicityNonCancerogenic.py +1 -1
- hestia_earth/models/lcImpactCertainEffects100Years/damageToMarineEcosystemsMarineEcotoxicity.py +1 -1
- hestia_earth/models/lcImpactCertainEffects100Years/damageToTerrestrialEcosystemsTerrestrialEcotoxicity.py +1 -1
- hestia_earth/models/lcImpactCertainEffectsInfinite/damageToFreshwaterEcosystemsFreshwaterEcotoxicity.py +1 -1
- hestia_earth/models/lcImpactCertainEffectsInfinite/damageToHumanHealthHumanToxicityCancerogenic.py +1 -1
- hestia_earth/models/lcImpactCertainEffectsInfinite/damageToHumanHealthHumanToxicityNonCancerogenic.py +1 -1
- hestia_earth/models/lcImpactCertainEffectsInfinite/damageToMarineEcosystemsMarineEcotoxicity.py +1 -1
- hestia_earth/models/lcImpactCertainEffectsInfinite/damageToTerrestrialEcosystemsTerrestrialEcotoxicity.py +1 -1
- hestia_earth/models/mocking/search-results.json +76 -64
- hestia_earth/models/pooreNemecek2018/excretaKgN.py +2 -2
- hestia_earth/models/pooreNemecek2018/excretaKgVs.py +2 -2
- hestia_earth/models/pooreNemecek2018/no3ToGroundwaterCropResidueDecomposition.py +1 -1
- hestia_earth/models/pooreNemecek2018/no3ToGroundwaterExcreta.py +1 -1
- hestia_earth/models/pooreNemecek2018/no3ToGroundwaterInorganicFertiliser.py +1 -1
- hestia_earth/models/pooreNemecek2018/no3ToGroundwaterOrganicFertiliser.py +1 -1
- hestia_earth/models/pooreNemecek2018/no3ToGroundwaterSoilFlux.py +1 -1
- hestia_earth/models/recipe2016Egalitarian/ecosystemDamageOzoneFormation.py +1 -1
- hestia_earth/models/recipe2016Egalitarian/freshwaterAquaticEcotoxicityPotential14Dcbeq.py +1 -1
- hestia_earth/models/recipe2016Egalitarian/humanCarcinogenicToxicity.py +1 -1
- hestia_earth/models/recipe2016Egalitarian/humanDamageOzoneFormation.py +1 -1
- hestia_earth/models/recipe2016Egalitarian/humanNonCarcinogenicToxicity.py +1 -1
- hestia_earth/models/recipe2016Egalitarian/marineAquaticEcotoxicityPotential14Dcbeq.py +1 -1
- hestia_earth/models/recipe2016Egalitarian/terrestrialEcotoxicityPotential14Dcbeq.py +1 -1
- hestia_earth/models/recipe2016Hierarchist/ecosystemDamageOzoneFormation.py +1 -1
- hestia_earth/models/recipe2016Hierarchist/freshwaterAquaticEcotoxicityPotential14Dcbeq.py +1 -1
- hestia_earth/models/recipe2016Hierarchist/humanCarcinogenicToxicity.py +1 -1
- hestia_earth/models/recipe2016Hierarchist/humanDamageOzoneFormation.py +1 -1
- hestia_earth/models/recipe2016Hierarchist/humanNonCarcinogenicToxicity.py +1 -1
- hestia_earth/models/recipe2016Hierarchist/marineAquaticEcotoxicityPotential14Dcbeq.py +1 -1
- hestia_earth/models/recipe2016Hierarchist/terrestrialEcotoxicityPotential14Dcbeq.py +1 -1
- hestia_earth/models/recipe2016Individualist/ecosystemDamageOzoneFormation.py +1 -1
- hestia_earth/models/recipe2016Individualist/freshwaterAquaticEcotoxicityPotential14Dcbeq.py +1 -1
- hestia_earth/models/recipe2016Individualist/humanCarcinogenicToxicity.py +1 -1
- hestia_earth/models/recipe2016Individualist/humanDamageOzoneFormation.py +1 -1
- hestia_earth/models/recipe2016Individualist/humanNonCarcinogenicToxicity.py +1 -1
- hestia_earth/models/recipe2016Individualist/marineAquaticEcotoxicityPotential14Dcbeq.py +1 -1
- hestia_earth/models/recipe2016Individualist/terrestrialEcotoxicityPotential14Dcbeq.py +1 -1
- hestia_earth/models/schmidt2007/utils.py +1 -1
- hestia_earth/models/site/pre_checks/cache_geospatialDatabase.py +1 -1
- hestia_earth/models/stehfestBouwman2006/n2OToAirCropResidueDecompositionDirect.py +1 -1
- hestia_earth/models/stehfestBouwman2006/n2OToAirExcretaDirect.py +1 -1
- hestia_earth/models/stehfestBouwman2006/n2OToAirInorganicFertiliserDirect.py +1 -1
- hestia_earth/models/stehfestBouwman2006/n2OToAirOrganicFertiliserDirect.py +1 -1
- hestia_earth/models/stehfestBouwman2006/n2OToAirSoilFlux.py +1 -1
- hestia_earth/models/stehfestBouwman2006/noxToAirCropResidueDecomposition.py +1 -1
- hestia_earth/models/stehfestBouwman2006/noxToAirExcreta.py +1 -1
- hestia_earth/models/stehfestBouwman2006/noxToAirInorganicFertiliser.py +1 -1
- hestia_earth/models/stehfestBouwman2006/noxToAirOrganicFertiliser.py +1 -1
- hestia_earth/models/stehfestBouwman2006/noxToAirSoilFlux.py +1 -1
- hestia_earth/models/stehfestBouwman2006GisImplementation/noxToAirCropResidueDecomposition.py +1 -1
- hestia_earth/models/stehfestBouwman2006GisImplementation/noxToAirExcreta.py +1 -1
- hestia_earth/models/stehfestBouwman2006GisImplementation/noxToAirInorganicFertiliser.py +1 -1
- hestia_earth/models/stehfestBouwman2006GisImplementation/noxToAirOrganicFertiliser.py +1 -1
- hestia_earth/models/stehfestBouwman2006GisImplementation/noxToAirSoilFlux.py +1 -1
- hestia_earth/models/usetoxV2/freshwaterEcotoxicityPotentialCtue.py +1 -1
- hestia_earth/models/utils/cycle.py +3 -3
- hestia_earth/models/utils/measurement.py +1 -1
- hestia_earth/models/utils/pesticideAI.py +2 -2
- hestia_earth/models/utils/product.py +2 -0
- hestia_earth/models/version.py +1 -1
- {hestia_earth_models-0.54.2.dist-info → hestia_earth_models-0.55.0.dist-info}/METADATA +2 -2
- {hestia_earth_models-0.54.2.dist-info → hestia_earth_models-0.55.0.dist-info}/RECORD +91 -91
- tests/models/cycle/completeness/{test_other.py → test_seed.py} +1 -1
- tests/models/cycle/completeness/{test_soilAmendments.py → test_soilAmendment.py} +1 -1
- tests/models/cycle/product/test_economicValueShare.py +2 -2
- tests/models/ipcc2019/test_organicCarbonPerHa.py +32 -4
- tests/models/pooreNemecek2018/test_excretaKgN.py +2 -2
- tests/models/pooreNemecek2018/test_excretaKgVs.py +2 -2
- tests/models/utils/test_source.py +1 -1
- {hestia_earth_models-0.54.2.dist-info → hestia_earth_models-0.55.0.dist-info}/LICENSE +0 -0
- {hestia_earth_models-0.54.2.dist-info → hestia_earth_models-0.55.0.dist-info}/WHEEL +0 -0
- {hestia_earth_models-0.54.2.dist-info → hestia_earth_models-0.55.0.dist-info}/top_level.txt +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"""
|
|
2
|
-
Completeness
|
|
2
|
+
Completeness Seed
|
|
3
3
|
|
|
4
4
|
This model checks if we have the requirements below and updates the
|
|
5
|
-
[Data Completeness](https://hestia.earth/schema/Completeness#
|
|
5
|
+
[Data Completeness](https://hestia.earth/schema/Completeness#seed) value.
|
|
6
6
|
"""
|
|
7
7
|
from hestia_earth.schema import SiteSiteType
|
|
8
8
|
from hestia_earth.utils.model import find_term_match, find_primary_product
|
|
@@ -13,7 +13,7 @@ from . import MODEL
|
|
|
13
13
|
|
|
14
14
|
REQUIREMENTS = {
|
|
15
15
|
"Cycle": {
|
|
16
|
-
"completeness.
|
|
16
|
+
"completeness.seed": "False",
|
|
17
17
|
"inputs": [
|
|
18
18
|
{"@type": "Input", "value": "", "term.@id": ["seed", "saplings"]}
|
|
19
19
|
],
|
|
@@ -25,13 +25,13 @@ REQUIREMENTS = {
|
|
|
25
25
|
}
|
|
26
26
|
RETURNS = {
|
|
27
27
|
"Completeness": {
|
|
28
|
-
"
|
|
28
|
+
"seed": ""
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
LOOKUPS = {
|
|
32
32
|
"crop": "isPlantation"
|
|
33
33
|
}
|
|
34
|
-
MODEL_KEY = '
|
|
34
|
+
MODEL_KEY = 'seed'
|
|
35
35
|
ALLOWED_SITE_TYPES = [
|
|
36
36
|
SiteSiteType.CROPLAND.value,
|
|
37
37
|
SiteSiteType.GLASS_OR_HIGH_ACCESSIBLE_COVER.value
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Completeness Soil Amendments
|
|
3
3
|
|
|
4
4
|
This model checks if we have the requirements below and updates the
|
|
5
|
-
[Data Completeness](https://hestia.earth/schema/Completeness#
|
|
5
|
+
[Data Completeness](https://hestia.earth/schema/Completeness#soilAmendment) value.
|
|
6
6
|
"""
|
|
7
7
|
from hestia_earth.models.log import logRequirements
|
|
8
8
|
from hestia_earth.models.utils import is_from_model
|
|
@@ -11,7 +11,7 @@ from . import MODEL
|
|
|
11
11
|
|
|
12
12
|
REQUIREMENTS = {
|
|
13
13
|
"Cycle": {
|
|
14
|
-
"completeness.
|
|
14
|
+
"completeness.soilAmendment": "False",
|
|
15
15
|
"endDate": "",
|
|
16
16
|
"site": {
|
|
17
17
|
"@type": "Site",
|
|
@@ -21,10 +21,10 @@ REQUIREMENTS = {
|
|
|
21
21
|
}
|
|
22
22
|
RETURNS = {
|
|
23
23
|
"Completeness": {
|
|
24
|
-
"
|
|
24
|
+
"soilAmendment": ""
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
MODEL_KEY = '
|
|
27
|
+
MODEL_KEY = 'soilAmendment'
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
def run(cycle: dict):
|
|
@@ -30,7 +30,7 @@ REQUIREMENTS = {
|
|
|
30
30
|
"currency": ""
|
|
31
31
|
}],
|
|
32
32
|
"optional": {
|
|
33
|
-
"completeness.
|
|
33
|
+
"completeness.product": ""
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -54,7 +54,7 @@ def _product(product: dict, value: float):
|
|
|
54
54
|
return {**product, MODEL_KEY: value}
|
|
55
55
|
|
|
56
56
|
|
|
57
|
-
def _is_complete(cycle: dict): return cycle.get('completeness', {}).get('
|
|
57
|
+
def _is_complete(cycle: dict): return cycle.get('completeness', {}).get('product', False)
|
|
58
58
|
|
|
59
59
|
|
|
60
60
|
def _no_yield(product): return list_sum(product.get('value', [-1]), -1) == 0
|
|
@@ -24,11 +24,11 @@ RETURNS = {
|
|
|
24
24
|
}
|
|
25
25
|
TERM_ID = 'drainageClass'
|
|
26
26
|
EE_PARAMS = {
|
|
27
|
-
'collection': '
|
|
27
|
+
'collection': 'DRAINAGE_v2',
|
|
28
28
|
'ee_type': 'raster',
|
|
29
29
|
'reducer': 'mode'
|
|
30
30
|
}
|
|
31
|
-
BIBLIO_TITLE = 'Harmonized World Soil Database Version
|
|
31
|
+
BIBLIO_TITLE = 'Harmonized World Soil Database Version 2.0.'
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
def _measurement(site: dict, value: float):
|
|
@@ -40,7 +40,9 @@ def _emission(value: float):
|
|
|
40
40
|
def _get_lime_values(cycle: dict, inputs: list):
|
|
41
41
|
# TODO: use lookup table
|
|
42
42
|
values = [convert_to_unit(i, Units.KG_CO2) for i in inputs if len(i.get('value', [])) > 0]
|
|
43
|
-
return [0] if
|
|
43
|
+
return [0] if (
|
|
44
|
+
len(values) == 0 and _is_term_type_complete(cycle, {'termType': TermTermType.SOILAMENDMENT.value})
|
|
45
|
+
) else values
|
|
44
46
|
|
|
45
47
|
|
|
46
48
|
def _run(CaCO3_values: list, MgCO3_values: list):
|
|
@@ -178,7 +178,7 @@ PROPERTY_TERM_IDS = [
|
|
|
178
178
|
CARBON_SOURCE_TERM_TYPES = [
|
|
179
179
|
TermTermType.ORGANICFERTILISER.value,
|
|
180
180
|
TermTermType.SOILAMENDMENT.value,
|
|
181
|
-
TermTermType.
|
|
181
|
+
TermTermType.SEED.value
|
|
182
182
|
]
|
|
183
183
|
|
|
184
184
|
PERCENT_THRESHOLD = 30
|
|
@@ -1541,7 +1541,7 @@ def _check_consecutive(ints: list[int]) -> bool:
|
|
|
1541
1541
|
bool
|
|
1542
1542
|
Whether or not the list of integers is consecutive.
|
|
1543
1543
|
"""
|
|
1544
|
-
range_list = list(range(min(ints), max(ints)+1))
|
|
1544
|
+
range_list = list(range(min(ints), max(ints)+1)) if ints else []
|
|
1545
1545
|
return all(a == b for a, b in zip(ints, range_list))
|
|
1546
1546
|
|
|
1547
1547
|
|
|
@@ -1941,38 +1941,37 @@ def _should_run_tier_2(
|
|
|
1941
1941
|
grouped_data.items()
|
|
1942
1942
|
))
|
|
1943
1943
|
|
|
1944
|
-
|
|
1945
|
-
|
|
1944
|
+
timestamps = list(complete_data)
|
|
1945
|
+
start_year = timestamps[0] if timestamps else 0
|
|
1946
|
+
end_year = timestamps[-1] if timestamps else 0
|
|
1946
1947
|
|
|
1947
1948
|
measurements = site.get('measurements', [])
|
|
1948
1949
|
|
|
1949
|
-
|
|
1950
|
+
sand_content_value, _ = most_relevant_measurement_value_by_depth_and_date(
|
|
1950
1951
|
measurements,
|
|
1951
1952
|
SAND_CONTENT_TERM_ID,
|
|
1952
1953
|
f"{start_year}-12-31",
|
|
1953
1954
|
DEPTH_UPPER,
|
|
1954
1955
|
DEPTH_LOWER,
|
|
1955
1956
|
depth_strict=False
|
|
1956
|
-
)
|
|
1957
|
-
sand_content =
|
|
1957
|
+
) if timestamps else (None, None)
|
|
1958
|
+
sand_content = sand_content_value/100 if sand_content_value else None
|
|
1958
1959
|
|
|
1959
|
-
|
|
1960
|
+
initial_soc_stock_value, initial_soc_stock_date = most_relevant_measurement_value_by_depth_and_date(
|
|
1960
1961
|
measurements,
|
|
1961
1962
|
TERM_ID,
|
|
1962
1963
|
f"{end_year}-12-31",
|
|
1963
1964
|
DEPTH_UPPER,
|
|
1964
1965
|
DEPTH_LOWER,
|
|
1965
1966
|
depth_strict=True
|
|
1966
|
-
)
|
|
1967
|
+
) if timestamps else (None, None)
|
|
1967
1968
|
|
|
1968
|
-
run_with_initial_soc_stock = bool(
|
|
1969
|
+
run_with_initial_soc_stock = bool(initial_soc_stock_value and initial_soc_stock_date)
|
|
1969
1970
|
|
|
1970
|
-
initial_soc_stock = initial_soc_stock_data[0] if run_with_initial_soc_stock else None
|
|
1971
|
-
initial_soc_stock_date = initial_soc_stock_data[1] if run_with_initial_soc_stock else None
|
|
1972
1971
|
run_in_period = (
|
|
1973
1972
|
int(abs(diff_in_years(f"{start_year}-12-31", initial_soc_stock_date)) + 1)
|
|
1974
1973
|
if run_with_initial_soc_stock else MIN_RUN_IN_PERIOD
|
|
1975
|
-
)
|
|
1974
|
+
) if timestamps else 0
|
|
1976
1975
|
|
|
1977
1976
|
timestamps = list(complete_data.keys())
|
|
1978
1977
|
temperatures = [complete_data[year][_InnerKey.TEMPERATURES] for year in timestamps]
|
|
@@ -1988,7 +1987,7 @@ def _should_run_tier_2(
|
|
|
1988
1987
|
should_run_t,
|
|
1989
1988
|
should_run_w,
|
|
1990
1989
|
should_run_c,
|
|
1991
|
-
0 < sand_content <= 1,
|
|
1990
|
+
sand_content is not None and 0 < sand_content <= 1,
|
|
1992
1991
|
run_in_period >= MIN_RUN_IN_PERIOD,
|
|
1993
1992
|
len(timestamps) >= run_in_period,
|
|
1994
1993
|
check_cycle_site_ids_identical(cycles),
|
|
@@ -2017,7 +2016,7 @@ def _should_run_tier_2(
|
|
|
2017
2016
|
sand_content,
|
|
2018
2017
|
is_irrigateds,
|
|
2019
2018
|
run_in_period,
|
|
2020
|
-
|
|
2019
|
+
initial_soc_stock_value
|
|
2021
2020
|
)
|
|
2022
2021
|
|
|
2023
2022
|
|