hestia-earth-models 0.73.8__py3-none-any.whl → 0.74.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.

Potentially problematic release.


This version of hestia-earth-models might be problematic. Click here for more details.

Files changed (59) hide show
  1. hestia_earth/models/aware/scarcityWeightedWaterUse.py +7 -6
  2. hestia_earth/models/aware2_0/__init__.py +14 -0
  3. hestia_earth/models/aware2_0/scarcityWeightedWaterUse.py +115 -0
  4. hestia_earth/models/config/Cycle.json +5 -3
  5. hestia_earth/models/config/ImpactAssessment.json +1 -1
  6. hestia_earth/models/config/__init__.py +26 -2
  7. hestia_earth/models/cycle/animal/input/hestiaAggregatedData.py +2 -2
  8. hestia_earth/models/cycle/animal/input/properties.py +6 -5
  9. hestia_earth/models/cycle/animal/milkYield.py +8 -3
  10. hestia_earth/models/cycle/utils.py +6 -6
  11. hestia_earth/models/data/ecoinventV3/__init__.py +8 -26
  12. hestia_earth/models/ecoalimV9/cycle.py +26 -10
  13. hestia_earth/models/ecoalimV9/impact_assessment.py +30 -10
  14. hestia_earth/models/ecoalimV9/utils.py +12 -72
  15. hestia_earth/models/ecoinventV3/__init__.py +8 -140
  16. hestia_earth/models/ecoinventV3/cycle.py +140 -0
  17. hestia_earth/models/ecoinventV3/utils.py +28 -1
  18. hestia_earth/models/ecoinventV3AndEmberClimate/__init__.py +8 -137
  19. hestia_earth/models/ecoinventV3AndEmberClimate/cycle.py +144 -0
  20. hestia_earth/models/emepEea2019/utils.py +2 -3
  21. hestia_earth/models/environmentalFootprintV3_1/environmentalFootprintSingleOverallScore.py +5 -7
  22. hestia_earth/models/frischknechtEtAl2000/ionisingRadiationKbqU235Eq.py +41 -43
  23. hestia_earth/models/geospatialDatabase/awareWaterBasinId.py +2 -2
  24. hestia_earth/models/geospatialDatabase/awareWaterBasinId_v1.py +45 -0
  25. hestia_earth/models/hestia/default_emissions.py +5 -1
  26. hestia_earth/models/hestia/default_resourceUse.py +5 -1
  27. hestia_earth/models/hestia/landCover.py +110 -12
  28. hestia_earth/models/hestia/utils.py +1 -0
  29. hestia_earth/models/hestia/waterSalinity.py +2 -3
  30. hestia_earth/models/impact_assessment/emissions.py +1 -1
  31. hestia_earth/models/linkedImpactAssessment/emissions.py +2 -2
  32. hestia_earth/models/log.py +8 -3
  33. hestia_earth/models/mocking/search-results.json +1562 -1558
  34. hestia_earth/models/transformation/product/excreta.py +2 -2
  35. hestia_earth/models/utils/__init__.py +3 -0
  36. hestia_earth/models/utils/background_emissions.py +109 -9
  37. hestia_earth/models/utils/blank_node.py +1 -11
  38. hestia_earth/models/utils/feedipedia.py +2 -2
  39. hestia_earth/models/utils/impact_assessment.py +1 -3
  40. hestia_earth/models/utils/lookup.py +1 -1
  41. hestia_earth/models/version.py +1 -1
  42. hestia_earth/orchestrator/log.py +8 -3
  43. {hestia_earth_models-0.73.8.dist-info → hestia_earth_models-0.74.1.dist-info}/METADATA +2 -2
  44. {hestia_earth_models-0.73.8.dist-info → hestia_earth_models-0.74.1.dist-info}/RECORD +59 -50
  45. tests/models/aware2_0/__init__.py +0 -0
  46. tests/models/aware2_0/test_scarcityWeightedWaterUse.py +58 -0
  47. tests/models/ecoinventV3/__init__.py +0 -0
  48. tests/models/{test_ecoinventV3.py → ecoinventV3/test_cycle.py} +5 -5
  49. tests/models/ecoinventV3AndEmberClimate/__init__.py +0 -0
  50. tests/models/{test_ecoinventV3AndEmberClimate.py → ecoinventV3AndEmberClimate/test_cycle.py} +6 -4
  51. tests/models/environmentalFootprintV3_1/test_environmentalFootprintSingleOverallScore.py +2 -2
  52. tests/models/frischknechtEtAl2000/test_ionisingRadiationKbqU235Eq.py +18 -27
  53. tests/models/hestia/test_landCover.py +16 -6
  54. tests/models/site/pre_checks/test_cache_geospatialDatabase.py +4 -4
  55. tests/models/test_config.py +53 -7
  56. tests/models/{ecoalimV9/test_utils.py → utils/test_background_emissions.py} +2 -2
  57. {hestia_earth_models-0.73.8.dist-info → hestia_earth_models-0.74.1.dist-info}/LICENSE +0 -0
  58. {hestia_earth_models-0.73.8.dist-info → hestia_earth_models-0.74.1.dist-info}/WHEEL +0 -0
  59. {hestia_earth_models-0.73.8.dist-info → hestia_earth_models-0.74.1.dist-info}/top_level.txt +0 -0
