hestia-earth-models 0.68.0__py3-none-any.whl → 0.69.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.
- hestia_earth/models/agribalyse2016/fuelElectricity.py +0 -5
- hestia_earth/models/agribalyse2016/machineryInfrastructureDepreciatedAmountPerCycle.py +0 -11
- hestia_earth/models/aware/scarcityWeightedWaterUse.py +0 -4
- hestia_earth/models/cache_sites.py +18 -9
- hestia_earth/models/cml2001Baseline/abioticResourceDepletionFossilFuels.py +0 -18
- hestia_earth/models/cml2001Baseline/abioticResourceDepletionMineralsAndMetals.py +0 -12
- hestia_earth/models/cml2001Baseline/resourceUseEnergyDepletionDuringCycle.py +0 -5
- hestia_earth/models/cml2001Baseline/resourceUseMineralsAndMetalsDuringCycle.py +0 -4
- hestia_earth/models/config/Cycle.json +23 -30
- hestia_earth/models/cycle/aboveGroundCropResidueTotal.py +0 -6
- hestia_earth/models/cycle/animal/input/hestiaAggregatedData.py +0 -8
- hestia_earth/models/cycle/animal/input/properties.py +0 -9
- hestia_earth/models/cycle/animal/milkYield.py +0 -6
- hestia_earth/models/cycle/animal/properties.py +0 -6
- hestia_earth/models/cycle/completeness/animalFeed.py +0 -6
- hestia_earth/models/cycle/completeness/cropResidue.py +0 -6
- hestia_earth/models/cycle/completeness/electricityFuel.py +0 -6
- hestia_earth/models/cycle/completeness/excreta.py +0 -6
- hestia_earth/models/cycle/completeness/freshForage.py +0 -6
- hestia_earth/models/cycle/completeness/material.py +0 -6
- hestia_earth/models/cycle/completeness/seed.py +0 -6
- hestia_earth/models/cycle/completeness/soilAmendment.py +0 -6
- hestia_earth/models/cycle/concentrateFeed.py +0 -6
- hestia_earth/models/cycle/cropResidueManagement.py +0 -5
- hestia_earth/models/cycle/cycleDuration.py +0 -8
- hestia_earth/models/cycle/endDate.py +0 -7
- hestia_earth/models/cycle/excretaKgMass.py +0 -5
- hestia_earth/models/cycle/excretaKgN.py +0 -5
- hestia_earth/models/cycle/excretaKgVs.py +0 -5
- hestia_earth/models/cycle/inorganicFertiliser.py +0 -6
- hestia_earth/models/cycle/input/hestiaAggregatedData.py +0 -13
- hestia_earth/models/cycle/input/properties.py +0 -9
- hestia_earth/models/cycle/input/value.py +0 -6
- hestia_earth/models/cycle/liveAnimal.py +0 -5
- hestia_earth/models/cycle/materialAndSubstrate.py +1 -6
- hestia_earth/models/cycle/milkYield.py +0 -10
- hestia_earth/models/cycle/otherSitesArea.py +0 -6
- hestia_earth/models/cycle/otherSitesUnusedDuration.py +0 -6
- hestia_earth/models/cycle/pastureSystem.py +0 -6
- hestia_earth/models/cycle/post_checks/cache.py +0 -5
- hestia_earth/models/cycle/post_checks/otherSites.py +0 -7
- hestia_earth/models/cycle/post_checks/site.py +0 -7
- hestia_earth/models/cycle/practice/value.py +0 -7
- hestia_earth/models/cycle/pre_checks/cache_sources.py +0 -5
- hestia_earth/models/cycle/pre_checks/otherSites.py +0 -7
- hestia_earth/models/cycle/pre_checks/site.py +0 -6
- hestia_earth/models/cycle/product/currency.py +0 -5
- hestia_earth/models/cycle/product/economicValueShare.py +0 -14
- hestia_earth/models/cycle/product/price.py +0 -5
- hestia_earth/models/cycle/product/primary.py +0 -5
- hestia_earth/models/cycle/product/properties.py +0 -7
- hestia_earth/models/cycle/product/revenue.py +0 -9
- hestia_earth/models/cycle/product/value.py +0 -6
- hestia_earth/models/cycle/siteArea.py +0 -6
- hestia_earth/models/cycle/siteDuration.py +0 -10
- hestia_earth/models/cycle/siteUnusedDuration.py +0 -6
- hestia_earth/models/cycle/startDate.py +0 -8
- hestia_earth/models/cycle/startDateDefinition.py +0 -6
- hestia_earth/models/cycle/transformation.py +0 -5
- hestia_earth/models/dammgen2009/noxToAirExcreta.py +2 -2
- hestia_earth/models/ecoinventV3/__init__.py +0 -15
- hestia_earth/models/ecoinventV3AndEmberClimate/__init__.py +0 -11
- hestia_earth/models/emepEea2019/nh3ToAirExcreta.py +14 -40
- hestia_earth/models/emepEea2019/pm10ToAirAnimalHousing.py +0 -4
- hestia_earth/models/emepEea2019/pm25ToAirAnimalHousing.py +0 -4
- hestia_earth/models/emepEea2019/tspToAirAnimalHousing.py +0 -4
- hestia_earth/models/emissionNotRelevant/__init__.py +0 -5
- hestia_earth/models/environmentalFootprintV3_1/environmentalFootprintSingleOverallScore.py +0 -9
- hestia_earth/models/environmentalFootprintV3_1/soilQualityIndexLandOccupation.py +0 -6
- hestia_earth/models/environmentalFootprintV3_1/soilQualityIndexLandTransformation.py +0 -6
- hestia_earth/models/environmentalFootprintV3_1/soilQualityIndexTotalLandUseEffects.py +0 -6
- hestia_earth/models/epa2014/no3ToGroundwaterExcreta.py +2 -2
- hestia_earth/models/faostat2018/product/price.py +0 -5
- hestia_earth/models/geospatialDatabase/awareWaterBasinId.py +0 -5
- hestia_earth/models/geospatialDatabase/ecoClimateZone.py +1 -20
- hestia_earth/models/geospatialDatabase/ecoregion.py +0 -7
- hestia_earth/models/geospatialDatabase/potentialEvapotranspirationAnnual.py +0 -4
- hestia_earth/models/geospatialDatabase/potentialEvapotranspirationMonthly.py +0 -4
- hestia_earth/models/geospatialDatabase/precipitationAnnual.py +0 -4
- hestia_earth/models/geospatialDatabase/precipitationMonthly.py +0 -4
- hestia_earth/models/geospatialDatabase/region.py +0 -5
- hestia_earth/models/geospatialDatabase/temperatureAnnual.py +0 -4
- hestia_earth/models/geospatialDatabase/temperatureMonthly.py +0 -4
- hestia_earth/models/haversineFormula/transport/distance.py +0 -7
- hestia_earth/models/hestia/landCover.py +31 -18
- hestia_earth/models/hestia/landTransformation100YearAverageDuringCycle.py +0 -11
- hestia_earth/models/hestia/landTransformation20YearAverageDuringCycle.py +0 -11
- hestia_earth/models/hestia/nh3ToSurfaceWaterAquacultureSystems.py +64 -0
- hestia_earth/models/hestia/residueRemoved.py +0 -4
- hestia_earth/models/hestia/resourceUse_utils.py +0 -5
- hestia_earth/models/hestia/seed_emissions.py +0 -13
- hestia_earth/models/impact_assessment/allocationMethod.py +0 -6
- hestia_earth/models/impact_assessment/emissions.py +0 -9
- hestia_earth/models/impact_assessment/irrigated.py +0 -5
- hestia_earth/models/impact_assessment/organic.py +0 -5
- hestia_earth/models/impact_assessment/post_checks/cycle.py +0 -7
- hestia_earth/models/impact_assessment/post_checks/site.py +0 -7
- hestia_earth/models/impact_assessment/pre_checks/cycle.py +0 -6
- hestia_earth/models/impact_assessment/pre_checks/site.py +0 -6
- hestia_earth/models/impact_assessment/product/economicValueShare.py +0 -6
- hestia_earth/models/impact_assessment/product/value.py +0 -5
- hestia_earth/models/ipcc2019/aboveGroundBiomass.py +9 -2
- hestia_earth/models/ipcc2019/animal/milkYieldPerAnimal.py +0 -6
- hestia_earth/models/ipcc2019/animal/pastureGrass.py +0 -10
- hestia_earth/models/ipcc2019/animal/weightAtMaturity.py +0 -4
- hestia_earth/models/ipcc2019/belowGroundBiomass.py +9 -2
- hestia_earth/models/ipcc2019/co2ToAirSoilOrganicCarbonStockChange.py +1 -1
- hestia_earth/models/ipcc2019/croppingDuration.py +0 -5
- hestia_earth/models/ipcc2019/n2OToAirExcretaDirect.py +1 -1
- hestia_earth/models/ipcc2019/no3ToGroundwaterExcreta.py +51 -15
- hestia_earth/models/ipcc2019/nonCo2EmissionsToAirNaturalVegetationBurning.py +0 -12
- hestia_earth/models/ipcc2019/organicCarbonPerHa.py +2 -15
- hestia_earth/models/ipcc2019/{organicCarbonPerHa_tier_1_utils.py → organicCarbonPerHa_tier_1.py} +3 -15
- hestia_earth/models/ipcc2019/{organicCarbonPerHa_tier_2_utils.py → organicCarbonPerHa_tier_2.py} +3 -13
- hestia_earth/models/ipcc2019/pastureGrass.py +0 -10
- hestia_earth/models/koble2014/aboveGroundCropResidue.py +0 -9
- hestia_earth/models/koble2014/cropResidueManagement.py +0 -6
- hestia_earth/models/linkedImpactAssessment/emissions.py +0 -5
- hestia_earth/models/mocking/search-results.json +1241 -1185
- hestia_earth/models/pooreNemecek2018/ch4ToAirAquacultureSystems.py +14 -15
- hestia_earth/models/pooreNemecek2018/excretaKgN.py +12 -17
- hestia_earth/models/pooreNemecek2018/excretaKgVs.py +22 -23
- hestia_earth/models/pooreNemecek2018/n2OToAirAquacultureSystemsDirect.py +6 -9
- hestia_earth/models/pooreNemecek2018/n2ToAirAquacultureSystems.py +6 -9
- hestia_earth/models/pooreNemecek2018/nh3ToAirAquacultureSystems.py +11 -15
- hestia_earth/models/pooreNemecek2018/noxToAirAquacultureSystems.py +6 -9
- hestia_earth/models/site/defaultMethodClassification.py +0 -7
- hestia_earth/models/site/defaultMethodClassificationDescription.py +0 -7
- hestia_earth/models/site/flowingWater.py +0 -5
- hestia_earth/models/site/management.py +0 -21
- hestia_earth/models/site/measurement/value.py +0 -6
- hestia_earth/models/site/post_checks/country.py +0 -5
- hestia_earth/models/site/potentialEvapotranspirationAnnual.py +0 -3
- hestia_earth/models/site/potentialEvapotranspirationMonthly.py +0 -3
- hestia_earth/models/site/pre_checks/cache_geospatialDatabase.py +0 -5
- hestia_earth/models/site/pre_checks/cache_sources.py +0 -5
- hestia_earth/models/site/pre_checks/cache_years.py +0 -5
- hestia_earth/models/site/pre_checks/country.py +0 -5
- hestia_earth/models/site/precipitationAnnual.py +0 -3
- hestia_earth/models/site/precipitationMonthly.py +0 -3
- hestia_earth/models/site/rainfallAnnual.py +0 -3
- hestia_earth/models/site/rainfallMonthly.py +0 -3
- hestia_earth/models/site/soilMeasurement.py +2 -5
- hestia_earth/models/site/temperatureAnnual.py +0 -3
- hestia_earth/models/site/temperatureMonthly.py +0 -3
- hestia_earth/models/transformation/input/excreta.py +0 -5
- hestia_earth/models/transformation/input/max.py +0 -8
- hestia_earth/models/transformation/input/min.py +0 -8
- hestia_earth/models/transformation/input/properties.py +0 -6
- hestia_earth/models/transformation/input/sd.py +0 -8
- hestia_earth/models/transformation/input/value.py +0 -8
- hestia_earth/models/transformation/product/excreta.py +0 -7
- hestia_earth/models/utils/excretaManagement.py +37 -0
- hestia_earth/models/utils/lookup.py +2 -0
- hestia_earth/models/utils/measurement.py +1 -1
- hestia_earth/models/utils/practice.py +1 -27
- hestia_earth/models/utils/source.py +29 -9
- hestia_earth/models/version.py +1 -1
- hestia_earth/orchestrator/strategies/run/add_blank_node_if_missing.py +12 -8
- {hestia_earth_models-0.68.0.dist-info → hestia_earth_models-0.69.0.dist-info}/METADATA +2 -2
- {hestia_earth_models-0.68.0.dist-info → hestia_earth_models-0.69.0.dist-info}/RECORD +180 -188
- tests/models/emepEea2019/test_nh3ToAirExcreta.py +6 -17
- tests/models/hestia/test_nh3ToSurfaceWaterAquacultureSystems.py +51 -0
- tests/models/ipcc2019/test_aboveGroundBiomass.py +4 -0
- tests/models/ipcc2019/test_belowGroundBiomass.py +4 -0
- tests/models/ipcc2019/test_co2ToAirSoilOrganicCarbonStockChange.py +1 -1
- tests/models/ipcc2019/test_no3ToGroundwaterExcreta.py +24 -9
- tests/models/ipcc2019/test_organicCarbonPerHa.py +2 -2
- tests/models/ipcc2019/{test_organicCarbonPerHa_tier_1_utils.py → test_organicCarbonPerHa_tier_1.py} +2 -2
- tests/models/ipcc2019/{test_organicCarbonPerHa_tier_2_utils.py → test_organicCarbonPerHa_tier_2.py} +2 -2
- tests/models/pooreNemecek2018/test_ch4ToAirAquacultureSystems.py +1 -7
- tests/models/pooreNemecek2018/test_n2OToAirAquacultureSystemsDirect.py +1 -7
- tests/models/pooreNemecek2018/test_n2ToAirAquacultureSystems.py +1 -7
- tests/models/pooreNemecek2018/test_nh3ToAirAquacultureSystems.py +1 -7
- tests/models/pooreNemecek2018/test_noxToAirAquacultureSystems.py +1 -7
- tests/models/utils/test_source.py +6 -1
- tests/orchestrator/strategies/run/test_add_blank_node_if_missing.py +1 -1
- hestia_earth/models/blonkConsultants2016/__init__.py +0 -13
- hestia_earth/models/blonkConsultants2016/ch4ToAirNaturalVegetationBurning.py +0 -78
- hestia_earth/models/blonkConsultants2016/co2ToAirAboveGroundBiomassStockChangeLandUseChange.py +0 -78
- hestia_earth/models/blonkConsultants2016/n2OToAirNaturalVegetationBurningDirect.py +0 -78
- hestia_earth/models/blonkConsultants2016/utils.py +0 -30
- tests/models/blonkConsultants2016/__init__.py +0 -0
- tests/models/blonkConsultants2016/test_ch4ToAirNaturalVegetationBurning.py +0 -34
- tests/models/blonkConsultants2016/test_co2ToAirAboveGroundBiomassStockChangeLandUseChange.py +0 -36
- tests/models/blonkConsultants2016/test_n2OToAirNaturalVegetationBurningDirect.py +0 -34
- tests/models/blonkConsultants2016/test_utils.py +0 -9
- {hestia_earth_models-0.68.0.dist-info → hestia_earth_models-0.69.0.dist-info}/LICENSE +0 -0
- {hestia_earth_models-0.68.0.dist-info → hestia_earth_models-0.69.0.dist-info}/WHEEL +0 -0
- {hestia_earth_models-0.68.0.dist-info → hestia_earth_models-0.69.0.dist-info}/top_level.txt +0 -0
@@ -1,30 +0,0 @@
|
|
1
|
-
from hestia_earth.utils.model import find_primary_product
|
2
|
-
from hestia_earth.utils.lookup import extract_grouped_data
|
3
|
-
from hestia_earth.utils.tools import safe_parse_float
|
4
|
-
|
5
|
-
from hestia_earth.models.log import logger
|
6
|
-
from hestia_earth.models.utils.crop import FAOSTAT_AREA_LOOKUP_COLUMN, get_crop_grouping_faostat_area
|
7
|
-
from hestia_earth.models.utils.lookup import get_region_lookup_value
|
8
|
-
from . import MODEL
|
9
|
-
|
10
|
-
|
11
|
-
def get_emission_factor(term_id: str, cycle: dict, factor: str):
|
12
|
-
site = cycle.get('site', {})
|
13
|
-
country_id = site.get('country', {}).get('@id')
|
14
|
-
product = find_primary_product(cycle) or {}
|
15
|
-
product_id = product.get('term', {}).get('@id')
|
16
|
-
crop_grouping = get_crop_grouping_faostat_area(MODEL, term_id, product.get('term', {}))
|
17
|
-
|
18
|
-
logger.debug('model=%s, country=%s, product=%s, crop_grouping=%s',
|
19
|
-
MODEL, country_id, product_id, f"'{crop_grouping}'")
|
20
|
-
|
21
|
-
lookup_name = f"region-crop-{FAOSTAT_AREA_LOOKUP_COLUMN}-{factor}.csv"
|
22
|
-
value = get_region_lookup_value(
|
23
|
-
lookup_name, country_id, crop_grouping, model=MODEL, term=term_id
|
24
|
-
) if crop_grouping else get_region_lookup_value(
|
25
|
-
lookup_name, country_id, 'NONE', model=MODEL, term=term_id
|
26
|
-
)
|
27
|
-
|
28
|
-
data = safe_parse_float(value, None)
|
29
|
-
# fallback to site.siteType data if possible
|
30
|
-
return data if data is not None else safe_parse_float(extract_grouped_data(value, site.get('siteType')), None)
|
File without changes
|
@@ -1,34 +0,0 @@
|
|
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.blonkConsultants2016.ch4ToAirNaturalVegetationBurning import MODEL, TERM_ID, run, _should_run
|
6
|
-
|
7
|
-
class_path = f"hestia_earth.models.{MODEL}.{TERM_ID}"
|
8
|
-
fixtures_folder = f"{fixtures_path}/{MODEL}/{TERM_ID}"
|
9
|
-
|
10
|
-
|
11
|
-
@patch(f"{class_path}.land_occupation_per_ha", return_value=None)
|
12
|
-
@patch(f"{class_path}.get_emission_factor", return_value=None)
|
13
|
-
def test_should_run(mock_factor, mock_landOccupation):
|
14
|
-
# with land occupation => no run
|
15
|
-
mock_landOccupation.return_value = 10
|
16
|
-
should_run, *args = _should_run({'functionalUnit': '1 ha'})
|
17
|
-
assert not should_run
|
18
|
-
|
19
|
-
# with emission factor => run
|
20
|
-
mock_factor.return_value = 10
|
21
|
-
should_run, *args = _should_run({'functionalUnit': '1 ha'})
|
22
|
-
assert should_run is True
|
23
|
-
|
24
|
-
|
25
|
-
@patch(f"{class_path}._new_emission", side_effect=fake_new_emission)
|
26
|
-
def test_run(*args):
|
27
|
-
with open(f"{fixtures_folder}/cycle.jsonld", encoding='utf-8') as f:
|
28
|
-
cycle = json.load(f)
|
29
|
-
|
30
|
-
with open(f"{fixtures_folder}/result.jsonld", encoding='utf-8') as f:
|
31
|
-
expected = json.load(f)
|
32
|
-
|
33
|
-
value = run(cycle)
|
34
|
-
assert value == expected
|
tests/models/blonkConsultants2016/test_co2ToAirAboveGroundBiomassStockChangeLandUseChange.py
DELETED
@@ -1,36 +0,0 @@
|
|
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.blonkConsultants2016.co2ToAirAboveGroundBiomassStockChangeLandUseChange import (
|
6
|
-
MODEL, TERM_ID, run, _should_run
|
7
|
-
)
|
8
|
-
|
9
|
-
class_path = f"hestia_earth.models.{MODEL}.{TERM_ID}"
|
10
|
-
fixtures_folder = f"{fixtures_path}/{MODEL}/{TERM_ID}"
|
11
|
-
|
12
|
-
|
13
|
-
@patch(f"{class_path}.land_occupation_per_ha", return_value=None)
|
14
|
-
@patch(f"{class_path}.get_emission_factor", return_value=None)
|
15
|
-
def test_should_run(mock_factor, mock_landOccupation):
|
16
|
-
# with land occupation => no run
|
17
|
-
mock_landOccupation.return_value = 10
|
18
|
-
should_run, *args = _should_run({'functionalUnit': '1 ha'})
|
19
|
-
assert not should_run
|
20
|
-
|
21
|
-
# with emission factor => run
|
22
|
-
mock_factor.return_value = 10
|
23
|
-
should_run, *args = _should_run({'functionalUnit': '1 ha'})
|
24
|
-
assert should_run is True
|
25
|
-
|
26
|
-
|
27
|
-
@patch(f"{class_path}._new_emission", side_effect=fake_new_emission)
|
28
|
-
def test_run(*args):
|
29
|
-
with open(f"{fixtures_folder}/cycle.jsonld", encoding='utf-8') as f:
|
30
|
-
cycle = json.load(f)
|
31
|
-
|
32
|
-
with open(f"{fixtures_folder}/result.jsonld", encoding='utf-8') as f:
|
33
|
-
expected = json.load(f)
|
34
|
-
|
35
|
-
value = run(cycle)
|
36
|
-
assert value == expected
|
@@ -1,34 +0,0 @@
|
|
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.blonkConsultants2016.n2OToAirNaturalVegetationBurningDirect import TERM_ID, run, _should_run
|
6
|
-
|
7
|
-
class_path = f"hestia_earth.models.blonkConsultants2016.{TERM_ID}"
|
8
|
-
fixtures_folder = f"{fixtures_path}/blonkConsultants2016/{TERM_ID}"
|
9
|
-
|
10
|
-
|
11
|
-
@patch(f"{class_path}.land_occupation_per_ha", return_value=None)
|
12
|
-
@patch(f"{class_path}.get_emission_factor", return_value=None)
|
13
|
-
def test_should_run(mock_factor, mock_landOccupation):
|
14
|
-
# with land occupation => no run
|
15
|
-
mock_landOccupation.return_value = 10
|
16
|
-
should_run, *args = _should_run({'functionalUnit': '1 ha'})
|
17
|
-
assert not should_run
|
18
|
-
|
19
|
-
# with emission factor => run
|
20
|
-
mock_factor.return_value = 10
|
21
|
-
should_run, *args = _should_run({'functionalUnit': '1 ha'})
|
22
|
-
assert should_run is True
|
23
|
-
|
24
|
-
|
25
|
-
@patch(f"{class_path}._new_emission", side_effect=fake_new_emission)
|
26
|
-
def test_run(*args):
|
27
|
-
with open(f"{fixtures_folder}/cycle.jsonld", encoding='utf-8') as f:
|
28
|
-
cycle = json.load(f)
|
29
|
-
|
30
|
-
with open(f"{fixtures_folder}/result.jsonld", encoding='utf-8') as f:
|
31
|
-
expected = json.load(f)
|
32
|
-
|
33
|
-
value = run(cycle)
|
34
|
-
assert value == expected
|
@@ -1,9 +0,0 @@
|
|
1
|
-
from hestia_earth.models.blonkConsultants2016.utils import get_emission_factor
|
2
|
-
|
3
|
-
|
4
|
-
def test_get_emission_factor_no_product_match():
|
5
|
-
cycle = {'site': {'country': {'@id': 'GADM-ALB'}, 'siteType': 'permanent pasture'}}
|
6
|
-
|
7
|
-
assert get_emission_factor('', cycle, 'co2LandUseChange') == 566.523273292322
|
8
|
-
assert get_emission_factor('', cycle, 'ch4forestBiomassBurning') == 0.29
|
9
|
-
assert get_emission_factor('', cycle, 'n2oforestBiomassBurning') == 0.016
|
File without changes
|
File without changes
|
File without changes
|