Skip to content

Commit

Permalink
docs: update references for impacts object
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelrince committed Dec 7, 2024
1 parent 59452e2 commit 765110c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
17 changes: 11 additions & 6 deletions docs/tutorial/impacts.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# Environmental Impacts

Environmental impacts are reported for each request in the [`Impacts`][impacts.modeling.Impacts] pydantic model and features multiple [criteria](#criteria) such as the [energy](#energy) and [global warming potential](#global-warming-potential-gwp) per phase ([usage](#usage) or [embodied](#embodied)) as well as the total impacts.
Environmental impacts are reported for each request in the [`ImpactsOutput`][tracers.utils.ImpactsOutput] pydantic model and features multiple [criteria](#criteria) such as the [energy](#energy) and [global warming potential](#global-warming-potential-gwp) per phase ([usage](#usage) or [embodied](#embodied)) as well as the total impacts.

To learn more on how we estimate the environmental impacts and what are our hypotheses go to the [methodology](../methodology/index.md) section.

```python title="Structure of Impacts model"
from ecologits.impacts.modeling import *
from ecologits.tracers.utils import ImpactsOutput
from ecologits.impacts.modeling import ADPe, Embodied, Energy, GWP, PE, Usage

Impacts(
ImpactsOutput(
energy=Energy(), # (1)!
gwp=GWP(),
adpe=ADPe(),
Expand All @@ -22,13 +23,17 @@ Impacts(
gwp=GWP(),
adpe=ADPe(),
pe=PE(),
)
),
warnings=None, # (4)!
errors=None
)
```

1. Total impacts for all phases.
2. Usage impacts for the electricity consumption impacts. Note that the energy is equal to the "total" energy impact.
3. Embodied impacts for resource extract, manufacturing and transportation of hardware components allocated to the request.
4. List of [`WarningMessage`][status_messages.WarningMessage] and [`ErrorMessage`][status_messages.ErrorMessage].


You can extract an impact with:

Expand All @@ -43,10 +48,10 @@ Or you could get **value range** impact instead:

```python
>>> response.impacts.usage.gwp.value
Range(min=0.16, max=0.48) # Expressed in kgCO2eq (1)
RangeValue(min=0.16, max=0.48) # Expressed in kgCO2eq (1)
```

1. [`Range`][impacts.modeling.Range] are used to define intervals.
1. [`RangeValue`][utils.range_value.RangeValue] are used to define intervals.

## Criteria

Expand Down
14 changes: 14 additions & 0 deletions ecologits/status_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ def from_code(cls, code: str) -> type["_StatusMessage"]:


class WarningMessage(_StatusMessage):
"""
Warning message.
Attributes:
code: Warning code.
message: Warning message.
"""

@classmethod
def from_code(cls, code: str) -> "WarningMessage":
Expand All @@ -33,6 +40,13 @@ def from_code(cls, code: str) -> "WarningMessage":


class ErrorMessage(_StatusMessage):
"""
Error message.
Attributes:
code: Error code.
message: Error message.
"""

@classmethod
def from_code(cls, code: str) -> "ErrorMessage":
Expand Down

0 comments on commit 765110c

Please sign in to comment.