Skip to content

Commit 6b52fde

Browse files
made every cheat sheet question a citable sub-heading
1 parent 1af5b57 commit 6b52fde

File tree

8 files changed

+118
-116
lines changed

8 files changed

+118
-116
lines changed

environment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ dependencies:
1212
- pydata-sphinx-theme=0.16.0 # website theme # https://anaconda.org/conda-forge/pydata-sphinx-theme/files
1313
- myst-parser=4.0.0 # Markdown support # https://anaconda.org/conda-forge/myst-parser/files
1414
- myst-nb=1.1.2 # Jupyter notebook support # https://anaconda.org/conda-forge/myst-nb/files
15-
- sphinx-autoapi=3.3.2 # to build docs from source code instead of package import # https://anaconda.org/conda-forge/sphinx-autoapi/files
15+
- sphinx-autoapi=3.3.3 # to build docs from source code instead of package import # https://anaconda.org/conda-forge/sphinx-autoapi/files
1616
- sphinx-design=0.6.1 # responsive web component support # https://anaconda.org/conda-forge/sphinx-design/files
1717
- sphinx-notfound-page=1.0.4 # custom 404 page # https://anaconda.org/conda-forge/sphinx-notfound-page/files
1818
- graphviz=12.0.0 # for plotting dependency diagrams with sphinx-autoapi # https://anaconda.org/conda-forge/graphviz/files

source/content/cheatsheet/databases.md

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,64 @@
1-
## Databases
1+
# Databases
22

3-
**Q:** How do I list all databases?
3+
## Basic Operations
4+
5+
### How do I list all databases?
46

57
```python
68
sorted(bd.databases)
79
```
810

9-
**Q:** How do I test if a given database is installed?
11+
### How do I test if a given database is installed?
1012

1113
```python
1214
'<my database label>' in bd.databases
1315
```
1416

15-
**Q:** How do I instantiate a `Database` object?
17+
### How do I instantiate a `Database` object?
1618

1719
```python
1820
my_db = bd.Database('<database_name>')
1921
```
2022

21-
**Q:** How do I copy a `Database`?
23+
### How do I copy a `Database`?
2224

2325
```python
2426
copied_database = bd.Database('<database_name>').copy('<new_name>')
2527
```
2628

27-
**Q:** How do I rename a `Database`?
29+
### How do I rename a `Database`?
2830

2931
```python
3032
new_database = bd.Database('<database_name>').rename('<new_name>')
3133
```
3234

33-
**Q:** How do I delete a `Database`?
35+
### How do I delete a `Database`?
3436

3537
```python
3638
del bd.databases['<database_name>']
3739
```
3840

39-
### Metadata
41+
## Metadata
4042

41-
**Q:** How do I see the `Database` metadata?
43+
### How do I see the `Database` metadata?
4244

4345
```python
4446
bd.Database('<database_name>').metadata
4547
```
4648

47-
**Q:** How do I change the `Database` metadata?
49+
### How do I change the `Database` metadata?
4850

4951
```python
5052
bd.Database('<database_name>').metadata['<some_key>'] = '<some_value>'
5153
```
5254

53-
**Q:** How do I see which other databases this `Database` refers to?
55+
### How do I see which other databases this `Database` refers to?
5456

5557
```python
5658
bd.Database('<database_name>').metadata['depends']
5759
```
5860

59-
**Q:** How can I see what kind of modelling paradigm and storage engine a `Database` uses?
61+
### How can I see what kind of modelling paradigm and storage engine a `Database` uses?
6062

6163
This information is given to a limited degree by the database backend:
6264

@@ -70,19 +72,19 @@ There are three backends in a normal Brightway installation:
7072
* `iotable`: Uses the SQLite database for nodes, but stores edges only in datapackages. Limits edges to a single numerical value without uncertainty, but gives better performance for large IO data.
7173
* `multifunctional`: Stores `multifunctional` processes as a custom node type, and automatically allocates following the given database or process preferences when creating datapackages.
7274

