hestia-earth-models 0.70.0__py3-none-any.whl → 0.70.1__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.
- hestia_earth/models/aware/scarcityWeightedWaterUse.py +8 -16
- hestia_earth/models/config/Cycle.json +52 -64
- hestia_earth/models/config/ImpactAssessment.json +12 -4
- hestia_earth/models/config/Site.json +33 -22
- hestia_earth/models/cycle/transformation.py +1 -1
- hestia_earth/models/cycle/utils.py +0 -6
- hestia_earth/models/data/ecoinventV3/__init__.py +15 -13
- hestia_earth/models/ecoalimV9/__init__.py +13 -0
- hestia_earth/models/ecoalimV9/cycle.py +128 -0
- hestia_earth/models/ecoalimV9/impact_assessment.py +125 -0
- hestia_earth/models/ecoalimV9/utils.py +31 -0
- hestia_earth/models/ecoinventV3/__init__.py +6 -14
- hestia_earth/models/ecoinventV3/utils.py +1 -29
- hestia_earth/models/ecoinventV3AndEmberClimate/__init__.py +8 -2
- hestia_earth/models/emissionNotRelevant/__init__.py +33 -8
- hestia_earth/models/{cycle → hestia}/aboveGroundCropResidue.py +4 -3
- hestia_earth/models/{cycle → hestia}/aboveGroundCropResidueTotal.py +1 -1
- hestia_earth/models/{site → hestia}/brackishWater.py +1 -1
- hestia_earth/models/{site → hestia}/cationExchangeCapacityPerKgSoil.py +1 -1
- hestia_earth/models/{cycle → hestia}/coldCarcassWeightPerHead.py +1 -1
- hestia_earth/models/{cycle → hestia}/coldDressedCarcassWeightPerHead.py +1 -1
- hestia_earth/models/{cycle → hestia}/concentrateFeed.py +1 -1
- hestia_earth/models/{cycle → hestia}/cropResidueManagement.py +1 -1
- hestia_earth/models/{cycle → hestia}/croppingIntensity.py +1 -1
- hestia_earth/models/{cycle → hestia}/energyContentLowerHeatingValue.py +1 -1
- hestia_earth/models/{cycle → hestia}/excretaKgMass.py +7 -2
- hestia_earth/models/{cycle → hestia}/excretaKgN.py +1 -1
- hestia_earth/models/{cycle → hestia}/excretaKgVs.py +1 -1
- hestia_earth/models/{cycle → hestia}/feedConversionRatio/__init__.py +1 -1
- hestia_earth/models/{site → hestia}/flowingWater.py +1 -1
- hestia_earth/models/{site → hestia}/freshWater.py +1 -1
- hestia_earth/models/{cycle → hestia}/inorganicFertiliser.py +1 -1
- hestia_earth/models/{cycle → hestia}/irrigatedTypeUnspecified.py +14 -19
- hestia_earth/models/hestia/landCover.py +30 -22
- hestia_earth/models/{cycle → hestia}/liveAnimal.py +1 -1
- hestia_earth/models/{cycle → hestia}/longFallowRatio.py +1 -1
- hestia_earth/models/{cycle → hestia}/materialAndSubstrate.py +1 -1
- hestia_earth/models/{cycle → hestia}/milkYield.py +1 -1
- hestia_earth/models/{site → hestia}/netPrimaryProduction.py +1 -1
- hestia_earth/models/{site → hestia}/organicCarbonPerHa.py +1 -1
- hestia_earth/models/{cycle → hestia}/pastureGrass.py +1 -1
- hestia_earth/models/{cycle → hestia}/pastureSystem.py +1 -1
- hestia_earth/models/{site → hestia}/potentialEvapotranspirationAnnual.py +3 -3
- hestia_earth/models/{site → hestia}/potentialEvapotranspirationMonthly.py +3 -3
- hestia_earth/models/{site → hestia}/precipitationAnnual.py +3 -3
- hestia_earth/models/{site → hestia}/precipitationMonthly.py +3 -3
- hestia_earth/models/{site → hestia}/rainfallAnnual.py +3 -3
- hestia_earth/models/{site → hestia}/rainfallMonthly.py +3 -3
- hestia_earth/models/{cycle → hestia}/readyToCookWeightPerHead.py +1 -1
- hestia_earth/models/{cycle → hestia}/residueBurnt.py +1 -1
- hestia_earth/models/{cycle → hestia}/residueIncorporated.py +1 -1
- hestia_earth/models/{cycle → hestia}/residueLeftOnField.py +1 -1
- hestia_earth/models/hestia/residueRemoved.py +65 -13
- hestia_earth/models/{site → hestia}/salineWater.py +1 -1
- hestia_earth/models/{site → hestia}/soilMeasurement.py +1 -1
- hestia_earth/models/{cycle → hestia}/stockingDensityAnimalHousingAverage.py +1 -1
- hestia_earth/models/{site → hestia}/temperatureAnnual.py +3 -3
- hestia_earth/models/{site → hestia}/temperatureMonthly.py +3 -3
- hestia_earth/models/{site → hestia}/totalNitrogenPerKgSoil.py +1 -1
- hestia_earth/models/{cycle → hestia}/unknownPreSeasonWaterRegime.py +1 -1
- hestia_earth/models/hestia/utils.py +93 -0
- hestia_earth/models/{site → hestia}/waterDepth.py +1 -1
- hestia_earth/models/hestia/waterSalinity.py +78 -0
- hestia_earth/models/ipcc2019/aboveGroundBiomass.py +1 -1
- hestia_earth/models/ipcc2019/belowGroundBiomass.py +1 -1
- hestia_earth/models/ipcc2019/biomass_utils.py +2 -4
- hestia_earth/models/ipcc2019/ch4ToAirFloodedRice.py +163 -78
- hestia_earth/models/ipcc2019/co2ToAirCarbonStockChange_utils.py +31 -20
- hestia_earth/models/ipcc2019/co2ToAirUreaHydrolysis.py +16 -9
- hestia_earth/models/ipcc2019/nonCo2EmissionsToAirNaturalVegetationBurning.py +35 -47
- hestia_earth/models/ipcc2019/organicCarbonPerHa_tier_1.py +86 -1
- hestia_earth/models/ipcc2019/organicCarbonPerHa_tier_2.py +127 -1
- hestia_earth/models/ipcc2019/organicCarbonPerHa_utils.py +7 -5
- hestia_earth/models/mocking/search-results.json +764 -772
- hestia_earth/models/pooreNemecek2018/utils.py +8 -2
- hestia_earth/models/schmidt2007/ch4ToAirWasteTreatment.py +1 -4
- hestia_earth/models/schmidt2007/h2SToAirWasteTreatment.py +1 -4
- hestia_earth/models/schmidt2007/n2OToAirWasteTreatmentDirect.py +1 -4
- hestia_earth/models/schmidt2007/nh3ToAirWasteTreatment.py +1 -4
- hestia_earth/models/utils/background_emissions.py +52 -0
- hestia_earth/models/utils/blank_node.py +9 -5
- hestia_earth/models/utils/impact_assessment.py +26 -17
- hestia_earth/models/utils/lookup.py +48 -39
- hestia_earth/models/utils/measurement.py +3 -3
- hestia_earth/models/version.py +1 -1
- {hestia_earth_models-0.70.0.dist-info → hestia_earth_models-0.70.1.dist-info}/METADATA +2 -2
- {hestia_earth_models-0.70.0.dist-info → hestia_earth_models-0.70.1.dist-info}/RECORD +163 -158
- tests/models/aware/test_scarcityWeightedWaterUse.py +1 -12
- tests/models/ecoalimV9/__init__.py +0 -0
- tests/models/ecoalimV9/test_cycle.py +21 -0
- tests/models/ecoalimV9/test_impact_assessment.py +24 -0
- tests/models/environmentalFootprintV3_1/test_scarcityWeightedWaterUse.py +4 -2
- tests/models/{cycle → hestia}/test_aboveGroundCropResidue.py +1 -1
- tests/models/{cycle → hestia}/test_aboveGroundCropResidueTotal.py +1 -1
- tests/models/{site → hestia}/test_brackishWater.py +1 -1
- tests/models/{site → hestia}/test_cationExchangeCapacityPerKgSoil.py +1 -1
- tests/models/{cycle → hestia}/test_coldCarcassWeightPerHead.py +1 -1
- tests/models/{cycle → hestia}/test_coldDressedCarcassWeightPerHead.py +1 -1
- tests/models/{cycle → hestia}/test_concentrateFeed.py +1 -1
- tests/models/{cycle → hestia}/test_cropResidueManagement.py +1 -1
- tests/models/{cycle → hestia}/test_croppingIntensity.py +1 -1
- tests/models/{cycle → hestia}/test_energyContentLowerHeatingValue.py +5 -3
- tests/models/{cycle → hestia}/test_excretaKgMass.py +1 -1
- tests/models/{cycle → hestia}/test_excretaKgN.py +1 -1
- tests/models/{cycle → hestia}/test_excretaKgVs.py +1 -1
- tests/models/{cycle → hestia}/test_feedConversionRatio.py +1 -1
- tests/models/{site → hestia}/test_flowingWater.py +1 -1
- tests/models/{site → hestia}/test_freshWater.py +1 -1
- tests/models/{cycle → hestia}/test_inorganicFertiliser.py +1 -1
- tests/models/{cycle → hestia}/test_irrigatedTypeUnspecified.py +2 -5
- tests/models/hestia/test_landCover.py +4 -34
- tests/models/{cycle → hestia}/test_liveAnimal.py +1 -1
- tests/models/{cycle → hestia}/test_longFallowRatio.py +1 -1
- tests/models/{site → hestia}/test_management.py +1 -1
- tests/models/{cycle → hestia}/test_materialsAndSubstrate.py +1 -1
- tests/models/{cycle → hestia}/test_milkYield.py +1 -1
- tests/models/{site → hestia}/test_netPrimaryProduction.py +1 -1
- tests/models/{site → hestia}/test_organicCarbonPerHa.py +1 -1
- tests/models/{site → hestia}/test_organicCarbonPerKgSoil.py +1 -1
- tests/models/{site → hestia}/test_organicCarbonPerM3Soil.py +1 -1
- tests/models/{site → hestia}/test_organicMatterPerKgSoil.py +1 -1
- tests/models/{site → hestia}/test_organicMatterPerM3Soil.py +1 -1
- tests/models/{cycle → hestia}/test_pastureGrass.py +1 -1
- tests/models/{cycle → hestia}/test_pastureSystem.py +1 -1
- tests/models/{site → hestia}/test_potentialEvapotranspirationAnnual.py +1 -1
- tests/models/{site → hestia}/test_potentialEvapotranspirationMonthly.py +1 -1
- tests/models/{site → hestia}/test_precipitationAnnual.py +1 -1
- tests/models/{site → hestia}/test_precipitationMonthly.py +1 -1
- tests/models/{site → hestia}/test_rainfallAnnual.py +1 -1
- tests/models/{site → hestia}/test_rainfallMonthly.py +1 -1
- tests/models/{cycle → hestia}/test_readyToCookWeightPerHead.py +1 -1
- tests/models/{cycle → hestia}/test_residueBurnt.py +1 -1
- tests/models/{cycle → hestia}/test_residueIncorporated.py +1 -1
- tests/models/{cycle → hestia}/test_residueLeftOnField.py +1 -1
- tests/models/hestia/test_residueRemoved.py +15 -3
- tests/models/{site → hestia}/test_salineWater.py +1 -1
- tests/models/{site → hestia}/test_soilMeasurement.py +2 -2
- tests/models/{cycle → hestia}/test_stockingDensityAnimalHousingAverage.py +1 -1
- tests/models/{site → hestia}/test_temperatureAnnual.py +1 -1
- tests/models/{site → hestia}/test_temperatureMonthly.py +1 -1
- tests/models/{site → hestia}/test_totalNitrogenPerKgSoil.py +1 -1
- tests/models/{cycle → hestia}/test_unknownPreSeasonWaterRegime.py +1 -1
- tests/models/{site → hestia}/test_waterDepth.py +1 -1
- tests/models/hestia/test_waterSalinity.py +26 -0
- tests/models/ipcc2019/test_ch4ToAirFloodedRice.py +10 -42
- tests/models/ipcc2019/test_co2ToAirSoilOrganicCarbonStockChange.py +2 -1
- tests/models/ipcc2019/test_nonCo2EmissionsToAirNaturalVegetationBurning.py +3 -2
- tests/models/test_ecoinventV3AndEmberClimate.py +2 -2
- tests/models/test_emissionNotRelevant.py +0 -8
- tests/models/utils/test_measurement.py +1 -1
- hestia_earth/models/cycle/residueRemoved.py +0 -54
- hestia_earth/models/hestia/nh3ToSurfaceWaterAquacultureSystems.py +0 -64
- hestia_earth/models/site/utils.py +0 -93
- tests/models/cycle/test_residueRemoved.py +0 -37
- tests/models/hestia/test_nh3ToSurfaceWaterAquacultureSystems.py +0 -51
- /hestia_earth/models/{cycle → hestia}/feedConversionRatio/feedConversionRatioCarbon.py +0 -0
- /hestia_earth/models/{cycle → hestia}/feedConversionRatio/feedConversionRatioDryMatter.py +0 -0
- /hestia_earth/models/{cycle → hestia}/feedConversionRatio/feedConversionRatioEnergy.py +0 -0
- /hestia_earth/models/{cycle → hestia}/feedConversionRatio/feedConversionRatioFedWeight.py +0 -0
- /hestia_earth/models/{cycle → hestia}/feedConversionRatio/feedConversionRatioNitrogen.py +0 -0
- /hestia_earth/models/{site → hestia}/management.py +0 -0
- /hestia_earth/models/{site → hestia}/organicCarbonPerKgSoil.py +0 -0
- /hestia_earth/models/{site → hestia}/organicCarbonPerM3Soil.py +0 -0
- /hestia_earth/models/{site → hestia}/organicMatterPerKgSoil.py +0 -0
- /hestia_earth/models/{site → hestia}/organicMatterPerM3Soil.py +0 -0
- {hestia_earth_models-0.70.0.dist-info → hestia_earth_models-0.70.1.dist-info}/LICENSE +0 -0
- {hestia_earth_models-0.70.0.dist-info → hestia_earth_models-0.70.1.dist-info}/WHEEL +0 -0
- {hestia_earth_models-0.70.0.dist-info → hestia_earth_models-0.70.1.dist-info}/top_level.txt +0 -0
@@ -31,6 +31,77 @@ from .organicCarbonPerHa_utils import (
|
|
31
31
|
)
|
32
32
|
from . import MODEL
|
33
33
|
|
34
|
+
REQUIREMENTS = {
|
35
|
+
"Site": {
|
36
|
+
"management": [
|
37
|
+
{"@type": "Management", "value": "", "term.termType": "landCover"}
|
38
|
+
],
|
39
|
+
"measurements": [
|
40
|
+
{
|
41
|
+
"@type": "Measurement",
|
42
|
+
"value": ["1", "2", "3", "4", "7", "8", "9", "10", "11", "12"],
|
43
|
+
"term.@id": "ecoClimateZone"
|
44
|
+
}
|
45
|
+
],
|
46
|
+
"optional": {
|
47
|
+
"measurements": [
|
48
|
+
{"@type": "Measurement", "value": "", "term.termType": ["soilType", "usdaSoilType"]}
|
49
|
+
],
|
50
|
+
"management": [
|
51
|
+
{
|
52
|
+
"@type": "Management",
|
53
|
+
"value": "",
|
54
|
+
"startDate": "",
|
55
|
+
"endDate": "",
|
56
|
+
"term.termType": "cropResidueManagement",
|
57
|
+
"name": ["burnt", "removed"]
|
58
|
+
},
|
59
|
+
{
|
60
|
+
"@type": "Management",
|
61
|
+
"value": "",
|
62
|
+
"startDate": "",
|
63
|
+
"endDate": "",
|
64
|
+
"term.termType": "landUseManagement"
|
65
|
+
},
|
66
|
+
{"@type": "Management", "value": "", "startDate": "", "endDate": "", "term.termType": "tillage"},
|
67
|
+
{
|
68
|
+
"@type": "Management",
|
69
|
+
"value": "",
|
70
|
+
"startDate": "",
|
71
|
+
"endDate": "",
|
72
|
+
"term.termType": "waterRegime",
|
73
|
+
"name": ["deep water", "irrigated"]
|
74
|
+
},
|
75
|
+
{
|
76
|
+
"@type": "Management",
|
77
|
+
"value": "",
|
78
|
+
"startDate": "",
|
79
|
+
"endDate": "",
|
80
|
+
"term.@id": "amendmentIncreasingSoilCarbonUsed"
|
81
|
+
},
|
82
|
+
{"@type": "Management", "value": "", "startDate": "", "endDate": "", "term.@id": "animalManureUsed"},
|
83
|
+
{
|
84
|
+
"@type": "Management",
|
85
|
+
"value": "",
|
86
|
+
"startDate": "",
|
87
|
+
"endDate": "",
|
88
|
+
"term.@id": "inorganicNitrogenFertiliserUsed"
|
89
|
+
},
|
90
|
+
{
|
91
|
+
"@type": "Management",
|
92
|
+
"value": "",
|
93
|
+
"startDate": "",
|
94
|
+
"endDate": "",
|
95
|
+
"term.@id": "organicFertiliserUsed"
|
96
|
+
},
|
97
|
+
{"@type": "Management", "value": "", "startDate": "", "endDate": "", "term.@id": "shortBareFallow"}
|
98
|
+
]
|
99
|
+
},
|
100
|
+
"none": {
|
101
|
+
"siteType": ["glass or high accessible cover"]
|
102
|
+
}
|
103
|
+
}
|
104
|
+
}
|
34
105
|
LOOKUPS = {
|
35
106
|
"crop": "IPCC_LAND_USE_CATEGORY",
|
36
107
|
"landCover": [
|
@@ -43,6 +114,20 @@ LOOKUPS = {
|
|
43
114
|
"tillage": "IPCC_TILLAGE_MANAGEMENT_CATEGORY",
|
44
115
|
"usdaSoilType": "IPCC_SOIL_CATEGORY"
|
45
116
|
}
|
117
|
+
RETURNS = {
|
118
|
+
"Measurement": [{
|
119
|
+
"value": "",
|
120
|
+
"sd": "",
|
121
|
+
"min": "",
|
122
|
+
"max": "",
|
123
|
+
"statsDefinition": "simulated",
|
124
|
+
"observations": "",
|
125
|
+
"dates": "",
|
126
|
+
"depthUpper": "0",
|
127
|
+
"depthLower": "30",
|
128
|
+
"methodClassification": "tier 1 model"
|
129
|
+
}]
|
130
|
+
}
|
46
131
|
|
47
132
|
TERM_ID = 'organicCarbonPerHa'
|
48
133
|
_METHOD_CLASSIFICATION = MeasurementMethodClassification.TIER_1_MODEL.value
|
@@ -108,7 +193,7 @@ def _measurement(
|
|
108
193
|
dict
|
109
194
|
A valid HESTIA `Measurement` node, see: https://www.hestia.earth/schema/Measurement.
|
110
195
|
"""
|
111
|
-
measurement = _new_measurement(TERM_ID) | descriptive_stats_dict
|
196
|
+
measurement = _new_measurement(TERM_ID, MODEL) | descriptive_stats_dict
|
112
197
|
measurement["dates"] = [f"{year}-12-31" for year in timestamps]
|
113
198
|
measurement["depthUpper"] = DEPTH_UPPER
|
114
199
|
measurement["depthLower"] = DEPTH_LOWER
|
@@ -33,11 +33,137 @@ from .organicCarbonPerHa_utils import (
|
|
33
33
|
)
|
34
34
|
from . import MODEL
|
35
35
|
|
36
|
+
REQUIREMENTS = {
|
37
|
+
"Site": {
|
38
|
+
"siteType": "cropland",
|
39
|
+
"measurements": [
|
40
|
+
{
|
41
|
+
"@type": "Measurement",
|
42
|
+
"term.@id": "sandContent",
|
43
|
+
"value": "",
|
44
|
+
"depthUpper": "0",
|
45
|
+
"depthLower": "30",
|
46
|
+
"optional": {
|
47
|
+
"dates": ""
|
48
|
+
}
|
49
|
+
},
|
50
|
+
{
|
51
|
+
"@type": "Measurement",
|
52
|
+
"term.@id": "temperatureMonthly",
|
53
|
+
"value": "",
|
54
|
+
"dates": ""
|
55
|
+
},
|
56
|
+
{
|
57
|
+
"@type": "Measurement",
|
58
|
+
"term.@id": "precipitationMonthly",
|
59
|
+
"value": "",
|
60
|
+
"dates": ""
|
61
|
+
},
|
62
|
+
{
|
63
|
+
"@type": "Measurement",
|
64
|
+
"term.@id": "potentialEvapotranspirationMonthly",
|
65
|
+
"value": "",
|
66
|
+
"dates": ""
|
67
|
+
}
|
68
|
+
],
|
69
|
+
"related": {
|
70
|
+
"Cycle": [{
|
71
|
+
"endDate": "",
|
72
|
+
"products": [
|
73
|
+
{
|
74
|
+
"@type": "Product",
|
75
|
+
"term.@id": [
|
76
|
+
"aboveGroundCropResidueLeftOnField",
|
77
|
+
"aboveGroundCropResidueIncorporated",
|
78
|
+
"belowGroundCropResidue",
|
79
|
+
"discardedCropLeftOnField",
|
80
|
+
"discardedCropIncorporated"
|
81
|
+
],
|
82
|
+
"value": "",
|
83
|
+
"properties": [
|
84
|
+
{
|
85
|
+
"@type": "Property",
|
86
|
+
"term.@id": "carbonContent",
|
87
|
+
"value": ""
|
88
|
+
},
|
89
|
+
{
|
90
|
+
"@type": "Property",
|
91
|
+
"term.@id": "nitrogenContent",
|
92
|
+
"value": ""
|
93
|
+
},
|
94
|
+
{
|
95
|
+
"@type": "Property",
|
96
|
+
"term.@id": "ligninContent",
|
97
|
+
"value": ""
|
98
|
+
}
|
99
|
+
]
|
100
|
+
}
|
101
|
+
],
|
102
|
+
"inputs": [
|
103
|
+
{
|
104
|
+
"@type": "Input",
|
105
|
+
"term.termType": ["organicFertiliser", "soilAmendment"],
|
106
|
+
"value": "",
|
107
|
+
"properties": [
|
108
|
+
{
|
109
|
+
"@type": "Property",
|
110
|
+
"term.@id": "carbonContent",
|
111
|
+
"value": ""
|
112
|
+
},
|
113
|
+
{
|
114
|
+
"@type": "Property",
|
115
|
+
"term.@id": "nitrogenContent",
|
116
|
+
"value": ""
|
117
|
+
},
|
118
|
+
{
|
119
|
+
"@type": "Property",
|
120
|
+
"term.@id": "ligninContent",
|
121
|
+
"value": ""
|
122
|
+
}
|
123
|
+
]
|
124
|
+
}
|
125
|
+
],
|
126
|
+
"practices": [
|
127
|
+
{
|
128
|
+
"@type": "Practice",
|
129
|
+
"term.termType": "tillage",
|
130
|
+
"value": ""
|
131
|
+
},
|
132
|
+
{
|
133
|
+
"@type": "Practice",
|
134
|
+
"term.termType": "waterRegime",
|
135
|
+
"name": "irrigated",
|
136
|
+
"value": "",
|
137
|
+
"startDate": "",
|
138
|
+
"endDate": ""
|
139
|
+
}
|
140
|
+
],
|
141
|
+
"optional": {
|
142
|
+
"startDate": ""
|
143
|
+
}
|
144
|
+
}]
|
145
|
+
}
|
146
|
+
}
|
147
|
+
}
|
36
148
|
LOOKUPS = {
|
37
149
|
"crop": "IPCC_LAND_USE_CATEGORY",
|
38
150
|
"landCover": "IPCC_LAND_USE_CATEGORY",
|
39
151
|
"tillage": "IPCC_TILLAGE_MANAGEMENT_CATEGORY"
|
40
152
|
}
|
153
|
+
RETURNS = {
|
154
|
+
"Measurement": [{
|
155
|
+
"value": "",
|
156
|
+
"sd": "",
|
157
|
+
"min": "",
|
158
|
+
"max": "",
|
159
|
+
"statsDefinition": "simulated",
|
160
|
+
"observations": "",
|
161
|
+
"dates": "",
|
162
|
+
"depthUpper": "0",
|
163
|
+
"depthLower": "30",
|
164
|
+
"methodClassification": "tier 2 model"
|
165
|
+
}]
|
166
|
+
}
|
41
167
|
|
42
168
|
TERM_ID = 'organicCarbonPerHa'
|
43
169
|
_METHOD_CLASSIFICATION = MeasurementMethodClassification.TIER_2_MODEL.value
|
@@ -124,7 +250,7 @@ def _measurement(
|
|
124
250
|
dict
|
125
251
|
A valid HESTIA `Measurement` node, see: https://www.hestia.earth/schema/Measurement.
|
126
252
|
"""
|
127
|
-
measurement = _new_measurement(TERM_ID) | descriptive_stats_dict
|
253
|
+
measurement = _new_measurement(TERM_ID, MODEL) | descriptive_stats_dict
|
128
254
|
measurement["dates"] = [f"{year}-12-31" for year in timestamps]
|
129
255
|
measurement["depthUpper"] = DEPTH_UPPER
|
130
256
|
measurement["depthLower"] = DEPTH_LOWER
|
@@ -1,13 +1,15 @@
|
|
1
1
|
from enum import Enum
|
2
|
+
from numpy import inf
|
2
3
|
from numpy.typing import NDArray
|
3
4
|
from typing import NamedTuple, Optional
|
4
5
|
|
5
6
|
from hestia_earth.schema import MeasurementStatsDefinition, SiteSiteType
|
6
7
|
|
7
8
|
from hestia_earth.models.utils.array_builders import (
|
8
|
-
repeat_single,
|
9
|
+
repeat_single, truncated_normal_1d
|
9
10
|
)
|
10
11
|
from hestia_earth.models.utils.blank_node import cumulative_nodes_term_match, node_term_match
|
12
|
+
from hestia_earth.models.utils.stats import calc_z_critical
|
11
13
|
from hestia_earth.models.utils.term import get_cover_crop_property_terms, get_irrigated_terms
|
12
14
|
|
13
15
|
STATS_DEFINITION = MeasurementStatsDefinition.SIMULATED.value
|
@@ -238,7 +240,9 @@ def sample_plus_minus_uncertainty(
|
|
238
240
|
*, iterations: int, value: float, uncertainty: float, seed: Optional[int] = None, **_
|
239
241
|
) -> NDArray:
|
240
242
|
"""Randomly sample a model parameter with a plus/minus uncertainty distribution."""
|
241
|
-
|
243
|
+
n_sds = calc_z_critical(95)
|
244
|
+
sigma = (value * (uncertainty / 100)) / n_sds
|
245
|
+
return truncated_normal_1d(shape=(1, iterations), mu=value, sigma=sigma, low=0, high=inf, seed=seed)
|
242
246
|
|
243
247
|
|
244
248
|
def sample_plus_minus_error(
|
@@ -246,9 +250,7 @@ def sample_plus_minus_error(
|
|
246
250
|
) -> NDArray:
|
247
251
|
"""Randomly sample a model parameter with a truncated normal distribution described using plus/minus error."""
|
248
252
|
sd = value * (error / 200)
|
249
|
-
|
250
|
-
high = value + (value * (error / 100))
|
251
|
-
return truncated_normal_1d(shape=(1, iterations), mu=value, sigma=sd, low=low, high=high, seed=seed)
|
253
|
+
return truncated_normal_1d(shape=(1, iterations), mu=value, sigma=sd, low=0, high=inf, seed=seed)
|
252
254
|
|
253
255
|
|
254
256
|
def sample_constant(*, iterations: int, value: float, **_) -> NDArray:
|