File tree 5 files changed +63
-0
lines changed
electricitymap/contrib/config 5 files changed +63
-0
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "aws-us-east-1" : {
3
+ "displayName" : " us-east-1 (Virginia)" ,
4
+ "lonlat" : [37.3382 , -76.7483 ],
5
+ "provider" : " Amazon Web Services" ,
6
+ "region" : " us-east-1" ,
7
+ "zoneKey" : " US-MIDA-PJM"
8
+ },
9
+ "aws-us-east-2" : {
10
+ "displayName" : " us-east-2 (Ohio)" ,
11
+ "lonlat" : [39.9526 , -82.9959 ],
12
+ "provider" : " Amazon Web Services" ,
13
+ "region" : " us-east-2" ,
14
+ "zoneKey" : " US-MIDW-MISO"
15
+ }
16
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "gcp-europe-west1" : {
3
+ "displayName" : " europe-west1 (Belgium)" ,
4
+ "lonlat" : [50.8503 , 4.3517 ],
5
+ "provider" : " Google Cloud Platform" ,
6
+ "region" : " europe-west1" ,
7
+ "zoneKey" : " BE"
8
+ },
9
+ "gcp-us-central1" : {
10
+ "displayName" : " us-central1 (Iowa)" ,
11
+ "lonlat" : [41.5908 , -93.6208 ],
12
+ "provider" : " Google Cloud Platform" ,
13
+ "region" : " us-central1" ,
14
+ "zoneKey" : " US-MIDW-MISO"
15
+ }
16
+ }
Original file line number Diff line number Diff line change 6
6
7
7
from electricitymap .contrib .config .co2eq_parameters import generate_co2eq_parameters
8
8
from electricitymap .contrib .config .reading import (
9
+ read_data_centers_config ,
9
10
read_defaults ,
10
11
read_exchanges_config ,
11
12
read_zones_config ,
24
25
ZONES_CONFIG = read_zones_config (CONFIG_DIR )
25
26
RETIRED_ZONES_CONFIG = read_zones_config (CONFIG_DIR , retired = True )
26
27
EXCHANGES_CONFIG = read_exchanges_config (CONFIG_DIR )
28
+ DATA_CENTERS_CONFIG = read_data_centers_config (CONFIG_DIR )
27
29
28
30
EU_ZONES = [
29
31
"AT" ,
Original file line number Diff line number Diff line change 17
17
EXCHANGES_CONFIG ,
18
18
ZONE_NEIGHBOURS ,
19
19
ZONES_CONFIG ,
20
+ DATA_CENTERS_CONFIG ,
20
21
)
21
22
from electricitymap .contrib .config .types import Point
22
23
from electricitymap .contrib .lib .types import ZoneKey
@@ -340,3 +341,23 @@ def _load_config_model() -> ConfigModel:
340
341
CO2EQ_CONFIG_MODEL = CO2eqConfigModel (
341
342
direct = CO2EQ_PARAMETERS_DIRECT , lifecycle = CO2EQ_PARAMETERS_LIFECYCLE
342
343
)
344
+
345
+
346
+ class DataCenter (StrictBaseModel ):
347
+ displayName : str
348
+ lonlat : tuple [float , float ] | None
349
+ provider : str
350
+ region : str
351
+ status : str
352
+ zoneKey : ZoneKey
353
+
354
+
355
+ class DataCenters (StrictBaseModel ):
356
+ dataCenters : dict [str , DataCenter ]
357
+
358
+
359
+ DATA_CENTERS_CONFIG_MODEL = DataCenters (dataCenters = DATA_CENTERS_CONFIG )
360
+
361
+
362
+ if __name__ == "__main__" :
363
+ print (DATA_CENTERS_CONFIG_MODEL )
Original file line number Diff line number Diff line change 1
1
from typing import Any
2
+ import json
2
3
3
4
from ruamel .yaml import YAML
4
5
@@ -38,3 +39,10 @@ def read_exchanges_config(config_dir) -> dict[ZoneKey, Any]:
38
39
with open (exchange_path , encoding = "utf-8" ) as file :
39
40
exchanges_config [exchange_key ] = yaml .load (file )
40
41
return exchanges_config
42
+
43
+ def read_data_centers_config (config_dir ) -> dict [str , Any ]:
44
+ data_centers_config = {}
45
+ for data_center_path in config_dir .joinpath ("data_centers" ).glob ("*.json" ):
46
+ with open (data_center_path , encoding = "utf-8" ) as file :
47
+ data_centers_config [data_center_path .stem ] = json .load (file )
48
+ return data_centers_config
You can’t perform that action at this time.
0 commit comments