hestia-earth.calculation


Namehestia-earth.calculation JSON
Version 0.0.16 PyPI version JSON
download
home_pagehttps://gitlab.com/hestia-earth/hestia-calculation-engine
SummaryHestia's set of modules for creating structured data models from LCA observations and evaluating biogeochemical aspects of specific farming cycles
upload_time2021-02-01 06:53:43
maintainer
docs_urlNone
authorHestia Team
requires_python
licenseGPL
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Hestia Calculation Engine

Hestia's set of modules for creating structured data models from LCA observations and evaluating biogeochemical aspects of specific farming cycles

## Install

1. Install the module:
```bash
pip install hestia_earth.calculation
```

2. Download the latest data:
```bash
curl https://gitlab.com/hestia-earth/hestia-calculation-engine/-/raw/master/scripts/download_data.sh?inline=false -o download_data.sh && chmod +x download_data.sh
# pip default install directory is /usr/local/lib/python<version>/site-packages
./download_data.sh <API_URL> <SEARCH_URL> <pip install directory>
```

To use the production-ready version of the data, please use `API_URL=https://api.hestia.earth` and `SEARCH_URL=https://search.hestia.earth`. For development version, please contact us at <community@hestia.earth>

## Usage

```python
from hestia_earth.calculation import CalculationEngine
# Create CalculationEngine object
engine = CalculationEngine('url')
# ingest data ('cycle', 'site', 'assessments' are keyword arguments)
engine.import_data(cycle=ingested_cycle, site=ingested_site, assessments=ingested_assessments)
# do the calculations
engine.run()
# retrieve the calculated data
engine.export_data()
```


### Recalculating a Cycle

If only a cycle is provided it only recalculates the cycle,

```python
cycle = {"@type": "Cycle", ...}
engine.import_data(cycle=cycle)
engine.run()
data = engine.export_data()
# data = {"@type": "Cycle", ...}  (recalculated cycle)
```

and the exported object is the recalculated cycle. In this case there are no assessments calculated.


### Recalculating a Cycle with a Site


If a cycle and an a site are provided it recalculates everything with the data of the cycle and the site,

```python
cycle = {"@type": "Cycle", ...}
site = {"@type": "Site", ...}
engine.import_data(cycle=cycle, site=site)
engine.run()
data = engine.export_data()
# data = {"@type": "Cycle", ...}  (recalculated cycle)
```

and the exported object is again a recalculated cycle. In this case there are no assessments calculated.


### Recalculating ImpactAssessment


If only assessment is provided then the engine recalculates the assessments with the cycle specified inside every assessment. 

```python
assessment = [{"@type": "ImpactAssessment", "name": "Assessment_1" ...}, {"@type": "ImpactAssessment", "name": "Assessment_2" ...}, ...]
engine.import_data(assessment=assessment)
engine.run()
data = engine.export_data()
# data = [{"@type": "ImpactAssessment", "name": "Assessment_1" ...}, {"@type": "ImpactAssessment", "name": "Assessment_2" ...}, {"@type": "ImpactAssessment", "name": "Assessment_3", ...] (recalculated and updated assessments)
```

The engine then does the calculations and updates the assessments for the values that are different if they exist or creating new assessments if they do not exist. The exported object is a list with the recalculated assessments.


### Recalculating ImpactAssessment with Cycle and Site


If the three arguments are provided (cycle, site, and assessment) then the calculations are done with the cycle and site especifically indicated and not taking into account the one inside every assessment. 

```python
cycle = {"@type": "Cycle", ...}
site = {"@type": "Site", ...}
assessment = [{"@type": "ImpactAssessment", "name": "Assessment_1" ...}, {"@type": "ImpactAssessment", "name": "Assessment_2" ...}, ...]
engine.import_data(cycle=cycle, site=site, assessment=assessment)
engine.run()
data = engine.export_data()
# data = [{"@type": "ImpactAssessment", "name": "Assessment_1" ...}, {"@type": "ImpactAssessment", "name": "Assessment_2" ...}, ...] (recalculated and updated assessments)
```

The engine then does the calculations and updates the assessments for the values that are different if they exist or creating new assessments if they do not exist. The exported object is a list with the recalculated assessments.







            

