@hestia-earth/engine-models 0.65.1
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.
- package/LICENSE +21 -0
- package/README.md +52 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +17 -0
- package/dist/models.d.ts +41 -0
- package/dist/models.js +5 -0
- package/model-links.json +3461 -0
- package/package.json +83 -0
- package/src/index.ts +1 -0
- package/src/models.spec.ts +12 -0
- package/src/models.ts +44 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019-2025 Harmonised Environmental Storage and Tracking of the Impacts of Agriculture (HESTIA) Project
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# HESTIA Engine Models
|
|
2
|
+
|
|
3
|
+
[](https://gitlab.com/hestia-earth/hestia-engine-models/commits/master)
|
|
4
|
+
[](https://gitlab.com/hestia-earth/hestia-engine-models/commits/master)
|
|
5
|
+
|
|
6
|
+
HESTIA's set of models for running calculations or retrieving data using external datasets and internal lookups.
|
|
7
|
+
|
|
8
|
+
## Documentation
|
|
9
|
+
|
|
10
|
+
Documentation for every model can be found in the [HESTIA API Documentation](https://hestia.earth/docs/#hestia-calculation-models).
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
1. Install python `3` (we recommend using python `3.6` minimum)
|
|
15
|
+
2. Install the module:
|
|
16
|
+
```bash
|
|
17
|
+
pip install hestia_earth.models
|
|
18
|
+
```
|
|
19
|
+
3. Set the following environment variables:
|
|
20
|
+
```
|
|
21
|
+
API_URL=https://api.hestia.earth
|
|
22
|
+
WEB_URL=https://hestia.earth
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Usage
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
from hestia_earth.models.pooreNemecek2018 import run
|
|
29
|
+
|
|
30
|
+
# cycle is a JSONLD node Cycle
|
|
31
|
+
run('no3ToGroundwaterSoilFlux', cycle_data)
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Additionally, to reduce the number of queries to the HESTIA API and run the models faster, prefetching can be enabled:
|
|
35
|
+
```python
|
|
36
|
+
from hestia_earth.models.preload_requests import enable_preload
|
|
37
|
+
|
|
38
|
+
enable_preload()
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Using Spatial Models
|
|
42
|
+
|
|
43
|
+
We have models that can gap-fill geographical information on a `Site`. If you want to use these models:
|
|
44
|
+
1. Install the library: `pip install hestia_earth.earth_engine`
|
|
45
|
+
2. Follow the [Getting Started instructions](https://gitlab.com/hestia-earth/hestia-earth-engine#getting-started).
|
|
46
|
+
|
|
47
|
+
### Using the ecoinventV3 model
|
|
48
|
+
|
|
49
|
+
ecoinvent is a consistent, transparent, and well validated life cycle inventory database.
|
|
50
|
+
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.
|
|
51
|
+
|
|
52
|
+
The `ecoinventV3` model requires a valid [license](https://ecoinvent.org/offerings/licences/) 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.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './models';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./models"), exports);
|
package/dist/models.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { EmissionMethodTier } from '@hestia-earth/schema';
|
|
2
|
+
export interface IModel {
|
|
3
|
+
/**
|
|
4
|
+
* Is model from EcoinventV3.
|
|
5
|
+
*/
|
|
6
|
+
ecoinvent: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Path to the implementation (code) of the model.
|
|
9
|
+
*/
|
|
10
|
+
path: string;
|
|
11
|
+
/**
|
|
12
|
+
* Path to the documentation of the model.
|
|
13
|
+
*/
|
|
14
|
+
docPath: string;
|
|
15
|
+
/**
|
|
16
|
+
* Path to the API Documentation.
|
|
17
|
+
*/
|
|
18
|
+
apiDocsPath?: string;
|
|
19
|
+
/**
|
|
20
|
+
* The name of the model used as `methodModel`.
|
|
21
|
+
*/
|
|
22
|
+
model: string;
|
|
23
|
+
/**
|
|
24
|
+
* The term the model is associated with.
|
|
25
|
+
*/
|
|
26
|
+
term?: string;
|
|
27
|
+
/**
|
|
28
|
+
* The methodTier of the Emission (if applicable).
|
|
29
|
+
*/
|
|
30
|
+
methodTier?: EmissionMethodTier;
|
|
31
|
+
/**
|
|
32
|
+
* A key in the model if term does not exist.
|
|
33
|
+
*/
|
|
34
|
+
modelKey?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface IModelLinks {
|
|
37
|
+
links: IModel[];
|
|
38
|
+
ecoinventLinks?: IModel[];
|
|
39
|
+
ecoinventV3AndEmberClimateLinks?: IModel[];
|
|
40
|
+
}
|
|
41
|
+
export declare const loadModels: () => IModelLinks;
|