-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tutorials: added tutorial for project configuration file
- Loading branch information
Peva Blanchard
committed
Jun 3, 2024
1 parent
8dee67b
commit 3ce9a5e
Showing
6 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Project description file | ||
|
||
A LCA as Code project can be specified with a YAML configuration. | ||
In this tutorial, the configuration file is used to specify: | ||
- the project name | ||
- the project description | ||
- and customizing the CSV connector | ||
|
||
Hence, the file `lcaac.yaml` contains | ||
```yaml | ||
name: Project file | ||
description: Sample project to illustrate the use of lcaac.yaml | ||
connectors: | ||
- name: csv | ||
options: | ||
directory: data | ||
``` | ||
while the file `lcaac-mock.yaml` contains | ||
```yaml | ||
name: Project file | ||
description: Sample project to illustrate the use of lcaac.yaml | ||
connectors: | ||
- name: csv | ||
options: | ||
directory: mock | ||
``` | ||
|
||
Here each file specifies a different location for the folder containing the CSV files supporting the datasources. | ||
You can choose which settings to use with the cli option `-p` or `--project`. | ||
```bash | ||
lcaac assess --project lcaac.yaml main | ||
lcaac assess --project lcaac-mock.yaml main | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
id,weight | ||
s01,1 | ||
s02,2 | ||
s03,3 | ||
s04,4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
name: Project file | ||
description: Sample project to illustrate the use of lcaac.yaml | ||
connectors: | ||
- name: csv | ||
options: | ||
directory: mock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
name: Project file | ||
description: Sample project to illustrate the use of lcaac.yaml | ||
connectors: | ||
- name: csv | ||
options: | ||
directory: data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
datasource inventory { | ||
location = "inventory.csv" | ||
schema { | ||
id = "s01" | ||
weight = 0 kg | ||
} | ||
} | ||
|
||
process main { | ||
products { | ||
1 kg main | ||
} | ||
impacts { | ||
for_each item from inventory { | ||
item.weight mass | ||
} | ||
} | ||
} | ||
|
||
test main_with_data { | ||
given { | ||
1 kg main from main | ||
} | ||
assert { | ||
mass between 10 kg and 10 kg | ||
} | ||
} | ||
|
||
test main_with_mock_data { | ||
given { | ||
1 kg main from main | ||
} | ||
assert { | ||
mass between 100 kg and 100 kg | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
id,weight | ||
s01,10 | ||
s02,20 | ||
s03,30 | ||
s04,40 |