Raw data

            {
    "_id": null,
    "home_page": "https://gitlab.com/hestia-earth/hestia-calculation-engine",
    "name": "hestia-earth.calculation",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Hestia Team",
    "author_email": "juan.sabuco@ouce.ox.ac.uk",
    "download_url": "https://files.pythonhosted.org/packages/01/be/394265feb4f2f5946d324678577f77658d20d59e4e1604841cc57b95b813/hestia_earth.calculation-0.0.16.tar.gz",
    "platform": "",
    "description": "# Hestia Calculation Engine\n\nHestia's set of modules for creating structured data models from LCA observations and evaluating biogeochemical aspects of specific farming cycles\n\n## Install\n\n1. Install the module:\n```bash\npip install hestia_earth.calculation\n```\n\n2. Download the latest data:\n```bash\ncurl https://gitlab.com/hestia-earth/hestia-calculation-engine/-/raw/master/scripts/download_data.sh?inline=false -o download_data.sh && chmod +x download_data.sh\n# pip default install directory is /usr/local/lib/python<version>/site-packages\n./download_data.sh <API_URL> <SEARCH_URL> <pip install directory>\n```\n\nTo use the production-ready version of the data, please use `API_URL=https://api.hestia.earth` and `SEARCH_URL=https://search.hestia.earth`. For development version, please contact us at <community@hestia.earth>\n\n## Usage\n\n```python\nfrom hestia_earth.calculation import CalculationEngine\n# Create CalculationEngine object\nengine = CalculationEngine('url')\n# ingest data ('cycle', 'site', 'assessments' are keyword arguments)\nengine.import_data(cycle=ingested_cycle, site=ingested_site, assessments=ingested_assessments)\n# do the calculations\nengine.run()\n# retrieve the calculated data\nengine.export_data()\n```\n\n\n### Recalculating a Cycle\n\nIf only a cycle is provided it only recalculates the cycle,\n\n```python\ncycle = {\"@type\": \"Cycle\", ...}\nengine.import_data(cycle=cycle)\nengine.run()\ndata = engine.export_data()\n# data = {\"@type\": \"Cycle\", ...}  (recalculated cycle)\n```\n\nand the exported object is the recalculated cycle. In this case there are no assessments calculated.\n\n\n### Recalculating a Cycle with a Site\n\n\nIf a cycle and an a site are provided it recalculates everything with the data of the cycle and the site,\n\n```python\ncycle = {\"@type\": \"Cycle\", ...}\nsite = {\"@type\": \"Site\", ...}\nengine.import_data(cycle=cycle, site=site)\nengine.run()\ndata = engine.export_data()\n# data = {\"@type\": \"Cycle\", ...}  (recalculated cycle)\n```\n\nand the exported object is again a recalculated cycle. In this case there are no assessments calculated.\n\n\n### Recalculating ImpactAssessment\n\n\nIf only assessment is provided then the engine recalculates the assessments with the cycle specified inside every assessment. \n\n```python\nassessment = [{\"@type\": \"ImpactAssessment\", \"name\": \"Assessment_1\" ...}, {\"@type\": \"ImpactAssessment\", \"name\": \"Assessment_2\" ...}, ...]\nengine.import_data(assessment=assessment)\nengine.run()\ndata = engine.export_data()\n# data = [{\"@type\": \"ImpactAssessment\", \"name\": \"Assessment_1\" ...}, {\"@type\": \"ImpactAssessment\", \"name\": \"Assessment_2\" ...}, {\"@type\": \"ImpactAssessment\", \"name\": \"Assessment_3\", ...] (recalculated and updated assessments)\n```\n\nThe engine then does the calculations and updates the assessments for the values that are different if they exist or creating new assessments if they do not exist. The exported object is a list with the recalculated assessments.\n\n\n### Recalculating ImpactAssessment with Cycle and Site\n\n\nIf the three arguments are provided (cycle, site, and assessment) then the calculations are done with the cycle and site especifically indicated and not taking into account the one inside every assessment. \n\n```python\ncycle = {\"@type\": \"Cycle\", ...}\nsite = {\"@type\": \"Site\", ...}\nassessment = [{\"@type\": \"ImpactAssessment\", \"name\": \"Assessment_1\" ...}, {\"@type\": \"ImpactAssessment\", \"name\": \"Assessment_2\" ...}, ...]\nengine.import_data(cycle=cycle, site=site, assessment=assessment)\nengine.run()\ndata = engine.export_data()\n# data = [{\"@type\": \"ImpactAssessment\", \"name\": \"Assessment_1\" ...}, {\"@type\": \"ImpactAssessment\", \"name\": \"Assessment_2\" ...}, ...] (recalculated and updated assessments)\n```\n\nThe engine then does the calculations and updates the assessments for the values that are different if they exist or creating new assessments if they do not exist. The exported object is a list with the recalculated assessments.\n\n\n\n\n\n\n",
    "bugtrack_url": null,
    "license": "GPL",
    "summary": "Hestia's set of modules for creating structured data models from LCA observations and evaluating biogeochemical aspects of specific farming cycles",
    "version": "0.0.16",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "dbb2d94b7e5c4642984d38ddfc2aae0f",
                "sha256": "648171a5e6e96adf7716751ebc0384fccfa3e77376389b1beff2d5bc2f13c95e"
            },
            "downloads": -1,
            "filename": "hestia_earth.calculation-0.0.16-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "dbb2d94b7e5c4642984d38ddfc2aae0f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 230597,
            "upload_time": "2021-02-01T06:53:41",
            "upload_time_iso_8601": "2021-02-01T06:53:41.626521Z",
            "url": "https://files.pythonhosted.org/packages/1e/6f/3bfd234bc790d2bc8d0f3bc3cc95e75190786ddffa26dae7177146307a74/hestia_earth.calculation-0.0.16-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "bc0328e13e509061a84d55c0f6a76bf6",
                "sha256": "00f654ec30c5e38f8c92417cfc7d83b8a3472c8ae59bad036e74f639ddafafe3"
            },
            "downloads": -1,
            "filename": "hestia_earth.calculation-0.0.16.tar.gz",
            "has_sig": false,
            "md5_digest": "bc0328e13e509061a84d55c0f6a76bf6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 156478,
            "upload_time": "2021-02-01T06:53:43",
            "upload_time_iso_8601": "2021-02-01T06:53:43.192039Z",
            "url": "https://files.pythonhosted.org/packages/01/be/394265feb4f2f5946d324678577f77658d20d59e4e1604841cc57b95b813/hestia_earth.calculation-0.0.16.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2021-02-01 06:53:43",
    "github": false,
    "gitlab": true,
    "bitbucket": false,
    "gitlab_user": null,
    "gitlab_project": "hestia-earth",
    "lcname": "hestia-earth.calculation"
}
        
Elapsed time: 0.23225s