@@ -46,7 +46,7 @@ def _indicator(impact_assessment: dict, product: dict):
46
46
  if len(emission.get('inputs', [])):
47
47
  indicator['inputs'] = emission['inputs']
48
48
 
49
- return indicator | _include(emission, ['operation', 'transformation', 'country', 'key'])
49
+ return indicator | _include(emission, ['animals', 'operation', 'transformation', 'country', 'key'])
50
50
  return run
51
51
 
52
52
 
@@ -2,12 +2,12 @@ from functools import reduce
2
2
  from hestia_earth.schema import EmissionMethodTier
3
3
  from hestia_earth.utils.lookup import download_lookup, get_table_value, column_name
4
4
  from hestia_earth.utils.tools import flatten, list_sum
5
+ from hestia_earth.utils.blank_node import group_by_keys
5
6
 
6
7
  from hestia_earth.models.log import logShouldRun, debugValues, log_as_table
7
8
  from hestia_earth.models.utils import _include
8
9
  from hestia_earth.models.utils.emission import _new_emission
9
10
  from hestia_earth.models.utils.input import load_impacts
10
- from hestia_earth.models.utils.blank_node import group_by_keys
11
11
  from . import MODEL
12
12
 
13
13
  REQUIREMENTS = {
@@ -167,7 +167,7 @@ def run(cycle: dict):
167
167
 
168
168
  # group inputs with same term/key/operation/animal to avoid adding emissions twice
169
169
  # inputs = {'group-id': [{'term': {},'value':[10],'impactAssessment': {}}]}
170
- inputs = reduce(group_by_keys(_GROUP_BY_KEYS), inputs, {})
170
+ inputs = group_by_keys(inputs, _GROUP_BY_KEYS)
171
171
  inputs = {key: list(map(_group_input_emissions, value)) for key, value in inputs.items()}
172
172
 
173
173
  # finally group everything by emission so we can log inputs together
@@ -4,6 +4,8 @@ import logging
4
4
  from typing import Union, List
5
5
 
6
6
  LOG_LEVEL = os.getenv('LOG_LEVEL', 'INFO')
7
+ _EXTENDED_LOGS = os.getenv('LOG_EXTENDED', 'true') == 'true'
8
+ _LOG_DATE_FORMAT = os.getenv('LOG_DATE_FORMAT', '%Y-%m-%dT%H:%M:%S%z')
7
9
 
8
10
  # disable root logger
9
11
  root_logger = logging.getLogger()
@@ -26,9 +28,12 @@ def log_to_file(filepath: str):
26
28
  Path of the file.
27
29
  """
28
30
  formatter = logging.Formatter(
29
- '{"timestamp": "%(asctime)s", "level": "%(levelname)s", "logger": "%(name)s", '
30
- '"filename": "%(filename)s", "message": "%(message)s"}',
31
- '%Y-%m-%dT%H:%M:%S%z')
31
+ '{"timestamp": "%(asctime)s", "level": "%(levelname)s", "logger": "%(name)s", "message": "%(message)s"}',
32
+ _LOG_DATE_FORMAT
33
+ ) if _EXTENDED_LOGS else logging.Formatter(
34
+ '{"logger": "%(name)s", "message": "%(message)s"}',
35
+ _LOG_DATE_FORMAT
36
+ )
32
37
  handler = logging.FileHandler(filepath, encoding='utf-8')
33
38
  handler.setFormatter(formatter)
34
39
  handler.setLevel(logging.getLevelName(LOG_LEVEL))