carbon
zeus.carbon
Carbon intensity providers used for carbon-aware optimizers.
ZeusCarbonIntensityNotFoundError
Bases: ZeusBaseError
Exception when carbon intensity measurement could not be retrieved.
Source code in zeus/carbon.py
31 32 33 34 35 36 |
|
__init__
__init__(message)
Source code in zeus/carbon.py
34 35 36 |
|
CarbonIntensityProvider
Bases: ABC
Abstract class for implementing ways to fetch carbon intensity.
Source code in zeus/carbon.py
39 40 41 42 43 44 45 |
|
get_current_carbon_intensity
abstractmethod
get_current_carbon_intensity()
Abstract method for fetching the current carbon intensity of the set location of the class.
Source code in zeus/carbon.py
42 43 44 45 |
|
ElectrictyMapsClient
Bases: CarbonIntensityProvider
Carbon Intensity Provider with ElectricityMaps API.
Reference:
Source code in zeus/carbon.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
|
__init__
__init__(
location, estimate=False, emission_factor_type="direct"
)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
location |
tuple[float, float]
|
tuple of latitude and longitude (latitude, longitude) |
required |
estimate |
bool
|
bool to toggle whether carbon intensity is estimated or not |
False
|
emission_factor_type |
Literal['direct', 'lifecycle']
|
emission factor to be measured ( |
'direct'
|
Source code in zeus/carbon.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
|
get_current_carbon_intensity
get_current_carbon_intensity()
Fetches current carbon intensity of the location of the class.
Note
In some locations, there is no recent carbon intensity data. self.estimate
can be used to approximate the carbon intensity in such cases.
Source code in zeus/carbon.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
|
get_ip_lat_long
get_ip_lat_long()
Retrieve the latitude and longitude of the current IP position.
Source code in zeus/carbon.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
|