73-
### Searching
75+
## Searching
7476

75-
**Q:** How do I search a `Database`?
77+
### How do I search a `Database`?
7678

7779
```python
7880
bd.Database('<database_name>').search('<my_query_string>')
7981
```
8082

8183
See {py:obj}`bw2data.backends.base.SQLiteBackend.search` for documentation and function options.
8284

83-
### Datapackages
85+
## Datapackages
8486

85-
**Q:** How do I get the `bw_processing` datapackage for this `Database`?
87+
### How do I get the `bw_processing` datapackage for this `Database`?
8688

8789
```python
8890
bd.Database('<database_name>').datapackage()

source/content/cheatsheet/exporting.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Exporting Data or Projects
22

3-
**Q:** How do I share share my entire project with someone else?
3+
## Basic Operations
4+
5+
### How do I share share my entire project with someone else?
46

57
```python
68
bi.backup.backup_project_directory(project="<my_project>", dir_backup="<target_directory>")

source/content/cheatsheet/ia.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
## Impact Assessment
1+
# Impact Assessment
22

3-
### Impact Categories (`Method`)
3+
## Impact Categories (`Method`)
44

5-
**Q:** How do I list the installed impact categories?
5+
### How do I list the installed impact categories?
66

77
```python
88
sorted(bd.methods)
99
```
1010

11-
**Q:** How do I test if a given impact category is installed?
11+
### How do I test if a given impact category is installed?
1212

1313
```python
1414
('<impact>', '<category>') in bd.methods
1515
```
1616

17-
**Q:** How can I get a random impact category?
17+
### How can I get a random impact category?
1818

1919
```python
2020
bd.methods.random()
2121
```
2222

23-
**Q:** How do I search for an impact category using list comprehensions?
23+
### How do I search for an impact category using list comprehensions?
2424

2525
```python
2626
[
@@ -31,27 +31,27 @@ bd.methods.random()
3131
```
3232

3333
(iterate-lcia-method)=
34-
**Q:** How do I see the data in a given impact category?
34+
### How do I see the data in a given impact category?
3535

3636
```python
3737
my_method_object = bd.Method(('<impact>', '<category>'))
3838
list(my_method_object)
3939
```
4040

4141
(lcia-tuple-structure)=
42-
**Q:** How is the data in impact categories structured?
42+
### How is the data in impact categories structured?
4343

4444
Iterating over a `Method` object yields tuples.
4545

4646
* The first element in the tuple will be the biosphere `Node`
4747
* The second element will be the characterization factor, either as a number, or as a dictionary which includes uncertainty information
4848
* There could be a third element, which gives the *location* for the characterization factor. This third element is not required.
4949

50-
**Q:** How do I interpret the uncertainty dictionary?
50+
### How do I interpret the uncertainty dictionary?
5151

5252
See the [`stats_arrays` documentation](https://stats-arrays.readthedocs.io/en/latest/#mapping-parameter-array-columns-to-uncertainty-distributions).
5353

54-
**Q:** How do I create a new impact category?
54+
### How do I create a new impact category?
5555

5656
Start by defining characterization data following the tuple format defined in `How is the data in impact categories structured?`:
5757

@@ -75,13 +75,13 @@ Then write the characterization factor to the `Method`:
7575
bd.Method(('<impact>', '<category>')).write(my_cf_data)
7676
```
7777

78-
**Q:** How do I see the impact category metadata?
78+
### How do I see the impact category metadata?
7979

8080
```python
8181
bd.Method(('<impact>', '<category>')).metadata
8282
```
8383

84-
**Q:** How do I change the impact category metadata?
84+
### How do I change the impact category metadata?
8585

8686
```python
8787
bd.Method(('<impact>', '<category>')).metadata['<some_key>'] = '<some_value>'

0 commit comments

Comments
 (0)