HESTIA's set of modules for filling gaps in the activity data using external datasets (e.g. populating soil properties with a geospatial dataset using provided coordinates) and internal lookups (e.g. populating machinery use from fuel use). Includes rules for when gaps should be filled versus not (e.g. never gap fill yield, gap fill crop residue if yield provided etc.).
Project description
HESTIA Engine Models
HESTIA's set of models for running calculations or retrieving data using external datasets and internal lookups.
Documentation
Documentation for every model can be found in the HESTIA Guide.
Install
- Install python
3.12minimum - Install the module:
pip install hestia_earth.models
Usage
from hestia_earth.models.pooreNemecek2018 import run
cycle_data = {"@type": "Cycle", ...}
# cycle is a JSONLD node Cycle
result = run('no3ToGroundwaterSoilFlux', cycle_data)
print(result)
This will display only the result of the no3ToGroundwaterSoilFlux model (Emission).
Additionally, to reduce the number of queries to the HESTIA API and run the models faster, prefetching can be enabled:
from hestia_earth.models.preload_requests import enable_preload
enable_preload()
Using the orchestrator
The models come with an "orchestrator", which allows you to run a pre-configured set of models instead of a single one.
The configuration for each Node (Cycle, Site or ImpactAssessment) can be found in the config folder.
Usage:
from hestia_earth.orchestrator import run
from hestia_earth.models.config import load_config
cycle = {"@type": "Cycle", ...}
result = run(cycle, load_config(cycle))
print(result)
This will display the Cycle recalculated with all HESTIA default models running.
Using Spatial Models
We have models that can gap-fill geographical information on a Site. If you want to use these models:
- Install the library:
pip install hestia-earth-earth-engine - Follow the Getting Started instructions.
Collecting logs in JSON format
:info: This is an experimental feature and is not yet integrated in all the HESTIA tools.
To collect logs in JSON format:
- Set the env variable
LOG_JSON_ENABLEDtotrue - Use the following code to collect contribution logs:
from hestia_earth.orchestrator import run
from hestia_earth.models.config import load_config
from hestia_earth.models.log_utils import reset_collected_logs, get_collected_logs
# make sure the logs are reset before each run
reset_collected_logs()
# run the models as usual
impact = {"@type": "ImpactAssessment", ...}
result = run(impact, load_config(impact))
print(result)
# write the logs to a JSON file
logs = get_collected_logs()
with open("logs.json", "w") as f:
f.write(to_string(logs, indent=2))
Collecting contribution data
:info: This is an experimental feature and is not yet integrated in all the HESTIA tools.
To collect contribution data of impacts/endpoints on ImpactAssessment:
- Set the env variable
LOG_CONTRIBUTION_ENABLEDtotrue - Use the following code to collect contribution logs:
from hestia_earth.orchestrator import run
from hestia_earth.models.config import load_config
from hestia_earth.models.log_contribution import reset_contributions, get_contributions
# make sure the contributions are reset before each run
reset_contributions()
# run the models as usual
impact = {"@type": "ImpactAssessment", ...}
result = run(impact, load_config(impact))
print(result)
# write the contributions to a JSON file
contributions = get_contributions()
with open("contributions.json", "w") as f:
f.write(to_string(contributions, indent=2))
The contribution data will store the factors used for each emissionsResourceUse that contributes to specific impacts, and likewise impacts that contribute to endpoints. The index in the data represents the index of the blank node in the list of contributing blank nodes.
Using the ecoinventV3 model
:warning: This model has been deprecated and no further support will be provided.
ecoinvent is a consistent, transparent, and well validated life cycle inventory database. We use ecoinvent data to ascertain the environmental impacts of activities that occur outside of our system boundary, for example data on the environmental impacts of extracting oil and producing diesel, or the impacts of manufacturing plastics.
The ecoinventV3 model requires a valid license to run. We are currently working on a way to enable users of this code with a valid ecoinvent licence to run these models themselves, but for now, these models are only available on the public platform.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hestia_earth_models-0.79.5.tar.gz.
File metadata
- Download URL: hestia_earth_models-0.79.5.tar.gz
- Upload date:
- Size: 433.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a1cdb75fc649d81cf5257fb8b33c5da261dbf67094b76580c058edbd503ee34
|
|
| MD5 |
d6c6347ceedae8b6789a8a8dd900d638
|
|
| BLAKE2b-256 |
b5381e7ded02c475c99ef618393fd429610b78bba2b437ec44905762ec5f676c
|
File details
Details for the file hestia_earth_models-0.79.5-py3-none-any.whl.
File metadata
- Download URL: hestia_earth_models-0.79.5-py3-none-any.whl
- Upload date:
- Size: 838.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d43d8d03edc49c7d10745d1cf11b77092b57991bffa451e8d9741ef1ae52dc6
|
|
| MD5 |
838df09611e94f094fbdbc64849ce2e5
|
|
| BLAKE2b-256 |
89f2257ce969a9d61a49947bcea5b2ffe0080b03132c46c59694ffe2f5d6413b
|