Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
romainsacchi authored and romainsacchi committed Apr 11, 2024
1 parent e7dbce8 commit ca309a8
Showing 1 changed file with 58 additions and 10 deletions.
68 changes: 58 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ can be installed from the Github repo with ``pip``:

```

or alternatively, you can clone the repository and install it from the source:

```bash

git clone https://github.com/yourrepository/pathways.git
cd pathways
pip install -r requirements.txt

```


## Usage

Expand All @@ -37,21 +47,56 @@ or in a Python interpreter.

### Python

To use the Pathways class, you need to provide it with a datapackage that contains your scenario data, mapping information, and LCA matrices.
The datapackage should be a zip file that contains the following files:

- `datapackage.json`: a JSON file that describes the contents of the datapackage
- a `mapping` folder containing a `mapping.yaml` file that describes the mapping between the IAM scenario and the LCA databases
- a `inventories` folder containing the LCA matrices as CSV files
- a `scenario_data` folder containing the IAM scenario data as CSV file

```python

from pathways import Pathways
p = Pathways(datapackage="some datapackage.zip")
datapackage_path = "path/to/your/datapackage.zip"
p = Pathways(
datapackage=datapackage_path,
debug=True # optional, if you want to see the logs
)

# Define your parameters (leave any as None to use all available values)
methods = ["IPCC 2021", "ReCiPe 2016"]
models = ["ModelA", "ModelB"]
scenarios = ["Baseline", "Intervention"]
regions = ["Region1", "Region2"]
years = [2020, 2025]
variables = ["Electricity", "Transport"]

# Run the calculation
p.calculate(
methods=[
"EF v3.1 - acidification - accumulated exceedance (AE)"
],
years=[2080, 2090, 2100],
regions=["World"],
scenarios=["SSP2-Base", "SSP2-RCP26",]
methods=methods,
models=models,
scenarios=scenarios,
regions=regions,
years=years,
variables=variables,
characterization=True,
multiprocessing=True,
demand_cutoff=0.001,
use_distributions=0
)

```

The list of available LCIA methods can be obtained like so:

```python

print(p.lcia_methods)

```


The argument `datapackage` is the path to the datapackage.zip file
that describes the scenario and the LCA databases -- see dev/sample.
The argument `methods` is a list of methods to be used for the LCA
Expand All @@ -68,13 +113,16 @@ time-consuming.
Once calculated, the results of the LCA calculations are stored in the `.lcia_results`
attribute of the `Pathways` object as an ``xarray.DataArray``.

You can display the LCA results with an optional cutoff parameter to filter insignificant data:


```python

p.lcia_results
results = p.display_results(cutoff=0.001)
print(results)

```


It can be further formatted
to a pandas' DataFrame or export to a CSV/Excel file using the built-in
methods of ``xarray``.
Expand Down Expand Up @@ -129,7 +177,7 @@ The best way to send feedback is to file an issue on the GitHub repository.
### Contributors

* [Romain Sacchi](https://github.com/romainsacchi)
* Alvaro Hahn Menacho (https://github.com/alvarojhahn)
* [Alvaro Hahn Menacho](https://github.com/alvarojhahn)


### Financial Support
Expand Down

0 comments on commit ca309a8

Please sign in to comment.